10bet网址
MySQL 5.7 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

14.21.1 Benefits of the InnoDB memcached Plugin

This section outlines advantages thedaemon_memcachedplugin. The combination ofInnoDBtables andmemcachedoffers advantages over using either by themselves.

  • Direct access to theInnoDBstorage engine avoids the parsing and planning overhead of SQL.

  • Runningmemcachedin the same process space as the MySQL server avoids the network overhead of passing requests back and forth.

  • Data written using thememcachedprotocol is transparently written to anInnoDBtable, without going through the MySQL SQL layer. You can control frequency of writes to achieve higher raw performance when updating non-critical data.

  • Data requested through thememcachedprotocol is transparently queried from anInnoDBtable, without going through the MySQL SQL layer.

  • Subsequent requests for the same data is served from theInnoDBbuffer pool. The buffer pool handles the in-memory caching. You can tune performance of data-intensive operations usingInnoDBconfiguration options.

  • Data can be unstructured or structured, depending on the type of application. You can create a new table for data, or use existing tables.

  • InnoDBcan handle composing and decomposing multiple column values into a singlememcacheditem value, reducing the amount of string parsing and concatenation required in your application. For example, you can store the string value2|4|6|8in thememcachedcache, and haveInnoDBsplit the value based on a separator character, then store the result in four numeric columns.

  • The transfer between memory and disk is handled automatically, simplifying application logic.

  • Data is stored in a MySQL database to protect against crashes, outages, and corruption.

  • You can access the underlyingInnoDBtable through SQL for reporting, analysis, ad hoc queries, bulk loading, multi-step transactional computations, set operations such as union and intersection, and other operations suited to the expressiveness and flexibility of SQL.

  • You can ensure high availability by using thedaemon_memcachedplugin on a source server in combination with MySQL replication.

  • The integration ofmemcachedwith MySQL provides a way to make in-memory data persistent, so you can use it for more significant kinds of data. You can use moreadd,incr, and similar write operations in your application without concern that data could be lost. You can stop and start thememcachedserver without losing updates made to cached data. To guard against unexpected outages, you can take advantage ofInnoDBcrash recovery, replication, and backup capabilities.

  • 的方式InnoDBdoes fastprimary keylookups is a natural fit formemcachedsingle-item queries. The direct, low-level database access path used by thedaemon_memcachedplugin is much more efficient for key-value lookups than equivalent SQL queries.

  • The serialization features ofmemcached, which can turn complex data structures, binary files, or even code blocks into storeable strings, offer a simple way to get such objects into a database.

  • Because you can access the underlying data through SQL, you can produce reports, search or update across multiple keys, and call functions such asAVG()andMAX()onmemcacheddata. All of these operations are expensive or complicated usingmemcachedby itself.

  • You do not need to manually load data intomemcachedat startup. As particular keys are requested by an application, values are retrieved from the database automatically, and cached in memory using theInnoDBbuffer pool.

  • Becausememcachedconsumes relatively little CPU, and its memory footprint is easy to control, it can run comfortably alongside a MySQL instance on the same system.

  • Because data consistency is enforced by mechanisms used for regularInnoDBtables, you do not have to worry about stalememcacheddata or fallback logic to query the database in the case of a missing key.