SMP performance with hackbench

Jiang Wei jwhust@REDACTED
Wed Aug 19 05:19:01 CEST 2009

Hi, list
     I write hackbench in erlang to test the performance, which is
originally a benchmark for linux scheduler.
     (Hackbench contains several groups; each groups contains 20 pairs of
senders and receivers; each sender needs to send some messages to the 20
receivers in the same group. The performance is measured by the time taken,
less is better.)

     The tests are carried out on an Intel server with 2 quad-core
processors and 4G memory.
     I am surprised with results I got:
     (1) SMP enable +S 8
     root@REDACTED:~/hackbench# \time ./
     Time is 62.260995
     295.67user 110.62system 1:14.27elapsed 546%CPU (0avgtext+0avgdata
     11776inputs+8outputs (27major+90965minor)pagefaults 0swaps

      The performance is 62 sec and the oprofile shows 28% cpu time is using
in pthread_mutex_*.

      (2) SMP disable
      root@REDACTED:~/hackbench# \time ./ "-smp disable"
      Time is 54.14644
      54.23user 0.33system 1:05.66elapsed 83%CPU (0avgtext+0avgdata
      3968inputs+8outputs (22major+36520minor)pagefaults 0swaps

      The performance is 54 sec and using only 83% cpu.

      So it seems the erlang has problems with using all the smp resources
for serious lock contention in smp scheduler. Am I right?
      And because I am new to erlang, the hackbench.erl may be in bad
encoding, which will harm the performance. Can anyone help me review my

      I attach both the original C version of hackbench and my erlang
version one.

      Thanks a lot!
      (I am sorry If it is the wrong place to post this letter.)

Best Regards,
Jiang, Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hackbench_cmd.erl
Type: application/octet-stream
Size: 2709 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hackbench_old.c
Type: application/octet-stream
Size: 5492 bytes
Desc: not available
URL: <>

More information about the erlang-questions mailing list