I am trying to setup an Akka cluster.
I have 3 hosts: host1, host2, host3
2 seed nodes: seed1 is on host1 and seed2 is on host2
2 ShardRegion nodes: SR1 is started on both host1 and host2
1 Query nodes is on host3, which will send 100 messages to the SR1
the idExtractor and shardResolver logic of SR1 are shown as follows:
val idExtractor: ShardRegion.IdExtractor = {
case EntryEnvelope(id, payload) => (id.toString, payload)
case msg @ Get(id) => (id.toString, msg)
}
val shardResolver: ShardRegion.ShardResolver = msg => msg match {
case EntryEnvelope(id, _) => (id % 10).toString
case Get(id) => (id % 10).toString
}From my understanding, I think the message will be sharded to 10 shards, and both SR1@host1 and SR1@host2 hold 5 shards.
But after I sent 100 messages to the SR1, the logs looked like this:
[INFO] [07/20/2015 12:24:57.091] [MyAkkaCluster-akka.actor.default-dispatcher-70][akka.tcp://MyAkkaCluster@host2:13598/user/sharding/Counter1/97] Counter1 got event CounterChanged(1)
If akka.tcp://MyAkkaCluster@host2:13598/user/sharding/Counter1/xx means a new entry actor, I saw both SR1@host1 and SR1@host2 spawned off 50 different entry actors to process the message.
Is it the right way to check how many entry actors that a shardRegion spawn?
--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/e0fqWMFzZuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.