What is Memcached
Before elaborating on this issue, we must first understand what it "is not". Many people use it as a storage carrier like SharedMemory. Although memcached uses the same "Key=>Value" method to organize data, it is very different from local caches such as shared memory and APC. Memcached is distributed, which means it is not local. It completes the service based on network connection (of course it can also use localhost). It is an application-independent program or daemon process (Daemon mode).
Memcached uses the libevent library to implement network connection services. In theory, it can handle an unlimited number of connections, but it is different from Apache. It is more often oriented towards stable continuous connections, so its actual concurrency capability is There are restrictions. Under conservative circumstances, the maximum number of simultaneous connections for memcached is 200, which is related to the Linux thread capability. This value can be adjusted. For information about libevent, please refer to relevant documentation. Memcached memory usage is also different from APC. APC is based on shared memory and MMAP. Memcachd has its own memory allocation algorithm and management method. It has nothing to do with shared memory and has no restrictions on shared memory. Normally, each memcached process can manage 2GB of memory space. If If more space is needed, the number of processes can be increased.