how to monitor number of "add" commands on memcached

cn flag

so memcached provides a lot of stats to track usage (hits and misses).

sample output -

STAT pid 1
STAT uptime 982226
STAT time 1630949306
STAT version 1.6.6
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 18.366158
STAT rusage_system 19.678998
STAT max_connections 65000
STAT curr_connections 7
STAT total_connections 3953
STAT connection_structures 17
STAT response_obj_bytes 2480
STAT response_obj_total 2
STAT response_obj_free 1
STAT response_obj_oom 0
STAT read_buf_bytes 32768
STAT read_buf_bytes_free 16384
STAT read_buf_oom 0
STAT reserved_fds 10
STAT cmd_get 8
STAT cmd_set 3980
STAT cmd_flush 0
STAT cmd_touch 0
STAT cmd_config_get 65475
STAT cmd_config_set 1
STAT cmd_meta 0
STAT get_hits 0
STAT get_misses 8
STAT get_expired 0
STAT get_flushed 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT touch_hits 0
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 4273871
STAT bytes_written 94622147
STAT limit_maxbytes 13932429312
STAT launch_time_maxbytes 13932429312
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT time_in_listen_disabled_us 0
STAT threads 2
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT curr_config 1
STAT malloc_fails 0
STAT log_worker_dropped 0
STAT log_worker_written 0
STAT log_watcher_skipped 0
STAT log_watcher_sent 0
STAT bytes 9202
STAT curr_items 50
STAT total_items 3939
STAT slab_global_page_pool 0
STAT expired_unfetched 3889
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 3889
STAT crawler_reclaimed 0
STAT crawler_items_checked 0
STAT lrutail_reflocked 0

stats around get, delete, incr, delete are present in this list. However, my application has extensive use of add and that does not have any specific metric to show for itself when it fails to update.

How can I check how many were actually added and how many were not added?

Note that I can do this from the app - by logging, etc. but am looking for a way to get this from the monitoring metrics for memcached.

Is this even possible?

Michael Hampton avatar
cz flag
Huh? It's right there `STAT cmd_set 3980`
cn flag
so that counts the sets, does that also include the adds? Also how do I check the ones that failed to be added, i.e., when add returned False?
Michael Hampton avatar
cz flag
Add is the same as set, only it fails if the key exists. Those failures are not counted, AFAIK.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.