Introducing mcrouter: A memcached protocol router for scaling memcached deployments

Visit the post for more.

Hans Fugal
9 min readadvanced
--
View Original

Overview

The article introduces mcrouter, a memcached protocol router developed by Facebook to enhance the scalability of memcached deployments. It details mcrouter's features, implementation, and its proven performance at handling billions of requests per second, making it an essential tool for large-scale caching solutions.

What You'll Learn

1

How to implement mcrouter in a memcached environment

2

Why mcrouter is beneficial for scaling cache deployments

3

How to configure mcrouter for different caching strategies

Prerequisites & Requirements

  • Basic understanding of caching concepts
  • Familiarity with memcached and distributed systems(optional)

Key Questions Answered

What is mcrouter and how does it function?
mcrouter is a memcached protocol router that acts as an intermediary between clients and memcached servers, allowing for efficient routing of requests. It supports various features like connection pooling, multiple hashing schemes, and online reconfiguration, making it suitable for large-scale deployments.
What are the key features of mcrouter?
Key features of mcrouter include standard memcached ASCII protocol support, connection pooling, multiple hashing schemes, prefix routing, replicated pools, and online reconfiguration. These features enhance its functionality beyond a simple proxy, allowing for complex caching strategies.
How does mcrouter handle destination health monitoring?
mcrouter monitors the health of each destination and automatically fails over requests to an alternate destination if a destination is marked unresponsive. It distinguishes between soft and hard errors, ensuring transparency to the client while maintaining high availability.
What performance metrics does mcrouter achieve?
At peak performance, mcrouter handles close to 5 billion requests per second, demonstrating its capability to manage massive traffic loads effectively across distributed cache servers.

Key Statistics & Figures

Requests handled per second
5 billion
This performance metric highlights mcrouter's capability to manage extensive traffic loads effectively.

Technologies & Tools

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

Programming Language
C++
mcrouter is primarily written in C++, utilizing C++11 features for its implementation.
Tool
Ragel
Used for protocol parsing within mcrouter.
Library
Libevent
Facilitates asynchronous network event processing in mcrouter.
Library
Folly
Provides various utilities and features used in mcrouter.
Library
Fbthrift
Used for asynchronous networking code in mcrouter.

Key Actionable Insights

1
Integrating mcrouter into your caching strategy can significantly enhance performance and scalability.
As web applications grow, the demand for efficient data retrieval increases. By implementing mcrouter, you can manage thousands of cache servers seamlessly, ensuring quick data access and improved user experience.
2
Utilize mcrouter's online reconfiguration feature to adapt to changing workloads without downtime.
This capability allows you to modify routing configurations dynamically, which is crucial for maintaining performance during peak traffic times or when introducing new caching strategies.
3
Leverage mcrouter's health monitoring and automatic failover to enhance system reliability.
By ensuring that requests are rerouted to healthy destinations, you can maintain high availability and reduce the impact of server failures on your application.

Common Pitfalls

1
Failing to monitor the health of cache destinations can lead to service interruptions.
Without proper health checks, requests may be sent to unresponsive servers, causing delays and errors. Implementing mcrouter's health monitoring can mitigate this risk.

Related Concepts

Distributed Caching Strategies
Memcached Architecture
Performance Optimization Techniques