Memcahced introduced, Memcached is a set of High-performance memory object caching system for some high load Web sites, the main role is to cache database query results, reduce the number of database visits to improve the response speed of dynamic Web applications.
Memcached is a typical C/s architecture, so it is necessary to install server-side (Memcached) and Client (memcache). Server-side is written in C language, the client can be written in any language, such as PHP, Python, Perl and so on.
The data saved in the Memcached is stored in the Memcached built-in memory space and is read faster. Because the data exists only in memory, restarting memcached and restarting the operating system can cause all data to disappear. In addition, when the amount of cached data reaches a specified value or expires, the unused cache is automatically deleted.
Reasons for the occurrence:
With the increase of data volume, the concentration of the access makes the burden of the database server heavier, the database response deteriorates, the website display delay, etc.
Memcache: is a high-performance distributed memory cache server. By caching the database query results, reducing the number of database visits to improve the speed of Web applications, improve scalability. The caching method is to store the cached results in memory and maintain a hash table through memory.
Memcache is a c/s software, the default between the port is 11211
Memcache Application Scenario
(1) memcached most used in the database front-end, less connected to the number of databases, indirectly reduce the operation of the database, improve the efficiency of the model data,
(2) When the amount of data access is very large, it is easy to do horizontal expansion on the memcached, because there is no communication between the memcached but insufficient memory can increase or decrease the amount of memcached node data, Even if one of the memcached is down, it will not cause too much burden on the database.
Memcached Not applicable scene
(1) Small amount of data
(2) Require persistence for cached data