Re: nonblocking disk read again

Arjan van de Ven (adve@oce.nl)
Wed, 13 Oct 1999 11:52:24 +0200 (CEST)


Helge Hafting had the wisdom to write:
>>It would be nice if one didn't have to hand the request to
>>a worker thread if the file is already in memory,
>>i.e. if sendfile() was able to return EWOULDBLOCK if
>>the read operation would block because the data wasn't in core.

HH> I see a problem here. First - sendfile() will take some time
HH> even for a file in memory. Particularly a really big file.
HH> So you'll be blocking for a while,
HH> possibly delaying requests coming in via other network interfaces.
HH> Some other cpu could serve them.

The trick would be to fill the socket-buffer and THEN stop sendfile with
EWOULDBLOCK, so that only kilobytes (instead of possibly megabytes) are
transfered at a time. This way, one can keep the socket-buffers full
(allowing full network-throughput) while keeping the time in one sendfile()
relatively small.

Note that kHTTPd tries to do just this.

Greetings,
Arjan van de Ven

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/