[erlang-questions] gen_tcp:send() very expensive

Rapsey rapsey@REDACTED
Sat Jul 12 19:30:18 CEST 2008


There has been a discussion on this very topic a while ago. You should check
the archives.
My only solution to this problem was to cut down on the number of
gen_tcp:send calls. Buffer the data for a bit and then send it all at once.


Sergej


On Sat, Jul 12, 2008 at 6:59 PM, Mark Geib <mark.geib@REDACTED> wrote:

> I am new to erlang and writing a program to replace an existing Java
> program that accepts multiple network tcp connections, upto about 400,
> and then also excepts 'receive' connections from clients, again in the
> hundrends.. The Java code then re-distributes all the messages from all
> the 'source' connections to all the connected clients.
>
> The Java program is running at about 35% of the machines cpu. When I
> tried my first cut of replacing this with erlang I was surprised to find
> that the erlang program rapidly consumed the machine and quickly stopped
> functioning...
>
> SO, I have been investigating and find that the erlang message passing
> is VERY efficient, but the actual sending of the message to all the
> connected clients is a HUGE cpu consumer. In my test case I am
> generating about 2000 message / second and without sending the tcp
> messages uses about 10% of the test machine. With one client connecting
> the cpu usage increases to nearly 100%.
>
> Is this expected, or is there an option I need to set improve efficiency
> of the network writing. The message sizes vary from 2 - 2000 bytes.
>
> Sorry for the long post.
>
> Mark.
> --
> Principal Engineer
> Cheyenne Software Engineering
> mark.geib@REDACTED / 35-215
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080712/50f5f52c/attachment.htm>


More information about the erlang-questions mailing list