From: Mike <nee...@gm...> - 2006-07-12 20:10:35
|
On 7/12/06, Vlad Seryakov <vl...@cr...> wrote: > I could be wrong, never used sendfile before. > > The code you can check is driver.c, WriterThread, and bufsize parameter > can be used to define buffer. Excerpt from sendfile(2) on FreeBSD: When using a socket marked for non-blocking I/O, sendfile() may send fewer bytes than requested. In this case, the number of bytes success- fully written is returned in *sbytes (if specified), and the error EAGAIN is returned. Overall it looks like it would be very easy to change WriterThread() to use sendfile() instead of read+memmove+(something). However the (something) appears to be NsSockRead() which I am guessing is a bit more complicated than just an indirect call to write()... since probably that code-path supports sending through zlib or over an SSL socket... > I was considering using mmap, but somewhere i heard that too many > mmapped files could be a problem for the server. mmap is good because it kind of allows zero-copy from usercode.. however it's not useable in my situation directly because of the 32-bit address space restriction - can't mmap 65GB (650MB*100) of address space... The solution I've seen others use is to mmap in 16MB chunks and move the mmaped chunk as the transfer progresses along the file. |