From owner-freebsd-net Mon Jul 26 8:12:13 1999 Delivered-To: freebsd-net@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id F34CD14D87 for ; Mon, 26 Jul 1999 08:12:10 -0700 (PDT) (envelope-from aron@cs.rice.edu) Received: (from aron@localhost) by cs.rice.edu (8.9.0/8.9.0) id KAA20768; Mon, 26 Jul 1999 10:10:31 -0500 (CDT) From: Mohit Aron Message-Id: <199907261510.KAA20768@cs.rice.edu> Subject: Re: FreeBSD tuning for webserver performance To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Date: Mon, 26 Jul 1999 10:10:31 -0500 (CDT) Cc: freebsd-net@freebsd.org, druschel@cs.rice.edu (Peter Druschel) In-Reply-To: <199907260328.FAA03377@labinfo.iet.unipi.it> from "Luigi Rizzo" at Jul 26, 99 05:28:24 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > The data on SYN processing is interesting but really seems a large one! > > May i ask you how did you measure them -- by instrumenting the code > paths, or looking on a tcpdump at the delay between a SYN request > on the wire, and the SYN|ACK response. In the latter case, was > there any other traffic generated by the server ? > I measured it in two ways - first by instrumenting the code path by using the cycle counter. This gave values of 50 usec when the SYN was received repeatedly (i.e. everything's in the cache) and a value of 150 usec when the SYN was received after a period of time after doing some other processing (i.e. not everything was in the cache). I then measured the connection overhead in a stripped down fast webserver by first measuring the throughput by repeatedly initiating requests on separate connections and second by issuing requests repeatedly on the same connection. The difference in time taken per request approximately gives the TCP connection overhead. This was closer to 150 usec. So I assume in normal webserver processing, connection establishment takes about 150 usec due to cache effects. > A quick experiment locally on a K6-400 w/ 100mbit card (de) > running tcpdump shows that there are about 40us between the ping > request and response, and some 90-100us between the SYN and the > corresponding ACK (this at the bpf level). > So the SYN processing overhead appears to be more in the 50us range, > the rest being generic packet processing overhead. > Surely worth some optimization, though... > Your numbers correspond to mine assuming the SYNs are being sent repeatedly and no other processing is being done. > > because you get an immediate notification (check tcp_output() -- an > error generates a tcp_quench()) reducing the window to a single segment > and avoiding further congestion and occurrence of such events (and > you already have a full window in transit so there is no performance > penalty for your connection -- as ACK come in the window reopens > to its full size). > > Keeping queues short is always useful -- even in the case of your > busy web server, just to give one example, you might cause your > SYN|ACK for new connections incur a large delay just because you > have a huge number of data packets queued for delivery. > I accept your argument but I think short driver output queues might be useful in very limited number of cases. These are when the bottleneck in the path to the clients occurs at the driver. I would imagine that in most cases the bottleneck occurs at some external router (which usually have large queues). > > unfortunately fixing TCP like you suggest, while desirable is not > easy because there is not a fine-grained timer to use. > I have a paper submitted on how to implement very fine-grained timers in an OS with very low overhead. Rate-based pacing is one of the goals of these timers. Hopefully it'll get published soon. :) - Mohit To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message