Does memcached do some kind of open hashing, so that multiple objects
could be stored for the same hash key? This should be so, otherwise
memcached would be returning incorrect data.

The hash only decides where to store the data. It does not use the hash to actual store anything.

My use case is as follows. I am inserting a large number of unique
keys into memcache. The server has sufficient memory to hold all the
keys. However, when I check the stats on the server, the number of
current items is less than the total number of keys inserted
( difference of 171 / ~5 million ). As far as I am aware, this could
mean two things;
1. there are hash collisions and the current items only display the
number of unique hashes stored.

Not possible.

2. The data that I inserted is not there anymore and has been evicted
( while inserting the timeout was 30 days, all the testing was done in
a matter of hours)

Possible. Are you storing lots of things the same size? Memcached uses slabs to allocate memory. Each slab stores objects of a given size. So, if you are storing lots of things the same size, they will get evicted from the server.

You could restart memcached then load it up then run something like:

$ echo stats | nc localhost 11211 | fgrep evictions
STAT evictions 143202

That would tell you how many evictions occurred.

Brian.

Reply via email to