News for hackers. Stuff that matters.
Re:Eventual Consistency in Real-time Web Apps by dahjelle on Tuesday June 17, 2014 @09:45AM (#7904345)
Are there any "standard" models for treating a realtime web app as just another distributed database node (with, of course, extra security precautions and having to do server-side data re-validation)? I'm aware of CouchDB/PouchDB and Meteor's use of mini-Mongo client-side. Are there others?
Re:Eventual Consistency in Real-time Web Apps by skrebbel on Tuesday June 17, 2014 @04:02PM (#7906647)
This seems to be like the big problem of modern (web) app development. Even for not-very-realtime apps, the problem is essentially the same, and non trivial (single page web) apps I've seen end up hand-cooking some sort of sync protocol through a mixture of REST calls and maybe some websockets here and there.

I like the Couch/Pouch idea, but it's really only handy when CouchDB fits your data. You can stream all CouchDB updates to a RDBMS using the changes stream, for example when you want to easily create management information, but I don't see how you can avoid making the CouchDB bunch-of-documents-per-db concept central to the app.

I haven't looked into Meteor, but my suspicion is that due to Mongo's comparably document-oriented setup, it can't be all that different.

Re:Eventual Consistency in Real-time Web Apps by mathbr on Wednesday June 18, 2014 @07:32AM (#7909450)
When I had to do that for some apps, the main issues were * while being offline some notifications get lost so one needs to get a sense of the general state of the central server * I wanted to synchronize only part of the database to each client (data it has the right to see) * pushes to the server could not be generic due to business logic (again, rights of the user)

Thus I started recording changes on the client, pushing them to the central server through functional endpoints and then pulling all changes from the server. To pull data from the server I found a paper[1] with an interesting way of encoding data so that the client can get a sense of the difference by getting a data structure of size proportional to the diff (no matter the whole dataset size). I developed a library for that, pretty limited for now [2].

[#2] http://conferences.sigcomm.org/sigcomm/2011/papers/sigcomm/p... [#1] https://github.com/3musket33rs/mathsync

Re:Eventual Consistency in Real-time Web Apps by lucian1900 on Tuesday June 17, 2014 @10:32AM (#7904620)
If you have a CRDT implementation you can use on both sides, you can perform operations on the client and merge with the server correctly.
Re:Eventual Consistency in Real-time Web Apps by dahjelle on Tuesday June 17, 2014 @10:45AM (#7904693)
That's exactly what I'm planning on doing, as that seems to be simultaneously correct and relatively easy to program. I'm surprised, though, that I haven't found a "nicely packaged" version of some CRDTs, a server DB, and a client-side DB. I suppose it is probably because everyone's use-cases are so different and that using CRDTs limit the data you can use, to some degree.
Re:Eventual Consistency in Real-time Web Apps by skrebbel on Tuesday June 17, 2014 @03:14PM (#7906368)
I'm just learning about CRDTs because of this thread.

Which CRDT things did you find, did you experiment with any, which are you using and why?

Re:Eventual Consistency in Real-time Web Apps by dahjelle on Tuesday June 17, 2014 @05:49PM (#7907237)
(semi cross-posted from another comment)

Aral Balkan gave a talk on a CRDT called WOOT for text editing[1] that I found really helpful to get the general idea of the concept. (Really only the last 8 or 9 minutes of his talk.)

If you want more of the nitty-gritty on some of the different types of CRDT, there's fairly readable paper on the topic[2].

From there, you can start using Google Scholar to find the other papers that have been written.

[1] https://www.youtube.com/watch?v=NSTZ4mIv_wk [2] http://hal.upmc.fr/docs/00/55/55/88/PDF/techreport.pdf

Re:Eventual Consistency in Real-time Web Apps by mantraxB on Tuesday June 17, 2014 @10:07AM (#7904467)
Actors.
Re:Eventual Consistency in Real-time Web Apps by seanmcdirmid on Tuesday June 17, 2014 @10:13AM (#7904503)
Actors says nothing about consistency; you have to do it all on your own. Basically a non solution in this area.
Re:Eventual Consistency in Real-time Web Apps by jburwell on Wednesday June 18, 2014 @11:17AM (#7910573)
+1. Actors are simply a unit of concurrency and means of communication between those units. Their scope and division of labor, as well as, the associated communication protocols are left to developer. They provide no inherent consistency guarantees.