I am going to do something just like you,and I plan to implement an Router and register the connectionActor as routee. What do you think?
在 2014年4月9日星期三UTC+8下午7时24分25秒,Chanan Braunstein写道: > > My use case: > > I have an Actor per websocket called a User. > I have groups of user that need to be notified together. A group is called > a Channel. > > My current implementation is a Channel contains a hashmap of the user id > and the ActorRef to notify. My concern about this is that it won't work > (without additional changes) on a web farm and our site is fairly high > traffic, the hashmap might not scale when there are millions of users on > the site at once. > > Attempt to fix 1: > > I started going down the path of the event bus (with a lookup classifier > by the user id) till I asked the questions a few minutes ago about the > event bus and the cluster. Since events stay in the local jvm that won't > work (without additional work). Someone suggested an Actor to transmit the > events to the other cluster nodes and use the EventBus inside each node. I > am not 100% sure how to do that correctly. > > Question (idea 2). > > Sending a message to each user without the ActorRef can be done via > ActorSelection. My question is, (Although I am guessing the answer is no, > but it doesn't hurt to ask) is: Can I have the ActorRef be in two addresses > at once such that: > > /users/guid -> Actor > /channels/mychannel/guid -> same actor > > If not, and since I cannot duplicate the Actor itself (since it holds a > WebSocket) - I can make a special proxy actor that will know the address of > the real actor and forward message to it. > > Is this a good plan? Any other suggestions that will work across a cluster > in a scalable manor? > > Chanan > -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
