Sorry but i have another newbie question. I have an actor that uses cluster 
sharding. There are potentially millions of these in the sytem concurrently 
and they maintain some state. At some point I would like to contact a 
million of these and ask them for their state to render information or 
apply analytics on the states. I could easily do something like this: 

private void collectData(final Set<Integer> ids) {
    final ActorRef ref = 
ClusterSharding.get(MyApp.getActorSystem()).shardRegion(MyActor.SHARD_REGION);
    ids.stream().forEach(ref.tell(new MyActor().GetState(id)));
}




The problem i see is that we are running 9 nodes nominally (there can be 
nodes rolling and other cluster issues) and if I do this call, Im almost 
guaranteed that I am creating a million messages and sending 8/9 ths of 
them over serialization to another node. I keep thinking there has to be a 
better way to call a whole series of actors designated by ids but with the 
SAME message and have the sharding system do its magic, creating actors as 
needed if they have been passivated and sending the message to them. It 
would be even better if I could provide a list of IDs and the rest of the 
message would be packaged up. 

Or it could be that I am overthinking this and should just flood the 
system. After this initial pull the analytics system gets updates from 
those actors via Distributed PubSub and that is efficient, its just at this 
initial call that it MIGHT be bad. For some sets of data the numbers of 
actors i am talking to only number in the tens but for other sets they 
number in the millions. 

 


-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to