From owner-freebsd-net@FreeBSD.ORG Wed Jun 15 19:44:13 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 82A8716A41C for ; Wed, 15 Jun 2005 19:44:13 +0000 (GMT) (envelope-from silby@silby.com) Received: from relay03.pair.com (relay03.pair.com [209.68.5.17]) by mx1.FreeBSD.org (Postfix) with SMTP id 2F20D43D53 for ; Wed, 15 Jun 2005 19:44:13 +0000 (GMT) (envelope-from silby@silby.com) Received: (qmail 77633 invoked from network); 15 Jun 2005 19:44:11 -0000 Received: from unknown (HELO localhost) (unknown) by unknown with SMTP; 15 Jun 2005 19:44:11 -0000 X-pair-Authenticated: 209.68.2.70 Date: Wed, 15 Jun 2005 14:43:56 -0500 (CDT) From: Mike Silbersack To: Jeremie Le Hen In-Reply-To: <20050615125602.GS30017@obiwan.tataz.chchile.org> Message-ID: <20050615142812.C3132@odysseus.silby.com> References: <06e401c570e2$3f342930$1b321d80@MITRE.ORG> <20050614161717.M8134@odysseus.silby.com> <20050615125602.GS30017@obiwan.tataz.chchile.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org Subject: Re: Advice needed on running idiotic test for client X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2005 19:44:13 -0000 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