Scaling memcache at Facebook

Visit the post for more.

Venkat Venkataramani
3 min readbeginner
--
View Original

Overview

The article discusses Facebook's journey in scaling memcached since its initial implementation in 2005, highlighting the challenges faced due to the unique nature of the social graph and the high request rates. It emphasizes the importance of cache infrastructure in supporting Facebook's growth to over a billion users and mentions a technical paper detailing their memcache advancements.

What You'll Learn

1

How to scale cache infrastructure to handle billions of requests per second

2

Why partitioning a highly interconnected social graph is challenging

3

How to manage unexpected load changes during rapid product development

Key Questions Answered

How did Facebook initially implement memcached?
Facebook started using memcached in August 2005 when Mark Zuckerberg downloaded it and installed it on Apache web servers to improve page load times as database queries increased. This initial implementation was crucial for providing a fast user experience.
What challenges does Facebook face in scaling its cache infrastructure?
Facebook faces several challenges in scaling its cache infrastructure, including the highly interconnected nature of the social graph with over a trillion objects, the large number of queries generated by popular objects, and the need to adapt to rapid product development cycles that alter backend loads unexpectedly.
What role does memcached play in Facebook's infrastructure?
Memcached plays a critical role in Facebook's cache infrastructure by enabling the handling of billions of requests per second. It supports the fast-paced growth of the platform and helps maintain a snappy user experience despite increasing demands.

Key Statistics & Figures

Requests served per second
billions
This metric illustrates the scale at which Facebook's cache infrastructure operates, enabling it to support a vast user base.
Objects and connections in the social graph
over a trillion
This statistic emphasizes the complexity of Facebook's data structure, which poses significant challenges for scaling.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Invest in robust caching strategies to manage high request rates effectively.
As Facebook's experience shows, a well-implemented cache can significantly enhance performance and user experience, especially for applications experiencing rapid growth.
2
Understand the unique characteristics of your data set when scaling.
The interconnected nature of social graphs presents unique challenges that differ from traditional web applications, necessitating tailored scaling strategies.
3
Stay adaptable to changes in workload due to product development.
Facebook's ongoing product innovations can lead to unexpected load changes, highlighting the need for flexible infrastructure that can quickly respond to new demands.

Common Pitfalls

1
Underestimating the complexity of scaling a highly interconnected data set.
Many developers may not realize that traditional partitioning strategies may not work effectively with social graphs, leading to performance issues and bottlenecks.