Improving Distributed Caching Performance and Efficiency at Pinterest

Pinterest Engineering
12 min readadvanced
--
View Original

Overview

The article discusses Pinterest's advancements in distributed caching performance and efficiency, focusing on their memcached fleet's optimization strategies. It highlights the importance of precise monitoring, hardware selection, and compute efficiency in reducing latency and operational costs.

What You'll Learn

1

How to leverage synthetic load generation for performance evaluation

2

Why optimizing process scheduling can improve caching performance

3

How to implement TCP Fast Open to reduce connection latency

4

When to use extstore for expanding storage capacity in memcached

Prerequisites & Requirements

  • Understanding of distributed caching concepts
  • Familiarity with memcached and mcrouter(optional)

Key Questions Answered

What monitoring tools does Pinterest use for performance evaluation?
Pinterest uses both synthetic load generation tools like memtier_benchmark and production shadow traffic via mcrouter to evaluate performance. These tools allow for high-signal performance evaluation with minimal impact on production traffic, ensuring accurate measurement of optimizations.
How does Pinterest optimize compute efficiency in memcached?
Pinterest optimizes compute efficiency by tuning process scheduling to prioritize memcached, allowing it to handle more requests at lower CPU usage. This adjustment led to a reduction in client-side P99 latency by 10% to 40% and decreased the overall fleet cost footprint.
What are the benefits of using extstore in memcached?
Using extstore allows Pinterest to expand storage capacity beyond DRAM into local NVMe flash disks, significantly increasing storage efficiency and reducing cluster costs. This setup enables handling massive data volumes while maintaining performance.
What networking optimizations has Pinterest implemented?
Pinterest implemented TCP Fast Open to reduce connection latency and improve reliability, particularly across Availability Zone boundaries. This optimization decreased average TCP connection durations by approximately 10%.

Key Statistics & Figures

Requests per second handled by memcached fleet
~180 million
This statistic highlights the scale at which Pinterest's caching system operates.
Network throughput of memcached fleet
~220 GB/s
This figure indicates the high performance and capacity of the caching infrastructure.
Reduction in client-side P99 latency
10% to 40%
This improvement was achieved through process scheduling optimizations.

Technologies & Tools

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

Backend
Memcached
Used as the primary caching system to reduce application latency.
Backend
Mcrouter
Acts as a routing proxy for memcached, facilitating shadow traffic evaluation.

Key Actionable Insights

1
Implement process scheduling optimizations to enhance caching performance.
By prioritizing memcached processes, you can significantly reduce latency and improve request handling, which is crucial for high-demand applications.
2
Utilize extstore to efficiently manage large datasets in memcached.
Extstore allows for cost-effective storage solutions, making it ideal for applications that require high data volume management without compromising performance.
3
Adopt TCP Fast Open to enhance connection speeds in distributed systems.
This optimization is particularly beneficial in cloud environments where connection latency can impact overall application performance.

Common Pitfalls

1
Failing to monitor server-side metrics can lead to undetected performance regressions.
Without proper monitoring, optimizations may not yield the expected results, leading to increased latency and costs.
2
Overlooking the importance of hardware selection can result in inefficient resource usage.
Choosing the wrong EC2 instance types can lead to higher operational costs and suboptimal performance for specific workloads.

Related Concepts

Distributed Caching Strategies
Performance Optimization Techniques
Cloud Infrastructure Management