Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The 'Dogpile Effect' and how to avoid it with RoR memcache-client patch (kovyrin.net)
5 points by tomh on March 11, 2008 | hide | past | favorite | 1 comment


What 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: