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

Consistent hashing router in Typed #27729

Closed
patriknw opened this issue Sep 17, 2019 · 9 comments
Closed

Consistent hashing router in Typed #27729

patriknw opened this issue Sep 17, 2019 · 9 comments
Milestone

Comments

@patriknw
Copy link
Member

@patriknw patriknw commented Sep 17, 2019

I have got votes from this from several persons so I think we should add it. Not critical for 2.6.0 though.

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Oct 18, 2019

@patriknw Could you provide few links to the resources and short description what actually needs to be done?

@patriknw

This comment has been minimized.

Copy link
Member Author

@patriknw patriknw commented Oct 18, 2019

The API for defining such router would be added in https://github.com/akka/akka/blob/master/akka-actor-typed/src/main/scala/akka/actor/typed/scaladsl/Routers.scala
and corresponding javadsl

The implementation would be added similar to the existing in https://github.com/akka/akka/tree/master/akka-actor-typed/src/main/scala/akka/actor/typed/internal/routing

The actual consistent hashing would be using https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/ConsistentHash.scala

See the Classic ConsistentHashingRoutingLogic in https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/ConsistentHashing.scala#L140

In Classic there are 3 ways to extract the hash value from the message. I think we should only have the first (the function) in Typed (at least as a start)
https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/ConsistentHashing.scala#L114

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Oct 21, 2019

I will take it then! :)

@patriknw

This comment has been minimized.

Copy link
Member Author

@patriknw patriknw commented Oct 21, 2019

Thanks, feel free to create a draft PR for early feedback when you have some first implementation in place

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Oct 24, 2019

@patriknw, just to be sure - this should be added as a class implementing RoutingLogic[T], not Behaviour[T], right?

I mean - it should not be a new router next to existing GroupRouter[T] or PoolRouter[T]? It should be a routing logic next to existing RandomLogic[T] and RoundRobinLogic[T]? Or am I wrong and/or missing something?

@patriknw

This comment has been minimized.

Copy link
Member Author

@patriknw patriknw commented Oct 25, 2019

@navaro1 yes, that sounds right. new RoutingLogic, that can be used with existing GroupRouter and PoolRouter

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Oct 25, 2019

@patriknw Very basic and minimal implementation (basically an early draft) is available here: https://github.com/akka/akka/pull/28064/files

Looking forward to getting any tips.

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Nov 1, 2019

@patriknw I have one more question about how to proceed with testing: #28064 (comment)

@navaro1

This comment has been minimized.

Copy link
Contributor

@navaro1 navaro1 commented Nov 6, 2019

@patriknw #28141 <- PR is ready to be reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.