Thundering herd problem
In computer science, the thundering herd problem occurs when a large number of processes or threads waiting for an event are awoken when that event occurs, but only one process is able to handle the event. When the processes wake up, they will each try to handle the event, but only one will win. All processes will compete for resources, possibly freezing the computer, until the herd is calmed down again.[1]
Mitigation
The Linux kernel serializes responses for requests to a single file descriptor, so only one thread or process is woken up.[2] For epoll() in version 4.5 of the Linux kernel, the EPOLLEXCLUSIVE flag was added. Thus several epoll sets (different threads or different processes) may wait on the same resource and only one set will be woken up. For certain workloads this flag can give significant processing time reduction.[3]
Similarly in Microsoft Windows, I/O completion ports can mitigate the thundering herd problem, as they can be configured such that only one of the threads waiting on the completion port is woken up when an event occurs.[4]
In systems that rely on a backoff mechanism (e.g. exponential backoff), the clients will retry failed calls by waiting a specific amount of time between consecutive retries. In order to avoid the thundering herd problem, jitter can be purposefully introduced in order to break the synchronization across the clients, thereby avoiding collisions. In this approach, randomness is added to the wait intervals between retries, so that clients are no longer synchronized.
See also
- Process management (computing)
- Lock convoy
- Sleeping barber problem
- TCP global synchronization
- Cache stampede
References
- ↑ "Thundering Herd Problem". http://www.catb.org/jargon/html/T/thundering-herd-problem.html. Retrieved 9 July 2019.
- ↑ "Does the Thundering Herd Problem exist on Linux anymore". https://stackoverflow.com/a/23002010/56280.
- ↑ Madars, Vitolins (2015-12-05). "EPOLLEXCLUSIVE Linux Kernel patch testing" (in en). https://mvitolin.wordpress.com/2015/12/05/endurox-testing-epollexclusive-flag/.
- ↑ "IO Completion Ports — Matt Godbolt's blog". https://xania.org/200807/iocp.
External links
Original source: https://en.wikipedia.org/wiki/Thundering herd problem.
Read more |