Memcache automatic horizontal scaling

1.3k views Asked by At

We have a scenario with 2 web servers and 2 memcache servers. The memcache server nodes are configured within the configuration files on each web server.

In order for us to automatically horizontally scale the web servers we need to be able to automatically horizotally scale the memcache servers. Currently we are not able to do that due to the memcache nodes being defined in the web configuration files.

What is the best way to automatically horizontally scale the memcache servers with the least impact on the system.

1

There are 1 answers

0
arunk2 On BEST ANSWER

You can try mcrouter.

What is Mcrouter?

It is a memcached protocol router that is used at Facebook to handle all traffic of cache servers across dozens of clusters distributed in Facebook data centres around the world.

How the scaling happens?

To adding a new server in to the cluster, just adding an IP entry in the route config file. 'mcrouter' automatically detects it and add to the cluster with consistent hashing.

The config file looks like below, with 2 servers entries.

{
   "pools": {
      "A": {
         "servers": [
           "SERVER1_IP:11211",  
           "SERVER2_IP:11211"
         ]
      }
   },
   "route": {
     "type": "OperationSelectorRoute",
     "operation_policies": {
       "add": "AllSyncRoute|Pool|A",
       "delete": "AllSyncRoute|Pool|A",
       "get": "RandomRoute|Pool|A",
       "set": "AllSyncRoute|Pool|A"
     }
   }
 }

Hope it helps!