[erlang-questions] beginner: Message Passing Overhead in Erlang

michael.truog@REDACTED michael.truog@REDACTED
Tue Feb 17 00:39:42 CET 2009

Are you sure that MPI was using the TCP layer over the same interconnect?  Otherwise it could be using a custom driver and/or hardware to provide faster messaging.  If it is the same interconnect and path through TCP, then wouldn't the delay be due to the VM scheduling?

Kilim might also require investigation on the Java side of things (since they claim to be faster than Erlang):

From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of ext KangMikyung
Sent: Friday, February 13, 2009 12:34 PM
To: erlang-questions@REDACTED
Subject: [erlang-questions] beginner: Message Passing Overhead in Erlang

Dear All,

When I tested pingpong test, Erlang takes long time even though the data size is 0/1/2/4/8 bytes.
MPI takes around 0.0025 microseconds/iteration when the data size 0/1/2/4/8 bytes.
However Erlang takes around 0.5 microseconds/iteration at least. (within one core)

I tried to find the underlying reasons that there is higher overhead involved in message passing in Erlang when compared to MPI,
but I couldn't find it yet at "The erlang-questions Archives".

How can we explain the situation that Erlang takes long time even though the data size is very small (e.g. 0 or 1)?
Why the communication overhead is very big? When the data size is 16KB, Erlang was slower than MPI at least thousands time.
Where can I find the explanation?

Also I tested two pingpong case: (1) with data('a') and (2) without data.
(1) takes 0.336 us, but (2) takes 0.0000000059 us. It's very different.
Can we tell initial data related setup takes long time?




ping(0, _, _) ->

ping(R, D, Pong) ->
    Pong ! {self(), D},
        {Pong, D} ->
    ping(R - 1! , D, Pong)

pong() ->
        {From, D} ->
            From ! {self(), D},

run() ->
    R = 1000,
    D = 'a', %D = "abcdefghij",
    Pong = spawn(fun()-> pong() end),
  TimeStart = imb:time_microseconds(),
    ping(R, D, Pong),
  TimeEnd = imb:time_microseconds(),
  io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]).

-export([start/0, ping/2, pong/0]).


ping(0, Pong_PID) ->
    Pong_PID ! finished;

ping(N, Pong_PID) ->
    Pong_PID ! {ping, self()},
        pong ->
        ping(N - 1, Pong_PID)

pong() ->
        {ping, Ping_PID} ->
            Ping_PID ! pong,

start() ->
  TimeStart = imb:time_microseconds(),
    Pong_PID = spawn(tut15, pong, []),
    spawn(tut15, ping, [1000, Pong_PID]),
  TimeEnd = imb:time_microseconds(),
  io:format("Time in microseconds: ~p~n", [TimeEnd - TimeStart]).


time_microseconds() ->
    {MS, S, US} = now(),
    (MS * 1.0e+12) + (S * 1.0e+6) + US.

강력해진 보안성, 아웃룩을 닮아 편리해진 기능들로 무장한 Windows Live Hotmail! 뜨거운 메일 핫메일, Windows Live Hotmail로 돌아오다!<http://www.hotmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090217/70ff3398/attachment.htm>

More information about the erlang-questions mailing list