bigdata4u / spymemcached

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

Premature evicitions #230

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

We are currently using Spymemcached 2.7.3 (latest release) in our production 
environment.
We're using a separate serialization framework, Google Protocol Buffers, and 
then converting our objects into byte arrays.

We're using your MemcachedClient and calling the overloaded "set" method and 
passing our own implementation of a Transcoder. Our encode implementation of 
this interface uses the GPB byte array. Our encode implementation returns 
CachedData objects ( as specified by your interface ), and we're passing the 
GPB byte array to that object.

The issue is this: We're seeing that our objects are prematurely getting 
evicted from the cache, even though we've set the eviction time to be a day 
(equivalent in seconds). How we're debugging: as soon as we put the objects 
into the cache, we're telnetting into the memcached daemon and seeing that it's 
there. We're able to see that the object is there in the cache, but after a 
minute or so, it immediately gets evicted.

On the server side, we're seeing our cache hits to be @ 80% and our byte 
capacity to be @ 70% so there's no issue on the server side....Might you guys 
have an idea? A potential bug in the logic to handle custom transcoders? I've 
noticed that if we call the default set method without passing in any custom 
transcoder, I believe your client defaults to using normal Java/JDK 
serialization. And it's persisted in the cache for as long as it should be. 

Thanks,
Alex

Original issue reported on code.google.com by alexdoan...@gmail.com on 20 Jan 2012 at 2:37

GoogleCodeExporter commented 8 years ago
Forgot to also mention: In our custom Transcoder implementation, we have 
getMaxSize() to be Integer.MAX_VALUE. Also, when creating CachedData objects, 
we're passing Integer.MAX_VALUE.

We've also tried using your static instance field; CachedData.Max_Size ...

Neither case works.

Thanks,
Alex

Original comment by alexdoan...@gmail.com on 20 Jan 2012 at 2:42

GoogleCodeExporter commented 8 years ago
I believe the issue is with how memcached allocates memory. There are slab 
classes, and when you exhaust one, something in it will be evicted though other 
slab classes may not be full.  

You may need to do some slab tuning.  

Original comment by ingen...@gmail.com on 20 Jan 2012 at 2:48