Eviction Policies?
Hi there,
We are looking to use Membase/Memcached to replace our Jboss Cache as we are having constant issues with it. One thing that Jboss cache has that I cannot find documented anywhere in Membase/Memcached is eviction policies. In our jboss cache we have two different "buckets" configured...one that if a node is idle for X minutes, it is automatically removed...the other is if a node is older than X minutes it gets removed automatically. Does Membase/Memcached have this and if not how are people accomplishing this? Our goal is to prevent stale data in the cache.
--Ben
I do not pretend to know the inner workings of Membase....I am sure they are very complex...but from a user standpoint may I make a suggestion on how I would implement the idle cache.
Membase already has the max age cache, where any object placed into the cache will stay there for X seconds. This is very good to help prevent data from getting stale, but great for performance. Theoretically only one user will take the database hit, or you could have background jobs refresh the data before it gets stale.
What Membase needs is an idle cache that refreshes the timer when a node is used. What I would recommend is have this be an option at the bucket level. Every node will have X seconds of idle time before they are removed, and if they are used, Membase uses the value from the bucket. This will prevent having to keep the original expiration seconds and the current. This would prevent the get and put to keep the timer refreshed.
Thanks,
--Ben
Thanks for the feedback Ben, I'll pass that around internally.
What we are currently planning on doing is implementing a "touch" command so that the application can decide which items it wants to extend the TTL on and which ones it doesn't...more to come on that hopefully soon.
Perry
Out of curiosity, why do you want to remove stale data out of an LRU cache? it seems like when the cache gets full it will just clear out the old data, in the mean time, what's the harm in having it in there?
In this case I am putting data into the cache that is "like"... meaning multiple nodes that have a similar grouping. As long as the variables are used I want it to stay in the cache. When they are not being used for say an hour, they can flush out. Think session timeouts on an enterprise system.
The idle cache is very complex indeed. I have troubles figuring it out.
Hey Ben, Membase supports expiration in the same way that memcached does. When you 'set' an item, you can define how long it should live in the database/cache. Unfortunately we don't have the ability yet to expire based on idle time, but that's a feature we're actively looking into.
Let me know if that helps or if there's any more information I can provide.
Perry
Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!