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

Mark Geib mark.geib@REDACTED
Sat Jul 12 18:59:01 CEST 2008


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




More information about the erlang-questions mailing list