patriknw / akka-data-replication

Replication of CRDTs in Akka Cluster
Other
216 stars 18 forks source link

Early preview status #37

Closed rbraley closed 10 years ago

rbraley commented 10 years ago

Hi folks, I was wondering what recommendation you would make if we need a CRDT data model today. Would it be prudent to use akka-persistence and akka-data-replication together to provide this, or go with something like Riak 2.0 CRDTs (or Redis if that's your thing) until this is ready?

patriknw commented 10 years ago

The scope of akka-data-replication is in-memory only, replicating to other nodes in the cluster. It does not have integration with akka-persistence or any other durable data store.

I think Riak 2.0 CRDTs looks promising if you need a full data store.

patriknw commented 10 years ago

@rbraley does that answer your question? May I close the issue?

rbraley commented 10 years ago

Yes. Thank you :) Although I am kind of confused as I thougtht that akka-persistence was orthogonal to akka-data-replication. Since all it would do is journal and persist messages isn't integration unnecessary to use the two together?

— Sent from Mailbox

On Mon, Sep 29, 2014 at 1:14 AM, Patrik Nordwall notifications@github.com wrote:

@rbraley does that answer your question? May I close the issue?

Reply to this email directly or view it on GitHub: https://github.com/patriknw/akka-data-replication/issues/37#issuecomment-57092322

patriknw commented 10 years ago

You are right, it is possible to use them together without tight integration. For some reason I thought you were looking for making akka-data-replication automatically durable.

One way to use them together is to make the updates to akka-data-replication from within the persist block, i.e. after the event has been stored by akka-persistence. It must also be done when replaying events during recovery. Then the replicated data will eventually be replicated to other nodes for fast retrieval (like a cache).

rbraley commented 10 years ago

Yeah. That’s the magic I want! Makes me curious the pros and cons of using a database vs using akka to store and replicate data. It seems like it would make polyglot persistence very easy, but perhaps make data modeling and querying a little tricky. For data per user, it would seem pretty effective for example with akka-sharding. When a user logs in that actor will wake up on some machine and start feeding what it remembered about that user’s settings. CRDTs could be used similarly for shared data. This may sound crazy, but maybe it’s not. For example, FoundationDB essentially decided to build their own akka in C++ just to build their DB; I suppose there’s also Mnesia as another case of an actor model backed datastore. Carl Hewitt’s ideas seem to be a sound foundation for all of computation, including databases, but I am curious if it will be practical and easy to reason about as well.  

Ryan Braley  |  Founder  http://traintracks.io/ 

US: +1 (206) 866 5661 CN: +86 185 1129 5661 Coding the future. Decoding the game.

On September 29, 2014 at 1:43:01 PM, Patrik Nordwall (notifications@github.com) wrote:

You are right, it is possible to use them together without tight integration. For some reason I thought you were looking for making akka-data-replication automatically durable.

One way to use them together is to make the updates to akka-data-replication from within the persist block, i.e. after the event has been stored by akka-persistence. It must also be done when replaying events during recovery. Then the replicated data will eventually be replicated to other nodes for fast retrieval (like a cache).

— Reply to this email directly or view it on GitHub.

patriknw commented 10 years ago

One con of combining akka-persistence + akka-data-replication as I described is that akka-persistence is using single-writer model, while CRDTs themselves are designed for concurrent updates.

patriknw commented 10 years ago

thanks for raising an interesting question