[erlang-questions] Any Erlang “hierarchical timing wheel” library?

Roger Lipscombe roger@REDACTED
Tue Dec 18 20:21:27 CET 2018


This isn't particularly applicable, because you're looking for an
implementation in Erlang, rather than an implementation *in* Erlang, but if
you're interested, there's a timer wheel implementation in
erts/emulator/beam/time.c. It's not directly usable as a timer wheel from
Erlang (or from a NIF, which is where my interest originated).

For comparison, libcurl appears to use a splay tree for its timers -- or
did, the last time I looked.

On Tue, 18 Dec 2018 at 15:01, Frank Muller <frank.muller.erl@REDACTED>
wrote:

> Hi Vans
>
> I always ask first before re-implementing the wheel. The link is very good
> (did my home work and read almost all papers on the subject before asking).
>
> @Vans: thanks for implementation hints.
> What do you suggest for persistency? Is mnesia capable of handling
> millions terms?
>
> Best
> /Frank
>
> Why dont you write your own, since this is a special use case anyways that
>> has a ton of implementations, there is no way youl find an implemenation
>> that will fully satisfy you. Its quite simple too, Hashed and
>> Hierarchical Timing Wheels
>> <https://paulcavallaro.com/blog/hashed-and-hierarchical-timing-wheels/>,
>> scheme #2 here will be VERY performant on erlang.  an ordered_set mnesia
>> table, using dirty_next to get the first element each 1-10ms to check if a
>> timer is ready to pop. Then spawn a new process and pass the event for
>> handling to it.
>>
>> Hashed and Hierarchical Timing Wheels
>>
>> Hashed and Hierarchical Timing Wheels: Data Structures for the Efficient
>> Implementation of a Timing Facility
>> <https://paulcavallaro.com/blog/hashed-and-hierarchical-timing-wheels/>
>>
>>
>>
>> On Tuesday, December 18, 2018, 1:22:44 a.m. EST, Torben Hoffmann <
>> torben.lehoff@REDACTED> wrote:
>>
>>
>> This is the nearest I can think of:
>> https://github.com/fra/ecron/blob/master/README.md
>>
>> Cheers,
>> Torben
>> On Tue, 18 Dec 2018 at 06:17, Frank Muller <frank.muller.erl@REDACTED>
>> wrote:
>>
>> Really, no library out there?
>>
>> /Frank
>>
>> Hi there
>>
>> I am looking for any Erlang implementation of a “hierarchical timing
>> wheel” with disk persistency (if possible)?
>>
>> I need to handle a very large number of timers (around 10 million events)
>> in my app. Each timer will trigger an associated MFA event.
>>
>> I’ve one special case: some events can be triggered after a long period
>> of time (ex. 2 years). The rest of the timers can be considered short (in
>> minutes, hours or days at max). That’s why “hierarchical timing wheel”
>> can solve this special case.
>>
>> Any help/idea/link appreciated.
>>
>> Thank you
>> /Frank
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>> --
>> https://www.linkedin.com/in/torbenhoffmann/
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181218/8e93698e/attachment.htm>


More information about the erlang-questions mailing list