[erlang-questions] Performance with large queues

Bernard Duggan <>
Sat Mar 20 03:10:50 CET 2010

Paul Joseph Davis wrote:

> Gen_servers do alot of selective recieves to the point that someone
> wrote an optimized version called gen_server2.

You're quite right.  Looking at the gen_server code, however, the main
loop does a non-selective receive and it's only "special" cases that do
a selective one.  Even though they're probably happening from time to
time, my suspicion is that it's the regular mnesia operations which are
really doing the damage.

Thanks for the tip about gen_server2 - I'll definitely be taking a look
at that.

> That said you might also want to do some light measuring of your mnesia
> transaction times just in case. The first thing that popped into my head
> was message reception as well, but it might not hurt to check.

The logs and profiling I did certainly pointed to the commit at the end
of the transaction being where the big cost is, both in normal operation
and in the bad case described.



More information about the erlang-questions mailing list