Introducing Dragonfly Cloud! Learn More

Question: Is Memcached single threaded?

Answer

To take advantage of multiple processors, Memcached can be run as multiple instances on different ports or servers. In this way, each instance will have its own single thread and can handle requests concurrently. However, it is important to note that this approach requires careful consideration of the distribution of data between instances to avoid overloading any one instance.

Here is an example of how to start multiple instances of Memcached on different ports using the -p option:

memcached -p 11211
memcached -p 11212
memcached -p 11213

In this example, we are starting three instances of Memcached on ports 11211, 11212, and 11213 respectively. Each instance will have its own single thread and can handle requests concurrently on its respective port.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.