httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Extraneous socket read?
Date Tue, 03 Jul 2001 03:04:44 GMT
With keepalives on, the system call profile for reading a request
typically looks like this:

accept(5, {sin_family=AF_INET, sin_port=htons(44579), 
sin_addr=inet_addr("127.0.0.1")}}, [16]) = 9 <9.604103>
read(6, 0xbffff873, 1)                  = -1 EAGAIN (Resource 
temporarily unavailable) <0.000007>
getsockname(9, {sin_family=AF_INET, sin_port=htons(80), 
sin_addr=inet_addr("127.0.0.1")}}, [16]) = 0 <0.000006>
fcntl64(9, F_GETFL)                     = 0x2 (flags O_RDWR) <0.000005>
fcntl64(9, F_SETFL, O_RDWR|O_NONBLOCK)  = 0 <0.000004>
read(9, 0x812df10, 8192)                = -1 EAGAIN (Resource 
temporarily unavailable) <0.000007>
select(10, [9], NULL, NULL, {300, 0})   = 1 (in [9], left {300, 0}) 
<0.000058>
read(9, "GET /50k.shtml HTTP/1.0\r\nUser-Ag"..., 8192) = 87 <0.000008>

Note the pattern at the end: the first read fails, because the request
hasn't arrived yet.  It takes a bit more time for the first packet to 
arrive.

Given that I'm seeing this phenomenon over the loopback, I'm assuming
that it's common with external clients with larger round-trip times too:
the server progresses from the accept to the read before the client sends
the first packet of the request.  If this assumption is correct (does 
anybody
have data to confirm or refute it?), then it should be possible to eliminate
a system call by not doing the initial read before the select.

--Brian



Mime
View raw message