Couchbase bucket and LRU (least recently used)
I'm looking into using couchbase to replace memcached and mysql.
Currently we use memcached to cache volatile cache with a 0 expiry. The cache key rolls when a website is published and old cache is eventually ejected. Sessions are stored in MySQL for a constant time (say 8 hours) which updates the last modified on each access.
When trying out couchbase I would like to move both volatile cache and sessions into the couchbase bucket. When storing items with a 0 expiry in couchbase it seems like there is no LRU policy in effect. The memory quickly fulls up as expected, but items with a 0 expiry are then ejected to disk (as per documentation). Items ejected to disk then appear to never be evicted (removed completely). The disk space grows without bounds.
I can't seem to find any documentation anywhere about configuration for max disk size or expiry for the couchbase bucket. If someone has time could they point me to where I can configure couchbase to restrict the disk storage growing out of control? Is infinite cache storage supported in couchbase or should I set up a memcached bucket for that and only use the couchbase bucket for items with a fixed expiry time?
Thanks for any help,
- dave
Conventions I have found in documentation:
* Ejection ( Data is moved out of memory and onto disk, can be recovered from disk )
* Eviction ( Old cache item is deleted )
* LRU - Algorithm in memcached to remove older Least Recently Used cache items from the cache when the cache is full.
Testing Environment:
- 3 Virtual Machines, 256M bucket size, 5G disk (fulls up and then crashes)
Someone on the IRC channel helped me out with this, thank you ingenthr.
Couchebase has no LRU implementation. You can approximate it with long expiry times, but that can be problematic if you have a lot of cache which becomes invalid frequently. If you try to store items with 0 expiry they will live forever in a couchbase bucket.
The alternative which I am currently looking into is setting up Memcached buckets for volatile cache and relying on LRU for that. And a second set of Couchbase buckets for session storage where the lifetime is controlled and the reliability and fail-over support are very important.
Multiple moxi's might be required for this configuration? I'm still investigating this. Thank you for the help.
- dave