0

I encountered a weird question today .I found have three items in a slab by run command "stats items" , but when i run command "stats cachedump 1 0" for view item infomation this slab , only show two items , this slab number is 1.

The output of the command "stats items" :

stats items
STAT items:1:number 3
STAT items:1:number_hot 0
STAT items:1:number_warm 1
STAT items:1:number_cold 2
STAT items:1:age_hot 0
STAT items:1:age_warm 5171
STAT items:1:age 5409
STAT items:1:evicted 0
STAT items:1:evicted_nonzero 0
STAT items:1:evicted_time 0
STAT items:1:outofmemory 0
STAT items:1:tailrepairs 0
STAT items:1:reclaimed 0
STAT items:1:expired_unfetched 0
STAT items:1:evicted_unfetched 0
STAT items:1:evicted_active 0
STAT items:1:crawler_reclaimed 0
STAT items:1:crawler_items_checked 38
STAT items:1:lrutail_reflocked 2
STAT items:1:moves_to_cold 7
STAT items:1:moves_to_warm 3
STAT items:1:moves_within_lru 1
STAT items:1:direct_reclaims 0
STAT items:1:hits_to_hot 0
STAT items:1:hits_to_warm 1
STAT items:1:hits_to_cold 6
STAT items:1:hits_to_temp 0
END

The field "number" value is 3 ; there are three items in slab1.

The output of the command "stats cachedump" :

stats cachedump 1 0
ITEM foo [3 b; 0 s]
ITEM mykey [12 b; 0 s]
END

Show two items, and their key are foo and mykey .

My memcached server version : memcached-1.5.3

Why is this ? Shout not it is show three items?

Shaun
  • 480
  • 7
  • 18
  • It looks like one of the items has expired. Do you get the same results if you perform `stats items` again (after `stats cachedump 1 0` command)? – Igor Dec 02 '17 at 22:30
  • @lgor, yes , i get the same result , while to run `stats cachedump 1 0 `command – Shaun Dec 04 '17 at 04:49
  • This makes sense only in case your 3rd item has expired. The `STAT items:1:number 3` result you're seeing might be due to Memcached lazy expiration. Only until a search for items is performed, it can know that it's expired. You can check the official [Mecached wiki](https://github.com/memcached/memcached/wiki/ProgrammingFAQ#why-isnt-curr_items-decreasing-when-items-expire) explaining more about how expiration works. – Igor Dec 04 '17 at 19:54

1 Answers1

2

I guess that it returns COLD items only

This command works for me lru_crawler metadump $slabid

  • the `-o lru_crawler` option is sadly NOT enabled by default (as of 1.5.20 and not included in `-o modern` either) - thus has to be enabled explicitly: https://github.com/memcached/memcached/wiki/ReleaseNotes1431 – Vlad Dec 19 '22 at 16:39