Re: sendfile() and NUMTHREADS questions

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Wed, 22 Dec 1999 12:43:26 +0100

Andres Kroonmaa wrote:

> I must have missed the thread totally, what this sendfile() is?
>
> I'd just warn against some complex library calls, as they might
> very easily use syscalls in a way not suitable for squid, for eg.
> mmap(file)+write(to_socket)+munmap(file) or a complex routine
> of while(!eof){read()+select()+write()} Easy for programmer, and
> meant for simple progs, it may heavily break performance of squid
> for not very apparent reasons.

In this case it isn't a library call but a macro system call sort of
equivalent to read(file)+write(socket) but with less overhead (only one
syscall, data copied directly from the filesystem buffer to the socket),
but I fully agree with you even if it didn't show in my post. It's use
for Squid is quite limited as only applies to cache hits, but it is
quite useful for a one-thread-per-client content server like Apache,
ftpd or Samba where a large portion of the time spent is in sending disk
content to a socket.

/Henrik
Received on Wed Dec 22 1999 - 05:35:22 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:20 MST