TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The 'Dogpile Effect' and how to avoid it with RoR memcache-client patch

5 pointsby tomhabout 17 years ago

1 comment

andrabout 17 years ago
What I'm doing in my homegrown framework to avoid/reduce memcache dogpiling is this (pseudocode):<p><pre><code> n = 1000; key = "myMemCacheEntry"; if (random(0,n) == 1 || (value = memcache_get(key)) == false) { value = compute_value(); memcache_put(key,value); } return value; </code></pre> Adjust <i>n</i> 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.