Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Consistent Hashing router support #11

Closed
rogeralsing opened this issue Feb 11, 2014 · 3 comments
Closed

Add Consistent Hashing router support #11

rogeralsing opened this issue Feb 11, 2014 · 3 comments
Assignees

Comments

@rogeralsing
Copy link
Contributor

http://doc.akka.io/api/akka/snapshot/index.html#akka.routing.ConsistentHashingRouter

There is 3 ways to define what data to use for the consistent hash key.

  1. You can define hashMapping / withHashMapper of the router to map incoming messages to their consistent hash key. This makes the decision transparent for the sender.
  2. The messages may implement akka.routing.ConsistentHashingRouter.ConsistentHashable. The key is part of the message and it's convenient to define it together with the message definition.
  3. The messages can be be wrapped in a akka.routing.ConsistentHashingRouter.ConsistentHashableEnvelope to define what data to use for the consistent hash key. The sender knows the key to use.
@rogeralsing
Copy link
Contributor Author

For implementation, see:

https://github.com/akka/akka/tree/master/akka-actor/src/main/scala/akka/routing
https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/ConsistentHashing.scala

I guess the easiest way is to copy RoundRobinGroup and reimplement the *Logic class to deal with the 3 above listed ways of hashing.
But try to keep close to the Akka impl

@rogeralsing
Copy link
Contributor Author

Some initial support added:
We now support consistent hashing through:

  • Messages implementing ConsistentHashable
  • Wrapping messages in a ConsistentHashableEnvelope message

via ConsistentHashGroup router.

@rogeralsing
Copy link
Contributor Author

Added pool support also.

Can't mark this one as complete though, there are alot more magic to consistent hashing, Akka has virtual nodes and other features we need to deal with.

Aaronontheweb added a commit that referenced this issue Oct 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants