0

How can I build a cluster of memcached server and access it with finagle. ct Looks like ServerSet with ZooKeeper can be used to build a cluster. But I have several questions.

1 What's the algorithm to distribute the key to the memcached servers in the cluster. Can I change that? 2 How does finagle detect memcached server failure and how is failover done. Looks like everything is done from the client side. Nothing need be done on the server side.

Thanks

jordan
  • 711
  • 1
  • 8
  • 17

1 Answers1

2
  1. The default algorithm used to distributed keys is the Ketama algorithm. See the code You can't change the algorithm easily.

  2. There's different algorithms that detect different type of failures:

    • failFast: if there's a disconnection, we evict the server from the pool and start a background process to reconnect to it
    • retries: if the failed to do an action, we can retry a specific number of try (potentially using exponential backoff)
    • timeout (different levels), no need to explain
    • balancing: based on the least number of pending requests per hosts
Steve Gury
  • 15,158
  • 6
  • 38
  • 42
  • One question about the failure detection. Each client decide the failover by itself. How can multiple clients keep the same pool. Using Zookeeper cluster? Thanks – jordan Sep 27 '12 at 05:35
  • There's no guarantee that clients will always have the same pool of server, and you shouldn't need that (you can have a partitioning errors that prevent that). The ketama algorithm distributes keys in a way that removing a server doesn't impact *drastically* the key distribution. – Steve Gury Sep 27 '12 at 06:22
  • One more question. If I want to add a server in the cluster on the fly, how to do that with finagle? Thanks – jordan Sep 27 '12 at 14:30
  • Did you figure it out? Runtime addition? – Ravindranath Akila Nov 28 '13 at 03:49