Memcached stats reset command
By Cyrille Mahieux on Thursday, January 27 2011, 18:40 - Memcached - Permalink
Stats reset is another undocumented feature (see this article for stats cachedump command) of Memcached
stats reset command
Telnet command : stats reset \r\n
This function will reset following stats :
- total_connections
- get, set, flush, cas, incr and decr stats
- auth_cmds and auth_errors
- bytes_read and bytes_written
- total_items will be reset but not curr_items
- evictions and reclaimed
stats reset command example
First we get the current stats :
stats
stats STAT pid 16963 STAT uptime 13759537 STAT time 1288017338 STAT version 1.4.5 STAT pointer_size 64 STAT rusage_user 35326.604539 STAT rusage_system 83474.312975 STAT curr_connections 443 STAT total_connections 7062593 STAT connection_structures 708 STAT cmd_get 6994013410 STAT cmd_set 285664007 STAT cmd_flush 11 STAT get_hits 6709348930 STAT get_misses 284664480 STAT delete_misses 133333 STAT delete_hits 641874 STAT incr_misses 0 [...] STAT auth_errors 0 STAT bytes_read 1078950472291 STAT bytes_written 2380539854758 STAT limit_maxbytes 1610612736 [...] STAT conn_yields 0 STAT bytes 1019869479 STAT curr_items 1019724 STAT total_items 285630709 STAT evictions 187149 STAT reclaimed 4867645 END
Now we reset Memcached server stats
stats reset RESET
The final result :
stats
STAT pid 16963 STAT uptime 13759736 STAT time 1288017537 STAT version 1.4.5 STAT pointer_size 64 STAT rusage_user 35327.040473 STAT rusage_system 83475.259831 STAT curr_connections 456 STAT total_connections 2 STAT connection_structures 708 STAT cmd_get 2117 STAT cmd_set 101 STAT cmd_flush 0 STAT get_hits 2018 STAT get_misses 99 STAT delete_misses 0 STAT delete_hits 0 STAT incr_misses 0 [...] STAT auth_errors 0 STAT bytes_read 154416 STAT bytes_written 689536 STAT limit_maxbytes 1610612736 [...] STAT conn_yields 0 STAT bytes 1019306738 STAT curr_items 1019534 STAT total_items 101 STAT evictions 0 STAT reclaimed 0
Be aware that using this function can hide you a lot of things, i find it only useful when we put a new version of cache management to reset all stats and start monitoring the new version without the stats history.
Other Memcached Resources
You can find a lot of Memcached resources on this Memcached resources page.