significant release of the in-memory data caching system , operating on data in key/value format and distinguished by its ease of use. Memcached is commonly used as a lightweight solution to accelerate high-load websites by caching access to databases and intermediate data. Code under the BSD license.
In the new version, the implementation of the storage ‘‘, which is now built by default (with an option to disable it in the configure script using ‘—disable-extstore’), but requires explicit activation at startup (old installations will continue to work without changes after the update). Although the ‘extstore’ storage is generally considered stable, caution is recommended when deploying it in very large systems.
Extstore allows the use of SSD/Flash drives to expand cache size. Like with RAM, the Flash storage is not persistent and is cleared upon restart. The new mode is aimed at providing efficient caching of large data sizes. When using ‘extstore’, keys and metadata are still stored only in RAM, but large data associated with the keys that exceed the set threshold is saved in external storage, with only a pointer remaining in RAM.
If data of small size is associated with the key, Memcached operates as usual, keeping the data in memory and not accessing external storage. If there is plenty of free memory, the most frequently accessed data can additionally reside entirely in memory cache (for example, it can be specified that only objects larger than 1024 bytes that have not been accessed for 3600 seconds should be flushed to Flash).
The implementation is optimized to provide maximum performance and minimal CPU load, sacrificing storage efficiency (high level of fragmentation). To extend the lifespan of Flash drives, data is buffered and written to storage sequentially. To maintain the state of the cache between restarts, the ability introduced in release 1.5.18 to flush the cache dump to a file can be used. On the next startup, the cache can be restored from this file to avoid peak load on content handlers due to cache emptiness (the cache becomes ‘warm’ immediately).
The second major change in Memcached 1.6 was a redesign of the networking code, which is now adapted for automatic handling of batch requests within a single system call. Previously, when sending multiple 'GET' commands in a single TCP packet, memcached would return results by executing separate system calls. In Memcached 1.6, responses are aggregated and returned through a single system call. As a result, there is now an average of 1.5 keys per system call, demonstrating a reduction in CPU load by up to 25% in tests and a decrease in latency by several percent.
The revision of the networking subsystem also allowed for dynamic buffer allocation as needed, rather than static buffer assignment. This optimization reduced memory consumption while waiting for new commands over a client-established connection from 4.5 KB to 400-500 bytes, and eliminated many calls to malloc, realloc, and free, which led to unnecessary memory fragmentation on systems with a large number of connections. Each worker thread now handles its own pool of buffers for reading and writing for active client connections. To configure the size of these buffers,
the options '-o resp_obj_mem_limit=N' and '-o read_buf_mem_limt=N' are provided.
In branch 1.6, it was also announced that the for server interaction will be deprecated. Maintenance of the binary protocol and bug fixes will continue, but new features and updates to existing functions will not be carried over. will continue to evolve unchanged. The binary protocol has been replaced by a new protocol, (a text version of the protocol with compact meta commands), which demonstrates an optimal combination of performance and reliability. The new protocol covers all operations previously available through the text and binary protocols.
Source: opennet.ru
