[erlang-questions] Message passing in Erlang is very slow with the -smp option.

Rickard Green rickard.s.green@REDACTED
Fri Sep 28 12:49:26 CEST 2007


We constantly work on improving the smp emulator. In the coming R12B
release we have optimized the emulator internal process locking which
has effect on this benchmark.

I ran your benchmark on a machine similar to yours and got a time 6.7
times longer for the R11B-5 emulator with smp support compared to the
emulator without smp support. With the, to be, R12B release I got a
time 4.4 times longer.

This might still seem as a large difference, but if you increase the
size of the message being passed the difference between the smp and
non-smp emulator shrinks (you very seldom pass single atoms as messages
in real applications).

Also note that you cannot blame message passing for the whole
difference, scheduling is more expensive in smp emulator as well and
this benchmark is quite scheduling intensive.

A ring benchmark isn't especially nice to the smp emulator since nothing
will be able to execute in parallel, but it is of course non the less
interesting to see the cost for locking, etc.

BR,
Rickard Green, Erlang/OTP, Ericsson AB.

Mikage Sawatari wrote:
> Sorry for omitting my environment:
> 
> SUSE Linux Enterprise Server 10 SP1 (x86_64)
> Kernel: 2.6.16.46-0.14-smp
> CPU: Intel(R) Xeon(R) CPU E5335 @ 2.00GHz x 2 sockets (total 8 cores)
> Memory: 8GB
> Erlang: R11B-5 (version 5.5.5)
> 
> On 9/28/07, Mikage Sawatari <mikage@REDACTED> wrote:
>> I found message passing becomes very slow when the -smp option is in
>> effect. I did a benchmark by passing messages circularly around several
>> processes. The performance became about 1/7 with the -smp option.
>>
>> Is there any workaround for this? Or will this be improved in the future
>> of Erlang?
>>
>>>> erl -noshell -eval 'ring_bench:start(1000,10000), halt().'
>>>>
>>> N = 1000, M = 10000; elapsed time = 1470 (1494) miliseconds
>>>
>>>
>>>> erl -smp -noshell -eval 'ring_bench:start(1000,10000), halt().'
>>>>
>>> N = 1000, M = 10000; elapsed time = 9810 (9826) miliseconds
>>>
>> The program I used can be found in the following blog:
>>
>>> http://d.hatena.ne.jp/sumim/20070513/p1 (Japanese)
>>>
> 






More information about the erlang-questions mailing list