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?
Other Common Memcached Questions (and Answers)
- Does Memcached expire?
- Does Memcached write to disk?
- Does Memcached-top come by default with Memcached?
- What is the location of Memcached error log?
- How does Memcached consistent hashing work?
- How does Memcached work?
- Does restarting Memcached clear cache?
- How to connect to Memcached?
- How do you configure Memcached?
- Does Memcached support encryption?
- How to pronounce Memcached?
- How to check Memcached version in Linux?
Free System Design on AWS E-Book
Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.
Start building today
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.