summaryrefslogtreecommitdiff
path: root/items.h
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2016-06-21 20:40:46 -0700
committerdormando <dormando@rydia.net>2016-06-24 00:45:38 -0700
commitae6f4267fede1db1739f6616b7b85b92f1300588 (patch)
tree645010af5ee3d05070256403f1064b62d048ba19 /items.h
parentd704f2c0b9b1d6f7a3ed12d65b6132668f45c887 (diff)
downloadmemcached-ae6f4267fede1db1739f6616b7b85b92f1300588.tar.gz
online hang-free "stats sizes" command.
"stats sizes" is one of the lack cache-hanging commands. With millions of items it can hang for many seconds. This commit changes the command to be dynamic. A histogram is tracked as items are linked and unlinked from the cache. The tracking is enabled or disabled at runtime via "stats sizes_enable" and "stats sizes_disable". This presently "works" but isn't accurate. Giving it some time to think over before switching to requiring that CAS be enabled. Otherwise the values could underflow if items are removed that existed before the sizes tracker is enabled. This attempts to work around it by using it->time, which gets updated on fetch, and is thus inaccurate.
Diffstat (limited to 'items.h')
-rw-r--r--items.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/items.h b/items.h
index 6d30aa2..1a310bd 100644
--- a/items.h
+++ b/items.h
@@ -22,6 +22,8 @@ void item_stats(ADD_STAT add_stats, void *c);
void item_stats_totals(ADD_STAT add_stats, void *c);
/*@null@*/
void item_stats_sizes(ADD_STAT add_stats, void *c);
+void item_stats_sizes_enable(ADD_STAT add_stats, void *c);
+void item_stats_sizes_disable(ADD_STAT add_stats, void *c);
item *do_item_get(const char *key, const size_t nkey, const uint32_t hv, conn *c);
item *do_item_touch(const char *key, const size_t nkey, uint32_t exptime, const uint32_t hv, conn *c);