Thundering herd problem: Preventing the stampede
distributed-computing-musings.com
Thundering herd problem: Preventing the stampede
1–10 of 21 posts
Re: Thundering herd problem: Preventing the stampede
#2OrbitCache is one example, described in this paper: https://www.usenix.org/system/files/nsdi25-kim.pdf
It should solve the thundering herd problem, because the switch would "know" what outstanding cache misses it has pending, and the switch would park subsequent requests for the same key in switch memory until the reply comes back from the backend server. This has an advantage compared to a multi-threaded CPU-based cache, because it avoids performance overheads associated with multiple threads having to synchronize with each other to realize they are about to start a stampede.
A summary of OrbitCache will be published to my blog tomorrow. Here is a "draft link": https://danglingpointers.substack.com/p/4967f39c-7d6b-4486-a...
Re: Thundering herd problem: Preventing the stampede
#3It also doesn't mentionn the most obvious solution to this problem: adding a random factor to retry timing during backoff, since a major cause of it is everyone coming back at the precise instant a service becomes available again, only to knock it offline.
Re: Thundering herd problem: Preventing the stampede
#4I would think that in the rare instance of multiple concurrent requests for the same key where none of the caches have it cached, it might just be worth it to take the slightly increased hit (if any) of going to the db instead of complicated it further and slowing down everyone else with the same mechanism.
Re: Thundering herd problem: Preventing the stampede
#5This query will probably find loads already: https://github.com/search?q=language%3Atypescript+%22new+Map...
Re: Thundering herd problem: Preventing the stampede
#6If you can, it's easier to have every client fetch from cache, and then a cron job e.g., every second, refresh the cache.
In CDN feature to prevent this is "Collapse Forwarding"
Re: Thundering herd problem: Preventing the stampede
#7This reads like LLM noise, with headings missing articles. It also doesn't mentionn the most obvious solution to this problem: adding a random factor to retry timing during backoff, since a major cause of it is everyone coming back at the precise instant a service becomes available again, only to knock it offline.
Re: Thundering herd problem: Preventing the stampede
#8To make matters worse, due to the budget for this lab, we had just three servers that the testing computers could download from. In the worst case the horrible snarl-up would cause computers to wait for as much as two hours before they got the materials needed to run the tests.
My solution was to use peer-to-peer BitTorrent (no Trackers involved), with HTTP seeding. So the BitTorrent files had no trackers listed, but the three servers listed as HTTP seeds, and the clients were all started with local peer discovery. So the first couple of computers to get the job would pull most/all of the file contents from our servers, and then the rest of the computers would wind up getting the file chunks mostly from their peers.
I did need to do some work so that the clients would first try a URL on the servers that would check for the .torrent file, and if it did not exist, build it (sending the clients a 503 code, causing them to wait a minute or two before retrying).
There are lots of things I would do differently if I rebuilt the system (write my own peer-to-peer code), but the result meant that we rarely had systems waiting more than a few minutes to get full files. It took the thundering heard and made it its own solution.
Re: Thundering herd problem: Preventing the stampede
#9Some recent academic work suggests implementing caches directly in network switches. Tofino switches are programmable enough that academics can implement this today. OrbitCache is one example, described in this paper: https://www.usenix.org/system/files/nsdi25-kim.pdf It should solve the thundering herd problem, because the switch would "know" what outstanding cache misses it has pending, and the switch would park su…
Re: Thundering herd problem: Preventing the stampede
#10Some years back, at a previous employer I had a related thundering herd problem: I was running an automated testing lab, and if a new job came in after a period of idleness, then we would have 100+ computers all downloading 3 (or more) multi gigabyte files at the same time (software-under-test, symbols files, and compiled tests). To make matters worse, due to the budget for this lab, we had just three servers that th…