0
votes

With Play! 2.0 and Akka, which is supposed to provide a platform for building highly scalable apps, is it feasible to create a MultiUserChat server? Right now, I'm thinking on the lines of one Akka 'actor' per user, and storing a static array of actors in-memory in the server -- based on the sample provided in the Play! framework package. Each incoming request from the client will act on the respective user's actor object.

User information and Chat Room information will be written to Redis so that in case the server needs to restart, it can recover and rebuild the set of actors.

But I don't believe this will scale.

Any thoughts?

1
Scrap the static Array and you're fine. read the Akka docs: doc.akka.ioViktor Klang
Thanks Viktor. Akka is truly impressive.Shirish Kamath
@ViktorKlang What if the play app runs on multiple servers, and say there is a actor(ChatroomActor) for managing a chatroom. So when the user1 creates a room by connecting to server1 and if the user2 connects to server2 and wants to join the room in the server1 created by user1, how is that gonna be? Remote actors? Or do I miss something else here?Ömer Faruk Gül
You could use a cluster singleton actorViktor Klang

1 Answers

0
votes

You can try my example : play-akka-cluster-websocket-chat. This this sample of integration a play framework 2 app (java) with akka cluster. It's provide a possibility to add new play node for scale system. when a new node added all nodes in the cluster share chat messages, no matter which node receives the message.

I create new actor for every chat room on all nodes and share chat message between cluster.