Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

"stats items" does not return correct "age" value #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Add hundreds of unique entries with long expiration (10 days)
2. Keep updating some of the existing entries and add some more over next
couple of days.
3. Check the age with "stats items"

What is the expected output? What do you see instead?

Expecting "age" to be that of the first item inserted.
I see that the age is of one of the more recent new or updated entries.

What version of the product are you using? On what operating system?
memcached - 1.4.4 
Linux - 2.6.18-128.7.1.el5xen, centos 5.2

Thanks.

Sanjeev

Please provide any additional information below.

Our older version 1.2.6 seems to be working fine.

Original issue reported on code.google.com by sanjeeva...@gmail.com on 29 May 2010 at 12:13

GoogleCodeExporter commented 9 years ago
This issue is happening in memcached 1.4.5 also however it seems like Max_Age 
simply stops counting up altogether.

What version of the product are you using? On what operating system?
memcached - 1.4.5
Linux - 2.6.18-53.el5, centos 5.2
libevent 1.4

Please provide any additional information below.

Here I check the stats, sleep 5 seconds then check the stats again.  Notice the 
item count goes up but the age does not go up or down.

 ./scripts/memcached-tool memcache2:11211 > /tmp/stats.old;sleep 5; ./scripts/memcached-tool memcache2:11211 > /tmp/stats.new; diff /tmp/stats.old /tmp/stats.new
7,10c7,10
<   6     304B        11s      15   50998      no        0        0    0
<   7     384B        16s       2    4158      no        0        0    0
<   8     480B         2s      31   66902      no        0        0    0
<   9     600B        28s       5    7363      no        0        0    0
---
>   6     304B        11s      15   50999      no        0        0    0
>   7     384B        16s       2    4155      no        0        0    0
>   8     480B         2s      31   66912      no        0        0    0
>   9     600B        28s       5    7365      no        0        0    0
15,17c15,17
<  14     1.8K         2s       5    2669      no        0        0    0
<  15     2.3K        26s       8    3338      no        0        0    0
<  16     2.8K        19s       8    2706      no        0        0    0
---
>  14     1.8K         2s       5    2670      no        0        0    0
>  15     2.3K        26s       8    3339      no        0        0    0
>  16     2.8K        19s       8    2708      no        0        0    0
22c22
<  21     8.7K         4s      23    2657      no        0        0    0
---
>  21     8.7K         4s      23    2658      no        0        0    0
24c24
<  23    13.6K         3s      83    6155      no        0        0    0
---
>  23    13.6K         3s      83    6156      no        0        0    0
29c29
<  28    41.4K        51s      37     882      no        0        0    0
---
>  28    41.4K        51s      37     883      no        0        0    0

Original comment by brandon....@gmail.com on 16 Jun 2010 at 11:06

GoogleCodeExporter commented 9 years ago
Is it possible to get a fix for this soon? It used to work in the old version 
(1.2.6)

Thanks.

Sanjeev

Original comment by sanjeeva...@gmail.com on 22 Oct 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Is it possible to get a fix for this soon? It used to work in the old version 
(1.2.6)

Thanks.

Sanjeev

Original comment by sanjeeva...@gmail.com on 22 Oct 2010 at 6:28

GoogleCodeExporter commented 9 years ago
Is it possible to get a fix for this soon? It used to work in the old version 
(1.2.6)

Thanks.

Sanjeev

Original comment by sanjeeva...@gmail.com on 22 Oct 2010 at 6:44

GoogleCodeExporter commented 9 years ago
The problem is that the stats items don't check if the oldest entry is expired 
or not. 

Original comment by trond.no...@gmail.com on 11 Nov 2010 at 1:56

GoogleCodeExporter commented 9 years ago
maybe it not be fixed yet  
I clone the git version from  https://github.com/memcached/memcached.git
and make a test

telnet localhost 11211
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
set b 2 86400 1
b
STORED
get a
VALUE a 1 1
a
END
get b
VALUE b 2 1
b
END
stats items
STAT items:1:number 2
STAT items:1:age 548
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
END
stats items
STAT items:1:number 2
STAT items:1:age 548
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
END
stats items
STAT items:1:number 2
STAT items:1:age 548
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
END
stats items
STAT items:1:number 2
STAT items:1:age 548
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
END

Original comment by zhangjia...@gmail.com on 2 Jan 2011 at 7:55

GoogleCodeExporter commented 9 years ago
From your test the item "a" would be in the tail of that LRU. what is the 
expiry time for that object?

Please note that memcached does everything lazily, and will not look at other 
objects than the object in the tail. There might be objects that are expired 
somewhere in the cache, but they are not inspected until they hit the tail in 
the LRU or someone tries to fetch them.

Original comment by trond.no...@gmail.com on 2 Jan 2011 at 10:08