public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Anthony Tonizzo" <atonizzo@gmail.com>
To: "eCos Disuss" <ecos-discuss@ecos.sourceware.org>
Cc: "Øyvind Harboe" <oyvind.harboe@zylin.com>
Subject: [ECOS] Re: Idle timeout and maximum # of sockets for athttpd
Date: Thu, 13 Dec 2007 15:24:00 -0000	[thread overview]
Message-ID: <b437ec690712130708v1743304aof8220a664edc961@mail.gmail.com> (raw)
In-Reply-To: <c09652430712130153r376ca740w654727269f92bb05@mail.gmail.com>

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

  reply	other threads:[~2007-12-13 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 14:33 [ECOS] " Øyvind Harboe
2007-12-13 15:24 ` Anthony Tonizzo [this message]
2007-12-13 15:33   ` [ECOS] " Øyvind Harboe
2007-12-17 16:03     ` Tom Deconinck
  -- strict thread matches above, loose matches on Subject: below --
2007-12-12 15:50 Anthony Tonizzo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b437ec690712130708v1743304aof8220a664edc961@mail.gmail.com \
    --to=atonizzo@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=oyvind.harboe@zylin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).