Priority Queues

Chandrashekhar Mullaparthi <>
Mon May 16 15:49:03 CEST 2005


We've implemented such queues using mnesia ordered_set tables. But we 
limit queue size to about 100,000 entries. But there is no reason why 
you can't have a bigger queue. We had a single process handling each 
queue so (6) below wasn't a problem.

The only performance problem which you might encounter with very big 
queues is when the contents of the queue are changing very fast. Mnesia 
periodically dumps the entire table from RAM to disk and for large 
tables you will see that whenever mnesia does this, your queue 
processing will slow down.

cheers
Chandru

On 16 May 2005, at 07:24, Rudolph van Graan wrote:

> Hi All,
>
> I am currently thinking about the implementation of priority queues in 
> erlang. Specifically, what do you guys suggest as an efficient way to 
> achieve the following:
>
> 1. A queue with a definitive head and tail (i.e. first and last 
> records)
> 2. The items in the queue need to be sorted according to some criteria 
> that will always allow you to identify an entry as the "first" or 
> "next" one
> 3. The queue length can be massive (100's of thousands or millions of 
> records)
> 4. Insertion time should be constant
> 5. The queue must be persistent (i.e. mnesia or dets)
> 6. Once the first/head entry has been processed, it will no longer be 
> in the queue.
>
> Any suggestions?
>
> Rudolph van Graan
>




More information about the erlang-questions mailing list