Hi, I'm supporting a pre-existing Akka project that is currently set up to 
run 1 Master instance and N Worker instances.

It does not use routing/remoting. We start them in 'Master' or 'Worker' 
modes via startup flags - each instance has its own actor system, and the 
only information they communicate to each other is through Redis Pubsub. 
 Each of them does accept API requests so they are all behind a load 
balancer.

The Master actor system and the Worker actor system are slightly different, 
in that Master polls some information and publishes to Redis, while Worker 
subscribes to Redis so they all have the same information to serve to the 
API requests.

Now we have a desire to start up N instances without using the startup 
flags, and have the instances just figure out for themselves which is 
Master - and if it goes down, another would be master, etc. We don't want 
more than one Master, since only one should poll the external information. 
We don't need to send application messages across nodes since we'd keep 
Redis.

Looking at the Akka Cluster tutorials, I'm seeing a couple of options on 
how to do this:

1) Just use leader election, and listen for LeaderChanged messages to make 
Leader always be Master (stopping the Worker actor system and starting the 
Master actor system if necessary). But this seems against the spirit of 
keeping leader election decoupled from application functionality. Plus, in 
experimenting, I'm seeing nodes switch Leader more often than I'd like 
Master to switch (like if I take node #1 down and then bring it back up - 
node #1 seems to end up Leader again even if node #2 was Leader for that 
intervening time).

2) Use ClusterSingleton - but if I did this, what would be the way for the 
Worker nodes to realize it is not the Master Singleton and start up the 
different Worker actor system? With no routing/remoting, Master would not 
be sending messages to them.

It seems like this is a bit against the spirit of using Akka Cluster which 
seems to assume routing. Is there a better way?

Thanks,
Curt

-- 
>>>>>>>>>>      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+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to