4 ms·
The 'Dogpile Effect' and how to avoid it with RoR memcache-client patch
- andr 19y agoWhat I'm doing in my homegrown framework to avoid/reduce memcache dogpiling is this (pseudocode): n = 1000; key = "myMemCacheEntry"; if (random(0,n) == 1 || (value = memcache_get(key)) == false) { value = compute_value(); memcache_put(key,value); } return value; Adjust n according to your current peak traffic. When traffic is low, the algorithm won't always catch on, but the dogpiling won't be as severe.