Reputation: 31
I recently discovered the akka framework and felt it was a good match for one of my projects. I must say I'm very impressed with it so far.
In my project, I need to have 1M+ entities receive state updates a very fast rate. Naturally, akka actors seem to be the first choice. I do however wonder if I'm not better off using agents to store the state updates (so far, my actors only have two messages - one for updating the state and the other for reading it -- and I don't believe that will ever change).
Looking at the few examples for agents, I get the feeling that they are not meant to store large complex state. Am I wrong?
In short, I would like to store something like:
case class AgentState(val list1 : List[Int], val list2 : List[Int], val peers : List[Agent])
Obviously, updating the state becomes less pretty than in toy examples where you use integers ;)
Does it make sense then to have an Agent? How would you go about doing this?
Thanks for your answers!
-LP
Upvotes: 3
Views: 2324
Reputation: 26579
Akka Agents are backed by Actors, so it only makes sense if you want to have concurrent readers and serial writers.
Upvotes: 4