How to handle ActorRef with a load balancer?


I’m using WebSockets in my Play 2.5 app. This app is replicated (2 instances) behind a NGINX load balancer. Because each WebSocket connection is stored as an ActorRef, how can I share the ref between the 2 instances of my app? Thanks.


First, websockets are persistent connection, so they will always be on a single instance. ActorRefs can be shared accros instances. Hook up akka cluster, en then directly target an actor on an instance, or use one of the cluster features. It pretty much boils down to the specific use case.


1 Like

Thanks for your answer, I will have a look on the Akka clusters doc.