You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now there's no mechanism for eviction, that is mandatory for caching services. Adding LRU is not an easy job since it depends on some kind of internal extensions for memory allocations or new data structures.
Ways to handle:
Capped collections - MongoDB citation "fixed-size collections that support high throughput operations that insert and retrieve documents based on insertion order. Capped collections work in a way similar to circular buffers: once a collection fills its allocated space, it makes room for new documents by overwriting the oldest documents in the collection."
Some kind of external LRU implementation with changes on every get - heavy solution (simpler - some mutable fields in tuple and change this field on every access)
per slab-level LRU, 100% chance that deletion will provide you new tuple
Also, compaction of memory is needed (triggered or automatic)
The text was updated successfully, but these errors were encountered:
I'm trying to test eviction feature of ordinary memcached. For that purpose I created tarantool instance with memcached interface with small amount of memory available (~ 2mb or less) and started this small perl script to constantly set a key and get it back to check if it was written correctly:
use strict;
use warnings;
use Test::More 'no_plan';
use Cache::Memcached::Fast;
my$memd = new Cache::Memcached::Fast({
servers=> [ "host:port" ],
nowait=> 0,
hash_namespace=> 0,
utf8=> ($^V ge v5.8.1 ? 1 : 0),
});
formy$i (8 .. 100_000) {
my$ttl = 5*60;
my$store_key = "ttladdmanythiskey$i";
my$store_value = "ttladdmanythisvalue$i";
is( $memd->get($store_key), undef, "Get not existent value for iteration $i" );
ok( $memd->set($store_key, $store_value, $ttl), "Set with ttl ok for iteration $i" );
is( $memd->get($store_key), $store_value, "Cmp value for iteration $i" );
}
I expect that set will be OK always, regardless of how much space is already used and whether or not the same key was already set (so set() is always ok). But a get errors for set() on ~ 100th (well, randomly, btw) iteration of the loop.
The same error is repoduced when ->add is used instead of ->set.
Also I used tcpdump to see tarantool responses. Some of them were:
Right now there's no mechanism for eviction, that is mandatory for caching services. Adding LRU is not an easy job since it depends on some kind of internal extensions for memory allocations or new data structures.
Ways to handle:
Also, compaction of memory is needed (triggered or automatic)
The text was updated successfully, but these errors were encountered: