httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: Extraneous socket read?
Date Tue, 03 Jul 2001 04:44:02 GMT
On Mon, 2 Jul 2001, dean gaudet wrote:

> On Mon, 2 Jul 2001, Brian Pane wrote:
>
> > then it should be possible to eliminate a system call by not doing the
> > initial read before the select.
>
> that sounds correct and a desirable change.  i think the current behaviour
> goes all the way back to the first iol stuff i did, and was possibly just
> a thinko?
>
> oh perhaps it was because i didn't want to pay for a stack allocation on
> every entry to the low level send/recv routines?  (which is why there's a
> separate wait_for_io_or_timeout routine)
>
> that change is worth benchmarking.

Looking at the code, that read() is when we first enter
wait_for_io_or_timeout.  There was some discussion about this a while ago,
and nobody could really decide the best way to handle this.  There are two
options:

1)  We assume best case, that data is there immediately.  In this case, we
are best to read before selecting, because we will end up having one
system call.  However, if we are wrong, we end up with three.  One for the
first read, one for the select, and one for the read that succeeds
(assumes success).

2)  Assume worst case, that data is not going to be there.  In this case,
we do the select before the read always.  This means that we will always
have two system calls, regardless of what happens.

Currently, we assume #1.  Nobody ever did any real benchmarking on this
though, so we really don't know if this is a good thing or a bad thing.

Ryan

_____________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
-----------------------------------------------------------------------------


Mime
View raw message