From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27080 invoked by alias); 13 Dec 2007 15:08:15 -0000 Received: (qmail 27069 invoked by uid 22791); 13 Dec 2007 15:08:14 -0000 X-Spam-Check-By: sourceware.org Received: from py-out-1112.google.com (HELO py-out-1112.google.com) (64.233.166.176) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Dec 2007 15:08:10 +0000 Received: by py-out-1112.google.com with SMTP id a25so1678196pyi.11 for ; Thu, 13 Dec 2007 07:08:07 -0800 (PST) Received: by 10.35.98.3 with SMTP id a3mr2323489pym.22.1197558486880; Thu, 13 Dec 2007 07:08:06 -0800 (PST) Received: by 10.35.95.17 with HTTP; Thu, 13 Dec 2007 07:08:06 -0800 (PST) Message-ID: Date: Thu, 13 Dec 2007 15:24:00 -0000 From: "Anthony Tonizzo" To: "eCos Disuss" Cc: "=?ISO-8859-1?Q?=D8yvind_Harboe?=" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: Idle timeout and maximum # of sockets for athttpd X-SW-Source: 2007-12/txt/msg00062.txt.bz2 Oyvind: > I hate options :-) I guess if it was to be an option I would like to > have a minimize # of > sockets option. Not quite sure how you want to achieve that. By the patches you yourself have submitted, you are by now pretty familiar with the way sockets are handled and disposed. The only way to mnimize sockets is to use persistent connection, and that is something that is already there by virtue of HTTP 1.1 support. It does make a huge difference because, as I said, a single request was all it took to freeze older HTTP 1.0 versions of atHTTPD. At this point, assuming that you do not use the CYG_HTTPD_MODE_CLOSE_CONN flag too often, the number of sockets used is only dependent by how many different clients connecto to the server. > Is there a reason I would not want to minimize the # of sockets used? > I guess athttpd would typically be used for some sort of logging/configuration > server. Performance is not so much an issue at that point. For a web server used only for configuration you are certainly capable of dropping the number of sockets. > The minimum # of sockets would then presumably be with > CYG_HTTPD_SOCKET_IDLE_TIMEOUT being somewhat near the length > of processing a request. 5 seconds seems like a reasonable default at > that point... That would not work, unfortunately. When you close() a socket, that socket is not returned to the pool right away. The stack (or, to use the lastest Microsoft buzzword, the "TCP Chimney", I am not kidding you!) holds on to it for a couple of more minutes to make sure that stray data is not still in the wire (back when the giants walked the earth, TCP connections could take that much to deliver the goods...) This time, spent by the stack waiting, is on top of whatever time you set for CYG_HTTPD_SOCKET_IDLE_TIMEOUT. During this time you better have some spare sockets available, otherwise the whole thing will freeze until a socket _is_ finally relesed. Your request, which has been pending since it was received, is now going to be served, but you are not going to like the constant waiting. Because of all this, I have always found that 16 sockets are not a bad number at all. Once you have opened all your files, there is still enough left for a few HTTP connections. Cheers! Tony -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss