News for hackers. Stuff that matters.
Re:Braid: Synchronization for HTTP by pm90 on Monday November 25, 2019 @04:59PM (#21633272)
Can someone with a mathematical background explain what the practical uses of this protocol are? It talks about time travel and state synchronization v/s state transfer. Is this an effort to create a protocol that e.g. allows for distributed systems over http instead of relying on "custom" implementations such as Paxos? (i'm pretty sure I'm misunderstanding this, please feel free to correct)
Re:Braid: Synchronization for HTTP by toomim on Monday November 25, 2019 @05:12PM (#21633375)
Yes, the braid protocol could let you run a distributed system over HTTP. It lets you put a CRDT or OT behind any HTTP resource, which lets you distribute the resource, with multiple writers, and guarantee consistency after arbitrary edits. Each resource will still have a URL, with one particular hostname, but the actual state can live and be modified simultaneously on multiple hosts.

The first thing you might use this for is collaborative editing. Braid can give you the power of Google Docs at any HTTP URL, without writing additional code.

This also improves performance. Instead of using heuristics to determine when a cache needs to be reload (cache-control max-age, last-modified, etags), Braid will automatically push all updates to caches -- guaranteed. That means you never need to force-reload a page, or force-clear a cache. Also, updates are sent as minimal diffs, rather than re-sending the entire resource whenever it changes. This saves a lot of bandwidth and a lot of round-trip latency when loading a page.

As a third practical example, Braid makes it very simple to read and write data from multiple web sites. By collapsing time, braid implementations let you write code that manipulates state at any URL as easily as a local variable. It doesn't matter whether state is located on your server, or someone else's server, or distributed on everyone's servers and clients. It's all equally easy to interact with.

This also makes it easy to write a new UI for an existing site.

As for Paxos, yes, CRDTs are an alternative to Paxos, and CRDTs can be used in Braid. CRDTs have some performance improvements over Paxos -- Paxos chooses a leader, and whenever the leader is unreachable, a new leader election takes place which requires a couple network round trips before any new edits can be broadcast. CRDTs are always editable, and edits can always be broadcast.

Re:Braid: Synchronization for HTTP by sagichmal on Monday November 25, 2019 @07:57PM (#21634700)
> Braid can give you the power of Google Docs at any HTTP URL, without writing additional code.

What implements the OT or CRDT logic? The webserver itself?

Re:Braid: Synchronization for HTTP by toomim on Monday November 25, 2019 @08:02PM (#21634730)
Yes, the server and client implement the logic. Each URL specifies its "Merge-Type" in a header, which defines the spec for the OT or CRDT that they implement.
Re:Braid: Synchronization for HTTP by sagichmal on Monday November 25, 2019 @08:23PM (#21634841)
Why should this be implemented in HTTP itself, rather than as an application using HTTP as a transport?
Re:Braid: Synchronization for HTTP by toomim on Monday November 25, 2019 @10:38PM (#21635475)
I suggest reading the introduction to either of these specs:

- https://datatracker.ietf.org/doc/html/draft-toomim-braid

- https://datatracker.ietf.org/doc/html/draft-toomim-httpbis-b...

People do synchronize at the application level today. But every application invents its own non-standard synchronization method, which is incompatible with every other application. This results in each website only accessing its own state, rather than sharing state with other websites, and the web becomes a bunch of walled gardens.

In order to decentralize the web, we need a standard for the internal state of websites, that makes it easy for websites to re-use the state of other websites. Where the original web allows any website's pages to link to any other site's pages, Braid allows any site's internal state to synchronize with the internal state from any other site.

Now, you might ask why we should implement a standard at the HTTP level, rather than make a standard on top?

Well, it turns out that HTTP and REST are already designed for sharing state-- but they are just limited to state transfer rather than state synchronization. It is very natural to extend it to synchronization -- we can do it with just 5 new headers, 1 new response code, 2 range units, and 1 new registry.

And if you try to build something on top, you'll have to re-implement all the great things that HTTP has invented that we now take for granted: caching, CDNs, idempotency, media types, etc. By putting synchronization into HTTP, we can add these features to the existing web. Caches (like CDNs) can suddenly support dynamic content -- not just static content. If you change a line of code in your Javascript, all clients will update with just a diff, rather than re-requesting the entire file. The reload button becomes obsolete. Existing HTTP network traffic becomes more efficient. Every TEXTAREA can become a collaborative editor.

Re:Braid: Synchronization for HTTP by sagichmal on Tuesday November 26, 2019 @04:20AM (#21636695)
> In order to decentralize the web, we need a standard for the internal state of websites, that makes it easy for websites to re-use the state of other websites.

This is not coherent.

Re:Braid: Synchronization for HTTP by sagichmal on Tuesday November 26, 2019 @11:43AM (#21639930)
To say more, state that can be modeled as an e.g. CRDT is always domain bounded, and almost always subject to domain constraints like, at a minimum, authn/authz. Even if you can come up with a domain whose state makes sense to share between website boundaries, making agnostic intermediaries like HTTP servers state-aware enough to perform semantic merges necessarily strips that state of any notion of privacy. This logic doesn't make sense to have at the transport or data layer of a public network.
Re:Braid: Synchronization for HTTP by toomim on Tuesday November 26, 2019 @02:58PM (#21642051)
Your concern is that adding CRDT merge semantics somehow prevents a server from implementing access control? That's not the case.

The Braid spec does not impede access control — that works just like it always has on the web. A client logs into a server. If a client does a GET request, the server decides whether the client can see the result. If a client does a PUT request, the server decides whether to allow it. The only difference is that these GET and PUT requests can now be broken into granular patches with a version history.

And if you want to build a peer-to-peer network, then you will replace the server with a validation function running on each peer, and authentication with a crypto scheme. But we aren't at the point of trying to standardize that stuff yet.

Re:Braid: Synchronization for HTTP by sagichmal on Tuesday November 26, 2019 @06:45PM (#21643913)
> Your concern is that adding CRDT merge semantics somehow prevents a server from implementing access control?

My concern is that this requirement means the state can't be encrypted.

> if you want to build a peer-to-peer network, then you will replace the server with a validation function running on each peer, and authentication with a crypto scheme

How do you break a GET request of some state blob into "granular patches" if the state is encrypted?