Hacker News new | past | comments | ask | show | jobs | submit | hem777's comments login

There’s also OrbitDB https://github.com/orbitdb/orbitdb which to my understanding has been a pioneer for p2p logs, databases and CRDTs.


Number two is calling for nukes, anywhere by anybody. Nobody else brings that to the conversation.


My non-techie brother has been staking his 1 ETH he bought couple of years ago and has earned today, in his words, “slightly more than from my insurance savings account in the past 10 years”. I think that’s a really nice use case.


One way to do authorization is to sign each operation/message and then verify the signature to match a public key in an access control list. This also enables CRDTs to work in a peer to peer context.

But as aboodman says in a sibling comment, if there’s a server as an authority, it can simply reject messages from unauthorized clients.


Great analogy! Well done.


Are you or your people being, or have been, slaughtered by a fascist, barbaric military?

If yes, I’m sorry and I understand your position. If not, gtfo.


Anything goes in war eh? Sad, you should reconsider your humanity before it’s too late


Can you run Redis in browser? You can’t.

Is an in-process, in-memory database faster than making a query over network? Yes it is.



no need an extra layer of abstraction to get an "in memory" database in javascript. no need, babel, webpack, ChatGpt, npm and 10000 libraries for this really. Let me show (works even on the browser):

const KV = {};

KV["credentials"] = {access_key: "XXXX", secret: "YYYY"};

console.log(KV["credentials"].secret);


Maybe? Depends on the rest of the software you’d be developing and what features and abstractions you’d need.

The point was that “just use redis” is a poor and incorrect advice.


Now show me the rest of the functionality of the OP library like TTL.


Someone already replied to this in another comment.


Run Redis on the same machine. No network latency. You only have a few memcpys and context switches versus an in-process solution, and if those make a difference you shouldn't be using JS anyways


Accessing a “home computer” behind a NAT you don’t control or has a dynamic IP, eg. computers/devices that only have mobile connection and many (most?) broadband home connections.


I sometimes need to connect to a CI runner to debug some CI build script. I made a (quick hack of a) tool [0] for doing that by creating an Onion service on the runner listening to SSHD, and printing a one-liner I can paste on my dev machine to connect to it via Tor. This sounds like basically the same idea, but using a DHT and hole punching instead of onion routing.

[0] https://github.com/milesrichardson/shonion


Nodes that are behind unconfigurable CGNATs usually have IPv6. So DDNS + listening on v6 + PMP could achieve same.


*and if you don’t want to sign up for DDNS :)


> Its joining NATO only makes NATO less secure as a whole, rather than strenghtening it.

Why is that?


It doesn't bring additional strength to the table, rather it's a country in need of protection. This means now every other NATO country has a higher chance of being forced in a defensive war if something happens to Finland. On the other hand Finland won't be able to contribute much to protect other NATO countries. Hence, NATO countries are a bit less safe now.


> It doesn't bring additional strength to the table

Strong disagree. With Finland, NATO's control of the Baltic sea is insurmountable. Together with Turkey's control on the Black Sea, this completely cripples any Russian maritime capabilities.

> rather it's a country in need of protection

Also unlikely. The geography of the Finish border is such that an invasion via land is incredibly difficult. Dense forest and mountainous terrain create many easily defended bottlenecks, and the Finns with their outsized artillery are in a perfect position to defend those.

Even without NATO protection, the Finish gave the Russians a very bloody nose the last time they tried to invade. Since then, the Finish military has been re-structured with the single purpose to defend against another Russian invasion, whereas the Russian military is constrained by many other factors. Any Russian advance against the EU now has to come via the Ukrainian and Polish plains.


> "having the instances always process [ops] in the same order" is basically not possible in any real-world network

By having 1) causal order (eg. using what the article refers to as Lamport Causal Clock) and 2) a deterministic sorting function to sort ops that happened concurrently (from the perspective of causal order), we can derive total order.

It’s absolutely possible and used.

And with those two properties, almost any data structure can be turned into a (op-based) CRDT.

That is to say, thoughtlede has it correct in their comments above.


this just isn't true

total order is property that can only exist over a well-defined set of messages

without reliable delivery (and stable network tomography) there is no way to establish a well-defined set of messages

causal order (via lamport clocks or otherwise) just doesn't establish total order (by itself)


We don’t assume “reliable delivery” in AP or eventually consistent systems. We assume “once all messages have been delivered…”

So if you have all messages and the two properties above, a total order can be derived.

You’re correct to say that causal order != total order as such but with the use of correct primitives, like Lamport Causal Clocks, we can get a nice and clean linear order of events :)


"correct primitives" do not by themselves provide a linear order of events

      a
     / \
    b   c
     \ /
      d
b and c are concurrent updates, how do you resolve d?

it's a trick question, you can't resolve d without information loss, unless you bring in additional knowledge from the application

you can resolve d with information loss by defining some heuristic for ordering concurrent updates, a.k.a. last-writer-wins, basically picking one of those updates deterministically

that gets you a total order, but it's cheating: whichever concurrent updates you don't choose are lost, and that violates consistency for any replica(s) that are based on that state

there is no free lunch


> "correct primitives" do not by themselves provide a linear order of events

Review the description of Lamport Causal Clock in the article. Note that it carries “additional info” (additional to the example diagram). This “additional info” is what establishes the structure needed for total order.

> whichever concurrent updates you don't choose are lost, and that violates consistency

They’re not lost! The concurrent updates not chosen are still part of the “list of operations”, but the update to the data/value itself may not be observable if the subsequent update (the update that was sorted to be first) updates the same data/value (eg. both operations update the same key in a key-value structure). If the two operations update different data/value, then both updated values are observable. This isn’t cheating, rather it works exactly as expected: it is eventually consistent.


we are only talking about updates to a specific value here, obviously updates to independent values are trivial to resolve

it's possible to construct a CRDT such that concurrent updates are merged without data loss to a single "list of operations" maintained in the object, but that's not true in general

resolving conflicts with the lww strategy, or variants of that strategy that order concurrent events by e.g. node ID, are indeed eventually consistent at the highest level, but they provide no meaningful consistency guarantees to users, because they allows "committed" writes to be lost


> that's not true in general

Can you elaborate what do you mean by this? I was arguing that it’s possible as the original argument was “this is not possible in a real system and is only theoretical”.

> provide no meaningful consistency guarantees to users, because they allows "committed" writes to be lost

If I set the (shared) value to green and you set it to blue, what is the expected observed value? What if you set it to green and I set it blue, what is the observed value? More importantly, what is the consistency that was lost?


so there are multiple threads of conversation here

first, there is no straightforward way to module "a value" as a CRDT, precisely for the reason you point out: how to resolve conflicts between concurrent updates is not well-defined

concretely, if you set v=green and I set v=blue, then the expected observed value is undefined, without additional information

there are various ways to model values as CRDTs, each has different properties, the simplest way to model a value as a CRDT is with the LWW conflict resolution strategy, but this approach loses information

example: say your v=green is the last writer and wins, then I will observe (in my local replicas) that v=blue for a period of time until replication resolves the conflict, and sets (in my local replicas) v=green. when v changes from blue to green, the whole idea that v ever was blue is lost. after replication resolves the conflict, v was never blue. it was only ever green. but there was a period of time where i observed v as blue, right? that observation was invalid. that's a problem. consistency was lost there.

--

second

> almost any data structure can be turned into a (op-based) CRDT.

yes, in theory. but op-based CRDTs only work if message delivery between nodes is reliable. and no real-world network provides this property (while maintaining availability).


> there was a period of time where i observed v as blue, right? that observation was invalid.

Not invalid. The observation was correct at that time and place, meaning, in the partition that it was observed. This is the P in AP.

It seems to me that you’re talking about and arguing for synchronization, that is, consensus about the values (=state), which takes the system to CP as opposed to AP.

> there is no straightforward way to module "a value"

I would recommend to look into the “Register” (CR)data structure.


there is no single definition of a crdt "register"

i know this because i've implemented many versions of crdt "registers", with different properties, at scale

there are lww registers and multi-value registers, the former provides deterministic (but arbitrary) conflict resolution which loses information, the latter provides deterministic and non-arbitrary conflict resolution without losing information but with a more complex API

> The observation was correct at that time and place, meaning, in the partition that it was observed. This is the P in AP.

this is not what partition means

partition means that different subsets of nodes in a single system have different views on reality

if v=blue was true only during a partition, and is no longer represented in the history of v when the partition heals, then this value is not legal, violates serializability, is incorrect, etc.

https://jepsen.io/consistency#consistency-models

this has nothing to do with synchronization


> there are lww registers and multi-value registers

Use a single value register then in place where I said “register”.

> partition means that different subsets of nodes in a single system have different views on reality

Partition means that nodes of a (single) network are (temporarily) not connected.

In the example discussed here, blue and green were in different partitions thus had “different view” to the state. Once synchronized, their view on the state is consistent and both observe both values, blue being the latest state.

> is no longer represented in the history of v when the partition heals

Please review the above discussion again and the original article. You keep saying this but it’s shown in both that it’s is not true.


"last writer wins" does not preserve state from losing (earlier) writers/writes

after synchronization, all nodes share a consistent view of state (yes) but that state has no history, it only contains the net final value (blue) as the singular and true state

this is not complicated, i think you're out of your element


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: