Hacker News new | ask | show | jobs
by snthpy 32 days ago
You'd think they'd randomise offsets to avoid a thundering herd effect, like anyone scheduling multiple processes does?
3 comments

To anyone herding a herd this is obvious. To people crafting animals less so.
A better solution might be to make the intervals coprime with 60. 59 or 61 seconds should work fine.

https://shoppress.dormanproducts.com/hunting-tooth-gearsets/

no, you hash your node ID or get a random number, and then just add offset. That guarantees on average uniform load, not synchronized-wave-pattern-that-happens-to-be-59.

You have to consider that when power goes down and everything goes back up at same time you get same pattern back, just spike every 59 seconds instead of 60.

Yeah I thought about that, but I just assumed it would be very unlikely that everything would be initialized at the same time. I suppose your scenario of power being lost simultaneously makes sense when that could happen.
Apparently not everyone does ;)