Ratas – A hierarchical timer wheel
snellman.net
snellman.net
rat ("t" pronounced as dental) means wheel
This is perhaps coming from a very different direction than the kernel use case. There it's totally plausible to have no events expiring for a long time (like the next second), and there is real value in going completely idle for a long period (lower power use).
But there are application areas where this just isn't the case. For example applications doing poll mode network IO can't possibly afford to go idle for a second. Even a millisecond would be stretching it. There's just no value in being slightly faster at knowing whether the next expiring timer is in 100ms or 110ms. The application will be waking up far earlier than that no matter what.
To put numbers on it: my thinking is that if a timer tick is e.g. 20us (so 50 ticks per ms) and there are no events expiring in the next 10 ticks, the system load must be so low that it might as well be completely idle.
Now i wonder if you save a lot with having to promote all these entries from the outer wheel(s) to inner wheel, one option is to pick a large enough wheel size (so that the wheel would cover most typical timeouts) and just allow collisions in the timer buckets if a timeout requires more slots than the maximum size of the wheel (just would require you to do more checks when there are collisions).
Another problem is that one has to do a lot more work when you do a full revolution of the inner wheel (due to promotions within between the outer wheels); so that each tick does take a uniform amount of time.
Another point is that these linked lists + indirections are not very cache friendly; one could try to use some sort of unrolled list (however this will eat up more memory).