[erlang-questions] gen_tcp receving slow

igwan <>
Wed Sep 26 00:18:44 CEST 2007


Per Hedeland wrote :
>>
>> That's boring - we shouldn't have to fiddle with the size
>> of the recbufs to get good TCP performace.
>>     
>
> Agreed - and in case it wasn't clear from the numbers in my message, my
> suggestion to go digging wasn't to find out why active receive was
> "slow" per se, but rather why passive receive was ~ 10 times faster (at
> least in this particular case). The same recbuf size was used for
> both...
>   
Last time I benchmarked using eprof with {active, once} I noticed the 
call to inet:setopts on each received chunk was eating up 25 % of the 
CPU time (relative to my program). It might be that a 2-message exchange 
with the Port is needed instead of just one. As for {active, false}, 
it's really bad numbers.
My remaining question is why is all this (even with a big receive 
buffer) so CPU-intensive ? Is socket handling done in a port program ? A 
linked-in driver ? Is there too much copying within the memory that 
kills performance ?


igwan




More information about the erlang-questions mailing list