From 59f920075f2efa7bb2c015d7da2a706413c68383 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Fri, 27 Sep 2024 14:54:28 +0200 Subject: reduce lock time for memcache trim (#171) - Improvement: Faster memcache trimming - Reduce calculations while holding bucket lock for memcache trim analysis to reduce contention - When trimming memcache, evict 25% more than required to reduce frequency of trimming - When trimming memcache, don't repack memcache data vector, defer that to regular garbage collection - When trimming memcache, deallocate memcache buffers when not holding exclusive lock in bucket --- src/zenstore/include/zenstore/cache/cachedisklayer.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/zenstore/include') diff --git a/src/zenstore/include/zenstore/cache/cachedisklayer.h b/src/zenstore/include/zenstore/cache/cachedisklayer.h index 8e31d3222..6d85e8039 100644 --- a/src/zenstore/include/zenstore/cache/cachedisklayer.h +++ b/src/zenstore/include/zenstore/cache/cachedisklayer.h @@ -420,7 +420,7 @@ public: } static inline uint64_t EstimateMemCachePayloadMemory(uint64_t PayloadSize) { - return sizeof(MemCacheData) + sizeof(IoBufferCore) + RoundUp(PayloadSize, 8u); + return sizeof(IoBufferCore) + RoundUp(PayloadSize, 8u); } // These locks are here to avoid contention on file creation, therefore it's sufficient @@ -464,10 +464,11 @@ private: return; } - MemCacheTrim(); + StartAsyncMemCacheTrim(); } - void MemCacheTrim(); uint64_t MemCacheTrim(std::vector& Buckets, GcClock::TimePoint ExpireTime); + bool StartAsyncMemCacheTrim(); + void MemCacheTrim(); GcManager& m_Gc; JobQueue& m_JobQueue; -- cgit v1.2.3