Subject: Re: Proposal: socketfrom()
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 07/05/2007 03:02:15
>> I have an application that makes outbound TCP connections at a very
>> high rate, so high that the overhead of additional system calls to
>> set socket options considerably impacts performance.
> That sounds as though there is something badly wrong in the code
> paths somewhere.

Maybe, but I'm not so sure.

> Even allowing for the system calls costs, I'm surprised that
> setsockopt() gets anywhere near the cost of connect().

Some processors make crossing the kernel/user boundary very expensive.
That crossing can be a substantial portion of the cost of a call such
as setsockopt() - or even connect(), especially async connect() (which
is probably what's going on).

Upon considering that Thor's code was probably doing at least a
half-dozen setsockopt() calls for each socket, I find it totally
plausible that doing (say) eight syscalls instead of two for each
connection could "considerably" impact performance.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B