Lets say we have the following senario

* we have an unbounded number of entities
* each entity may only process one command at a time
* each entity only process a few messages occasionally and then idle for an 
undefined amount of time

Spawning an actor for each entity would force us to keep atleast one actor 
per entity in memory all the time. which is expensive since the will mostly 
be idle.

What would be the most idiomatic Akka way to deal with this?

Should we instead add an entity Id to each message, and have a custom 
router that directs each message to a pool of actors and create an affinity 
between the entity id and the pooled actor?
e.g.

someting like:
var poolIndex = ((IHaveId)message).Id.GetHashCode() % poolSize;

This way, I could direct every message for a specific entity to the same 
underlying worker actor and thus prevent concurrency issues for this entity.
The worker actor could also fetch the entity on demand and then release it 
once the command completes.

Are there other alternatives?

//Roger

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      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/groups/opt_out.

Reply via email to