Facebook Open-Sources mcrouter Memcached Protocol Router

By David Cohen 

mcrouter650Facebook announced at its @Scale 2014 conference in San Francisco Monday that it is open-sourcing mcrouter, a memcached protocol router that it uses to handle all traffic to, from and between thousands of cache servers across dozens of clusters distributed in the social network’s data centers.

Software engineers Anton Likhtarov, Rajesh Nishtala and Ryan McElroy described the development of mcrouter in a post on the Facebook engineering blog:

Most Web-based services begin as a collection of front-end application servers paired with databases used to manage data storage. As they grow, the databases are augmented with caches to store frequently read pieces of data and improve site performance. Often, the ability to quickly access data moves from being an optimization to a requirement for a site. This evolution of cache from neat optimization to necessity is a common path that has been followed by many large Web scale companies, including Facebook, Twitter, Instagram and Reddit.

Last year, at the Data@Scale event and at the USENIX Networked Systems Design and Implementation conference, we spoke about turning caches into distributed systems using software we developed called mcrouter (pronounced “mick-router”). mcrouter is a memcached protocol router that is used at Facebook to handle all traffic to, from and between thousands of cache servers across dozens of clusters distributed in our data centers around the world. It is proven at massive scale — at peak, mcrouter handles close to 5 billion requests per second. mcrouter was also proven to work as a standalone binary in an Amazon Web Services setup when Instagram used it last year before fully transitioning to Facebook’s infrastructure.

Today, we are excited to announce that we are releasing mcrouter’s code under an open-source BSD license. We believe it will help many sites scale more easily by leveraging Facebook’s knowledge about large-scale systems in an easy-to-understand and easy-to-deploy package.

The post by Likhtarov, Nishtala and McElroy contains far more detail on mcrouter, but a list of features follows:

  • Standard open source memcached ASCII protocol support.
  • Connection pooling.
  • Multiple hashing schemes.
  • Prefix routing.
  • Replicated pools.
  • Production traffic shadowing.
  • Online reconfiguration.
  • Flexible routing.
  • Destination health monitoring and automatic failover.
  • Cold cache warm up.
  • Broadcast operations.
  • Reliable delete stream.
  • Multi-cluster support.
  • Rich stats and debug commands.
  • Quality of service.
  • Large values.
  • Multi-level caches.
  • IPv6 support.
  • SSL support.
  • Multi-threaded architecture.