summaryrefslogtreecommitdiff
path: root/storage.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-12-03 17:27:49 -0800
committerdormando <dormando@rydia.net>2017-12-03 17:27:49 -0800
commit8421b6c7a3e98739b157cede572e1eaf93af0299 (patch)
tree7536126108695f31ff5502f56a5164ac44b3a39a /storage.c
parent22d6e2bdeff9d7ba83fba840508d031fbf70f01a (diff)
downloadmemcached-8421b6c7a3e98739b157cede572e1eaf93af0299.tar.gz
extstore: experimental per-class free chunk limit
external comands only for the moment. allows specifying per-slab-class how many chunks to leave free before causing flushing to storage. the external page mover algo in previous commits has a few issues: - relies too heavily on page mover. lots of constant activity under load. - adjusting the item age level on the fly is too laggy, and can easily over-frefree or under-free. IE; class 3 has TTL 90, but class 4 has TTL 60 and most of the pages in memory, it won't free much until it lowers to 60. Thinking this would be something like; % of total chunks in slab class. easiest to set as a percentage of total memory or by write rate periodically. from there TTL can be balanced almost as in the original algorithm; keep a small global page pool for small items to allocate memory from, and pull pages from or balance between storage-capable classes to align TTL.
Diffstat (limited to 'storage.c')
-rw-r--r--storage.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/storage.c b/storage.c
index dfb2025..1d4e41b 100644
--- a/storage.c
+++ b/storage.c
@@ -18,15 +18,14 @@ int lru_maintainer_store(void *storage, const int clsid) {
int item_age = settings.ext_item_age;
bool mem_limit_reached = false;
unsigned int chunks_free;
- unsigned int chunks_perslab;
struct lru_pull_tail_return it_info;
// FIXME: need to directly ask the slabber how big a class is
if (slabs_clsid(settings.ext_item_size) > clsid)
return 0;
chunks_free = slabs_available_chunks(clsid, &mem_limit_reached,
- NULL, &chunks_perslab);
+ NULL, NULL);
// if we are low on chunks and no spare, push out early.
- if (chunks_free < chunks_perslab && mem_limit_reached)
+ if (chunks_free < settings.ext_free_memchunks[clsid] && mem_limit_reached)
item_age = 0;
it_info.it = NULL;