TCP stack throughput

Marc Feeley <>
Tue Jul 5 17:10:29 CEST 2005


On 5-Jul-05, at 9:58 AM, Joel Reymont wrote:

> Jani,
>
> It does not explain why I was able to get with the C server 3x the  
> connections of an Erlang server. All on the same platform! I think  
> this is the key point!
>
>     Thanks, Joel
>

For kicks I rewrote the C version of the server (i.e. server.c) in  
Scheme,
but with threads (so that each request is handled in its own thread),
and compiled it with Gambit-C 4.0 beta 14.  The client sends 1000  
concurrent
requests to the server.  The results attached below show that the Scheme
version achieves almost the same speed as C (less than 10% difference of
real time) and that no ECONNREFUSED errors were generated.

I suspect that Erlang's scheduler is starving the main process (which  
accepts
the connections).  Gambit's scheduler uses a "priority-boost" to give a
slight priority to processes whose I/O has just become possible.   
Perhaps
something like this would help improve Erlang's performance and avoid  
the
ECONNREFUSED errors.

Marc

; Platform: 400 MHz PowerBook G4, 384 MB RAM
;
; Program is a client opening 1000 concurrent connections to the server
; which reads a 10 octet request and replies with a 256 octet response.
; The client and server are running on the same machine.
;
; Server written in C:
;
; real    0m1.271s
; user    0m0.277s
; sys     0m0.333s
;
; Server written in Scheme and compiled with Gambit-C 4.0 beta 14:
;
; real    0m1.348s
; user    0m0.199s
; sys     0m0.386s
;
; There were no ECONNREFUSED errors in both cases.




More information about the erlang-questions mailing list