AkkaPersistence in Cluster

73 views
Skip to first unread message

Martin Jöhren

unread,
Aug 15, 2014, 4:39:23 AM8/15/14
to akka...@googlegroups.com
Hi,

I have a question to a distributed EventSource system:

Let's say I have a fixed number of nodes (3) because I want to balance load. Each node has a persistent actor which should write to cassandra the events which have been created and update their inner state afterwards. Now I'm asking myself what is the best approach to inform the other nodes about that change because they also need to know the state change?

* use the distributed pub sub (and therefore create a cluster)?
* use remote actors to directly inform the other nodes about the change?
* other solution?

Thanks and best regards

Martin

Patrik Nordwall

unread,
Aug 15, 2014, 7:14:55 AM8/15/14
to akka...@googlegroups.com
Hi Martin,


It is probably easiest to replicate the events with PersistentView.

The other approaches can also work, but be aware of:
- messages can be lost
- when a node is started it might need to get the initial state from the other nodes

Regards,
Patrik

 
Thanks and best regards

Martin

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--

Patrik Nordwall
Typesafe Reactive apps on the JVM
Twitter: @patriknw

Martin Jöhren

unread,
Aug 15, 2014, 7:53:03 AM8/15/14
to akka...@googlegroups.com
Thanks Patrik!

Martin Jöhren

unread,
Aug 16, 2014, 12:44:23 PM8/16/14
to akka...@googlegroups.com

Just to be sure: that means having something like a singleton actor which persists the events in the cluster? And several others as views to deliver read requests?
What if I want to have multiple persistent actors of the same type based on resilient reasons? 


You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/4PF6oF_l9eY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Martin Jöhren

unread,
Aug 16, 2014, 12:44:34 PM8/16/14
to akka...@googlegroups.com

Just to be sure: that means having something like a singleton actor which persists the events in the cluster? And several others as views to deliver read requests?
What if I want to have multiple persistent actors of the same type based on resilient reasons? 


On Aug 15, 2014 1:14 PM, "Patrik Nordwall" <patrik....@gmail.com> wrote:
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/4PF6oF_l9eY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Konrad Malawski

unread,
Aug 16, 2014, 6:34:59 PM8/16/14
to Akka User List
Hello Martin,
Yes, there needs to be exactly one actor which performs writes for a given persistenceId in the system (though using ClusterSharding you can easily migrate it between servers etc).
Other "read actors" should be PersistentViews. The reason for this requirement is that we need to ensure ordering guarantees between between the stored events.

You can have as many PersistentActors "of the same type" as you want in the system, but by that I understand the "type" (as in "class").
The persistenceId of these must be different.

Hope this helps, have a great weekend!
Cheers,
Konrad 'ktoso' Malawski
hAkker @ Typesafe


Martin Jöhren

unread,
Aug 17, 2014, 2:27:04 AM8/17/14
to akka...@googlegroups.com

Thanks mate. That makes it clear. Have a nice weekend too.

Martin

Reply all
Reply to author
Forward
0 new messages