This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Idle timeout and maximum # of sockets for athttpd


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]