
The developers swear that they didn’t change the caching recently, they checked the code twice and have found no problem. You spent already 50GB on the memcache cluster, but you still see many evictions and the cache hit ratio doesn’t look good since a few days. If your memcached version is above 1.4.31, read next section for advanced method of dumping keys.
pylibmc (implemented in C) Dumping Memcache Keys. python-memcached (implemented in Python). libmemcached: (used by PHP and others). libketama: (supports C, PHP, Java, Python). Also on large memcached instances refrain from dumping the keys as it might cause some load on your server.
Here is how it should look (screenshot from the project homepage): When using this script ensure access is protected and not to trigger the “flush_all” menu option by default. Most useful is the global memory usage graph which helps to identify problematic instances in a distributed environment. Using this PHP script you can quickly add memcached statistics to a webserver of your choice. It will give you the I/O throughput, the number of evictions, the current hit ratio and if run with “–commands” it will also provide the number of GET/SET operations per interval.īelow you find a screenshot of what stats-proxy looks like: You can use memcache-top for live-monitoring a single memcached instance. Note that some can monitor multiple memcached instances, while others can only monitor a single instance at a time.
We’ll have a look at the following tools. There are not many tools out there, but some useful are. So the question is: How to monitor your distributed memcache setup? And it becomes even more complex if you run multiple or distributed memcache instances available on different hosts and ports. There is no real logging you can only use the -v/-vv/-vvv switches when not running in daemon mode to see what your instance does. But from an operating perspective memcached is a black box. When using memcached or memcachedb everything is fine as long as it is running.
twemproxy (aka nutcracker): proxy with memcached support Monitoring. yrmcds: memcached compatible Master-Slave key value store. Couchbase memcached interface: Use CouchBase as memcached drop-in. repcached: Multi-master async replication (memcached 1.2 patch set). If you really need it you need to use 3rd party solutions: Memcached itself does not support replication. It needs to be created using “add”/”set” again. You can query the current traffic statistics using the commandĭespite the documentation saying something about wrapping around 64bit overflowing a value using “incr” causes the value to disappear. version verbosity Increases log level verbosity quit Terminate session quit Traffic Statistics For example printf "set mykey 0 60 4\r\ndata\r\n" \| nc localhost 11211 add Add a new key add newkey 0 60 5 replace Overwrite existing key replace key 0 60 5 append Append data to existing key append key 0 60 15 prepend Prepend data to existing key prepend key 0 60 15 incr Increments numerical key value by given number incr mykey 2 decr Decrements numerical key value by given number decr mykey 5 delete Deletes an existing key delete mykey flush_all Invalidate all items immediately flush_all flush_all Invalidate all items in n seconds flush_all 900 stats Prints general statistics stats Prints memory statistics stats slabs Print higher level allocation statistics stats malloc Print info on items stats items stats detail stats sizes Resets statistics counters stats reset lru_crawler metadump Dump (most of) the metadata for (all of) the items in the cache lru_crawler metadump all version Prints server version. Command Description Example get Reads a value get mykey set Set a key unconditionally set mykey Įnsure to use \r\n als line breaks when using Unix CLI tools.