Facebook unleashes inter-cache router code on a waiting world
'Mcrouter' released under BSD license
Facebook has slung another slice of code into the open source world: the software that lets it sling content between caches around the world, fast enough to keep The Social NetworkTM social.
First discussed last year at Usenix, “Mcrouter” handles “all traffic to, from, and between thousands of cache servers across dozens of clusters distributed in our data centres around the world”, Facebook's Anton Likhtarov, Rajesh Nishtala and Ryan McElroy write in this post.
From its internal development, they say, the memory cached protocol router was then tested as a binary in AWS, “when Instagram used it last year before fully transitioning to Facebook's infrastructure.”
So, okay: it's a big piece of serious software. Why, however, would the rest of the world want it?
The idea is that on either side of Mcrouter, nobody should notice anything different. The client should think it's connecting to a cache, and not notice its characteristics; and on the other side, a server is dumping data into a cache and forgetting it. To help keep things invisible, Facebook says, Mcrouter uses the standard ASCII memcached protocol as its API.
There are various use-cases that Facebook says are applicable as a Web operation scales up. Described in more detail in the post, they include:
- Scale – With connection pooling and multiple hashing schemes, Mcrouter lets caches scale up across multiple servers, so performance isn't degraded by old content being evicted by new content even though the old content is still being hit;
- Heterogeneous workloads – Prefix-based routing makes it easy to define routing by simple prefixes, and split those workloads into different cache pools;
- Load distribution – Mcrouter helps distribute content so users don't have to keep scaling up a memcached server to support growing read rates;
- Robustness – caches can be failed over at the individual server or pool level;
- Warm-up – the code helps populate new cache servers as they're added to the network; and
- Consistency – Facebook says Mcrouter helps maintain consistency across caches, including in the case of transient failures.