Re: benchmarking squid on solaris/x86

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 20 Mar 2002 23:03:24 +0100

On Wednesday 20 March 2002 17:25, Andres Kroonmaa wrote:
>
> I know from experience that tcp_time_wait_interval and

the TIME_WAIT is quite well optimized in Linux to batch all the
sockets together in larger chunks when under load, thus avoiding
excessive time checks. Though Solaris did something similar by now..
at least I remember reading something along these lines in the first
major TCP patch (during 2.6 I think).

When under high load (more than 2^5 TW sockets) Linux uses a bucket
queue implementing the TIME_WAIT period. All new TW sockets are put
into the current fill bucket, and a low priority background timer
event rotates the buckets and recycles overdue TW sockets by reaping
the sockets in the oldest bucket. This event takes place every 60/8
seconds.

Basically the only thing a TIME_WAIT socket consumes while in
TIME_WAIT is the memory for the socket. If you receive a lot of stray
packets then TCP processing of those stray packets may alwo inflict a
small penalty from having to look thru a few sockets before finding
the correct one (or none), but you need to have really a lot of
TIME_WAIT sockets and a lot of stray packets for this to be of
significance.

Because of this (and politics regarding what the user should be
allowed to tune) the length of TIME_WAIT cannot be tuned in Linux. It
is fixed at 60 seconds, or sligthly more when under load due to the
infrequent flushing of TW buckets.

Under low load (less than 2^5 TW sockets) each TIME_WAIT period is
timed individually.

> tcp_fin_wait_2_flush_interval impose performance hit on a
> Solaris system. I think on Linux too.

What exacly is it?

Linux seems to share FIN_WAIT2 processing with TIME_WAIT, using the
process described above. Only the lenght of FIN_WAIT can be tuned.

> build up thousands of sockets in timewait. Now Linux afaik
> handles this automatically by dropping oldest timewait sockets
> without a notice to keep their count decent, breaching standard,

Not that I know of.

The only similar thing I have found in Linux is that it immediately
drops TIME_WAIT sockets if above the allowable queue length,
complaining loudly about the fact in the process.. The TW queue limit
defaults to 180K sockets on my 320MB laptop, more can be allowed
runtime if needed.

Linux also drops TIME_WAIT sockets before the period has expired in
response to matching RST packets.

All of the above is based on reading the Linux-2.4 stack and my
experiense from using Linux.

Regards
Henrik
Received on Wed Mar 20 2002 - 15:12:43 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:52 MST