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?
- What is the location of Memcached error log?
- How does Memcached consistent hashing work?
- Does restarting Memcached clear cache?
- Does Memcached support encryption?
- How to pronounce Memcached?
- How to check Memcached version in Linux?
- How to install Memcached in CentOS 7?
- How is Memcached implemented?
- How to clear Memcached data?
- How does Memcached work in PHP?
Free System Design on AWS E-Book
Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.
Switch & save up to 80%
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost