Using MySQL with memcached
memcached is a simple, highly scalable key-based cache that stores data and objects wherever
dedicated or spare RAM is available for quick access by applications, without going through layers of
parsing or disk I/O. To use, you run the memcached command on one or more hosts and then use the
shared cache to store objects. For more usage instructions, see Section 15.6.2, “Using memcached”
Benefits of using memcached include:
• Because all information is stored in RAM, the access speed is faster than loading the information
each time from disk.
• Because the “value” portion of the key-value pair does not have any data type restrictions, you can
cache data such as complex structures, documents, images, or a mixture of such things.
• If you use the in-memory cache to hold transient information, or as a read-only cache for information
also stored in a database, the failure of any memcached server is not critical. For persistent data, you
can fall back to an alternative lookup method using database queries, and reload the data into RAM
on a different server.
The typical usage environment is to modify your application so that information is read from the cache
provided by memcached. If the information is not in memcached, then the data is loaded from the
MySQL database and written into the cache so that future requests for the same object benefit from the
For a typical deployment layout, see Figure 15.4, “memcached Architecture Overview”.
... zobacz całą notatkę