Does Nginx block on file IO?

jjjx128 nginx-forum at nginx.us
Mon May 2 05:54:27 MSD 2011


Andy Wrote:
-------------------------------------------------------
> I was always under the impression that Nginx is
> non-blocking for file IO. Then I was told it
> wasn't.

Actually AIO support was added not so long ago. It can be non-blocking
for file IO on systems with AIO. 

> If Nginx blocks for file IO, then
> using Nginx here wouldn't be any better than using
> Apache, right? 

How is it even related? There is a difference between getting a file
from disk and serving it to the client from buffer. You can get it
really fast and block for a very little time but than send it to the
client very slowly. So asynchronous front-end would be a really good
idea. 
Other than that you might find that neither nginx nor apache can serve
your images fast enough from any common filesystem. You will need
something like Bitcask to go farther. The idea is to get an entire image
to the buffer in a single disk seek.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,194884,194891#msg-194891




More information about the nginx mailing list