[erlang-questions] Behaviour of queue

Robert Virding <>
Thu Sep 9 20:08:44 CEST 2010


On 9 September 2010 19:04, Jachym Holecek <> wrote:
> # Fredrik Andersson 2010-09-09:
>> I have a question concerning the behaviour of the erlang queue module.
>> Does it store everything in memory or will it fallback to storing
>> things on disk if memory is running short? If it does not I need to
>> implement a layer on top of queue that will fallback to store things
>> on disk if needed.
>
> It's implemented as a pair of lists, that is all data lives on heap
> of given process. Other option to implement a queue is to use ETS
> table, but that's in-memory too so not sure it helps. You could go
> with DETS table too, but I don't have first-hand experience with it.

What Jachym was implying but never really explicitly stated is that
the queue module is so simple that it is easier to completely rewrite
it with the storage mechanism of your choice rather than add another
layer on top of it. In this he is completely right.

Robert


More information about the erlang-questions mailing list