How does finagle kestrel cluster work
Question
It says we can use the finagle ServerSet with Zookeeper to create a cluster.
- Should I use the finagle server builder to launch a kestrel cluster? Or the cluster can be built with finagle client only.
- What's the algorithm to distribute the queue in a cluster?
Solution
1 We need to use kestrel as a library instead of running the original kestrel. Code kestrel server based on finagle library.
We can use ServerSet at client side to refer a kestrel cluster registered at ZooKeeper.
https://github.com/robey/kestrel/blob/master/docs/guide.md
At kestrel server side, if the optional zookeeper field of KestrelConfig is specified, kestrel will attempt to use the given configuration to join a logical set of kestrel servers. The ZooKeeper host, port and other connection options are documented here: ZooKeeperBuilder
Kestrel servers will join 0, 1, or 2 server sets depending on their current status
2 The message sender is going to send the message to one randomly picked kestrel server. The message receiver is going to listen to all the kestrel servers and get notified when any kestrel server got a message. So the same queue is distributed on all the server and no algorithms.