MySQL :: MySQL 8.0 Reference Manual :: 17.20.2 InnoDB memcached Architecture (original) (raw)
17.20.2 InnoDB memcached Architecture
The InnoDB
memcached plugin implements memcached as a MySQL plugin daemon that accesses the InnoDB
storage engine directly, bypassing the MySQL SQL layer.
The following diagram illustrates how an application accesses data through the daemon_memcached
plugin, compared with SQL.
Figure 17.4 MySQL Server with Integrated memcached Server
Features of the daemon_memcached
plugin:
memcached as a daemon plugin ofmysqld. Both mysqld andmemcached run in the same process space, with very low latency access to data.
Direct access to
InnoDB
tables, bypassing the SQL parser, the optimizer, and even the Handler API layer.Standard memcached protocols, including the text-based protocol and the binary protocol. The
daemon_memcached
plugin passes all 55 compatibility tests of the memcapable command.Multi-column support. You can map multiple columns into the“value” part of the key-value store, with column values delimited by a user-specified separator character.
By default, the memcached protocol is used to read and write data directly to
InnoDB
, letting MySQL manage in-memory caching using theInnoDB
buffer pool. The default settings represent a combination of high reliability and the fewest surprises for database applications. For example, default settings avoid uncommitted data on the database side, or stale data returned formemcachedget
requests.Advanced users can configure the system as a traditionalmemcached server, with all data cached only in the memcached engine (memory caching), or use a combination of the“memcached engine” (memory caching) and the
InnoDB
memcached engine (InnoDB
as back-end persistent storage).Control over how often data is passed back and forth between
InnoDB
and memcached operations through theinnodb_api_bk_commit_interval,daemon_memcached_r_batch_size, anddaemon_memcached_w_batch_size configuration options. Batch size options default to a value of 1 for maximum reliability.The ability to specify memcached options through thedaemon_memcached_option configuration parameter. For example, you can change the port that memcached listens on, reduce the maximum number of simultaneous connections, change the maximum memory size for a key-value pair, or enable debugging messages for the error log.
The innodb_api_trx_level configuration option controls the transactionisolation level on queries processed by memcached. Althoughmemcached has no concept oftransactions, you can use this option to control how soonmemcached sees changes caused by SQL statements issued on the table used by thedaemon_memcached plugin. By default,innodb_api_trx_level is set to READ UNCOMMITTED.
The innodb_api_enable_mdl option can be used to lock the table at the MySQL level, so that the mapped table cannot be dropped or altered byDDL through the SQL interface. Without the lock, the table can be dropped from the MySQL layer, but kept in
InnoDB
storage untilmemcached or some other user stops using it. “MDL” stands for “metadata locking”.