Advice needed on running idiotic test for client

Mike Silbersack silby at silby.com
Wed Jun 15 19:44:13 GMT 2005


On Wed, 15 Jun 2005, Jeremie Le Hen wrote:

> Hi Mike,
>
>> 5.x has some features so that it does not allow too many TIME_WAIT sockets
>> to build up beyond a certain threshold, but if you're using 4.x we can
>> still tweak some sysctl values to achieve the effect you want.
>
> Would you mind being a little more precise on these two topics please,
> I'm very interested in them.
> Thanks.
>
> Regards,
> -- 
> Jeremie Le Hen

In 5.x, there are two changes that may interest you then:

1 - When sockets transition into the TIME_WAIT state, they are moved from 
regular sockets into special mini-sockets stored in the tcptw_zone UMA 
zone.  This zone is limited to maxsockets / 5, and if it fills up, the 
oldest socket is thrown out to make way for the newest one.  This makes 
sure that servers don't choke on all the TIME_WAIT sockets they are asked 
to hold on to - no need to mess with the MSL setting anymore!

2 - The function tcp_twrecycleable makes a heuristic guess as to whether 
or not a TIME_WAIT socket should be cleared out so that the local port can 
be reused.  This prevents the situation where you (the client) make many 
rapid connections, close the connection so that the TIME_WAIT lands on the 
client side, and choke up all available ports in the ephemeral range with 
TIME_WAIT sockets.

Change #1 was done by Jonathan Lemon, which enabled me to write change #2 
pretty easily.  As the result of both of those, http benchmark type 
programs that create a slew of TIME_WAIT sockets don't seem to phase 
FreeBSD on either the server or client side.  I think these changes went 
in before 5.2, but don't quote me on that.

Mike "Silby" Silbersack


More information about the freebsd-net mailing list