April 15, 2013Data · Infra · Caching · Production Engineering · Storage

Scaling memcache at Facebook

Rajesh NishtalaVenkat Venkataramani

Facebook started using memcached in August 2005 when Mark Zuckerberg downloaded it from the Internet and installed it on our Apache web servers. At that time, Facebook was starting to make increasingly sizable database queries on every page load, and page load times were significantly increasing. Providing a fast, snappy user experience has always been a high priority for Facebook, and memcached came to the rescue.

Facebook wasn't the first social network on the Internet, but it is the first one that successfully scaled to more than a billion users. Our cache infrastructure played a significant role in making this happen. Today, our cache infrastructure serves billions of requests per second and enables us to keep moving fast as we grow.

Scaling a social network and the underlying social graph is very different from scaling other web applications like web search, ecommerce, or email. We face the following infrastructure challenges every day:

  1. The social graph is highly interconnected--with over a trillion objects and connections--and isn't easy to partition.
  2. The workload on this data set generates a large number of queries that involve huge fan-outs. Some of the objects in the graph get several orders of magnitude more popular than the average, which can cause huge fan-in issues on the server side.
  3. We are always working on new products that alter the load on our backend in significant and unexpected ways. Keeping up with the rapid product development cycle is the hardest challenge of them all.
A tremendous amount of effort has gone into scaling our cache infrastructure to handle our extremely high request rates and ever-changing products, and memcache is a major piece of this. Our memcache team has written a technical paper that describes some of the key highlights in great technical depth, and we are happy to see the paper published in the 10th Usenix NSDI 2013 proceedings.

You can keep up with the latest development efforts or reach out to our memcache engineering team by liking our Memcache at Facebook Page.

It has been an amazing journey so far and a once-in-a-career learning experience for all of us on the team. Thank you to everyone who has contributed over the years.

Rajesh Nishtala and Venkat Venkataramani work on the infrastructure engineering team.

Keep Updated

Stay up-to-date via RSS with the latest open source project releases from Facebook, news from our Engineering teams, and upcoming events.

Subscribe
Facebook © 2017