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.

I was considering using mmap, but somewhere i heard that too many mmapped files could be a problem for the server.

Mike wrote:
Async IO i mean, writer thread does loop and sends as much as possible
chunks from the files, same way as driver thread reads multiple chunks
of requests from multiple clients. sendfile blocks, so you will need 10
threads for 10 clients at the same time, in case of writer thread, it
can alone transfer 10 files to 10 clients. May be it will be slower in
each single case comparing to sendfile but overall it does it fast enough.

Vlad,
Sorry, but your assertion is not correct.  sendfile() is not required
to block - as far as I am aware it works on non-blocking sockets
without a problem.  The key advantages of using sendfile is that it is
implemented zero-copy and allows the OS to do large-block read-ahead
on the files.  If serving 100 clients 650MB files, using non-blocking
IO read+write needs to allocate local buffers.  If buffers are small
(e.g. 100KB) then the disk has to seek like crazy from file to file,
and that will kill performance.  If the buffers are large (e.g. 16MB)
then the disk seek will be fine but I will need to burn 1.6GB of RAM
for the buffers in the NS process...  How does NS decide what this
buffer size is?  Can you point me at the code that performs this
operation?  How challenging would it be to add optional sendfile
support here?


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
naviserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


--
Vlad Seryakov
571 262-8608 office
[EMAIL PROTECTED]
http://www.crystalballinc.com/vlad/


Reply via email to