Reducing Transactional Overhead
The default value of 1 for the configuration options
daemon_memcached_r_batch_size[1736] and
daemon_memcached_w_batch_size[1737] is intended for maximum reliability of results and safety of stored or updated data.
Depending on the type of application, you might increase one or both of these settings to
reduce the overhead of frequent commit operations. On a busy system, you might increase
daemon_memcached_r_batch_size[1736], knowing that changesto the data madę through
SQL might not become visible to memcachedimmediately (that is, until N morę get operations were
processed). When Processing data where every write operation must be reliably stored, you would
leave daemon_memcached_w_batch_size[1737] set to 1. You might increase it when Processing
large numbers of updates intended to only be used for statistical analysis, where it is not critical if the
last N updates are lost in case of a crash.
For example, imagine a system that monitors traffic Crossing a busy bridge, recording approximately
100,000 vehicles each day. If the application simply counts different types of vehicles to
analyze traffic patterns, it might change
daemon_memcached_w_batch_size[1737] from
1 to 100, reducing the l/O overhead for commit operations by 99%. In case of an unexpected
outage, only a maximum of 100 records could be lost, which might be an acceptable margin of
error. If instead the application was doing automated toll collection for each car, it would keep
daemon_memcached_w_batch_size[1737] set to 1 to ensure that every toll record was
immediately saved to disk.
Because of the way InnoDBorganizes the memcachedkey values on disk, if you have a large number
of keys to create, it can be faster to sort all the data items by the key value in your application and add
them in sorted order, rather than creating them in arbitrary order.
The memslapcommand, which is part of the regular memcacheddistribution but not included with
the MySQL server, can be useful for benchmarking different config u rations. It can also be used to
generate sample key/value pairs that you can use in your own benchmarking. SeeSection 15.6.3.3.6,
“librnemcachedCommand-Line Utilities" for details.