Facebook open sources its mcrouter data-caching tool

The software is designed to make caches across multiple data centers more reliable and efficient

Facebook is releasing mcrouter, its software for turning many cache servers around the world into one distributed system, as open source.

The company announced the release on Monday at its @Scale conference in San Francisco, where it also launched a new open-source project called TODO (Talk Openly, Develop Openly) to make it easier for organizations to use open-source software.

By offering mcrouter as open source, under a BSD (Berkeley Source Distribution) license, Facebook is making the tool available to more users. Facebook is already using it to handle traffic involving thousands of cache servers at the company's data centers around the world, and recent Facebook acquisition Instagram used it on AWS (Amazon Web Services) before switching over to its new parent company's infrastructure, Facebook engineer Rajesh Nishtala said at the conference.

Facebook claims mcrouter can handle almost 5 billion requests per second. The company does more than 4 billion operations per second through its cache tier, while Instagram does about 100 million, Nishtala said.

Cache servers keep the data most used for an application available in RAM for quick delivery, saving applications from having to dig those bits out of storage, Nishtala said. But what was once a nice-to-have performance booster is now relied on for some services, so how it's implemented is critical.

"Sites could become dependent on cache, and the loss of cache could have adverse effects for any site that leverages cache," Nishtala said.

To take full advantage of all the caches in a distributed infrastructure, Facebook developed mcrouter.

Specifically, mcrouter handles traffic for cache infrastructures that use Memcached, a popular distributed memory caching system. It uses the standard ASCII Memcached protocol as an API (application programming interface), because all clients capable of talking to Memcached servers understand that protocol, Facebook said. To clients, mcrouter looks like a Memcached server, and to servers, it looks like a client.

All the features of mcrouter were developed to solve real-world challenges at Facebook and Instagram, so they're all production quality, he said. All of the companies' cache operations go through mcrouter.

Mcrouter handles a wide range of tasks required to keep a cache infrastructure running and efficient, including monitoring, automatic failover detection and cold cache warmup, Nishtala said. Facebook used to implement those functions in its PHP stack. "As you can imagine, this stack got pretty loaded, pretty quickly," Nishtala said. Inconsistent implementations can lead to corrupted data, so Facebook wanted to rein in its caching infrastructure.

Among other things, mcrouter can act as a front end to many Memcached servers, allowing companies to distribute a growing data set across multiple servers when it no longer fits on one. It can also divide memory space into separate pools for different workloads, saving those workloads from having to share space.

Another common cache problem is the lag that can come when new or recently reset servers have to be repopulated with data in demand. When the local memory pool for a given client is empty and an application can't quickly get the data it needs, mcrouter can look in a neighboring "warm" pool that's already up-to-date with the bits that are in demand. After coming through in a pinch, mcrouter can then automatically start populating the new pool with data from the warm one.

This type of "reheating" problem has been a big one for Reddit, which is now testing mcrouter, said Ricky Ramirez, an operations engineer at the social media site. Reddit runs entirely on AWS and consumes up to 300 servers at a time, backed by 73 back-end cache nodes with 1TB of memory, he said in a presentation at the conference.

When memory pools have to be taken down for modification, reheating the cache can take days, during which some users get slow page loads and "random error messages," Ramirez said. Mcrouter gives Reddit automatic failover, pooling of connections and other benefits, he said.

Stephen Lawson covers mobile, storage and networking technologies for The IDG News Service. Follow Stephen on Twitter at @sdlawsonmedia. Stephen's e-mail address is stephen_lawson@idg.com

Join the Good Gear Guide newsletter!

Error: Please check your email address.

Tags redditstorageNetworkinginternetFacebook

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Stephen Lawson

IDG News Service
Show Comments

Most Popular Reviews

Latest News Articles


GGG Evaluation Team

Kathy Cassidy


First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni


For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Steph Mundell


The Fujitsu LifeBook UH574 allowed for great mobility without being obnoxiously heavy or clunky. Its twelve hours of battery life did not disappoint.

Andrew Mitsi


The screen was particularly good. It is bright and visible from most angles, however heat is an issue, particularly around the Windows button on the front, and on the back where the battery housing is located.

Simon Harriott


My first impression after unboxing the Q702 is that it is a nice looking unit. Styling is somewhat minimalist but very effective. The tablet part, once detached, has a nice weight, and no buttons or switches are located in awkward or intrusive positions.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?