0

I'm looking at doing domain driven design and wanted to know if an instance of an actor that is an aggregate can exist in two places at once on a global network/cluster, say in the USA and also in Europe so clients with staff in both locations don't experience any network latency?

cdmdotnet
  • 1,663
  • 3
  • 17
  • 22
  • You can have two instances of a conceptually a single "entity" in your cluster. Another question however is how are you going to sync them with each other to keep state of your entity consistent? – Bartosz Sypytkowski Mar 06 '17 at 19:36
  • so two actors, doing the same work on the same "row" in a database with the same "akka://address" is a no no? – cdmdotnet Mar 06 '17 at 23:16
  • In scenario where you have one actor in Europe and one in USA, and a single "row", you will experience latency anyway as those two actors must communicate with that row at some point. You can mitigate a read cost by caching it inside each actor but this makes updates more complicated - each actor would then make an update based on its local state, not knowing what changes have been made by other side. – Bartosz Sypytkowski Mar 07 '17 at 18:26
  • Yeah. We've got a pattern where reads aren't an issue, and write performance can be tolerated as it's is a 8 reads to 1 write system... the question we have is, if mailboxes are designed to give order and concurrency control, wouldn't two actors just break that model? – cdmdotnet Mar 07 '17 at 22:46
  • Each actor instance has it's own mailbox. What I meant is that you can have two actor instances representing the same domain entity, however this introduces a certain class of synchronization problems between them. Message order is maintained only on the connection level (so instance B receiving messages from instance A will have them in order). If you have more questions, I think that gitter channel is better for discussion: https://gitter.im/akkadotnet/akka.net – Bartosz Sypytkowski Mar 08 '17 at 16:30

0 Answers0