Piotr Sikora
May 02, 2011 01:24AM
Hi,

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

That depends on your configuration on on capabilities of your operating
system. Asynchronous file I/O is available on recent versions of Linux,
Solaris, DragonFly, FreeBSD, NetBSD, MacOSX.

> I'm considering using Nginx to serve static images. Pretty much every
> connection will result in a file IO.

No, it won't. Recently served files should be in your OS's buffer cache.

> If Nginx blocks for file IO, then
> using Nginx here wouldn't be any better than using Apache, right? Every
> connection will lead to a file IO which blocks the entire Nginx process.
> So to serve 500 concurrent connections I'll need 500 Nginx processes.

If that would be the case (buffer cache hit rate would be very low) and you
would be using magnetic disks, then yes, you'd be better off with a web
server than uses per-client lightweight processes or threads.

Best regards,
Piotr Sikora < piotr.sikora@frickle.com >


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Does Nginx block on file IO?

Andy May 01, 2011 08:26PM

Re: Does Nginx block on file IO?

jjjx128 May 01, 2011 09:54PM

Re: Does Nginx block on file IO?

Piotr Sikora May 02, 2011 01:24AM

Re: Does Nginx block on file IO?

Piotr Sikora May 02, 2011 01:30AM

Re: Does Nginx block on file IO?

Justin Cormack May 02, 2011 07:08AM

Re: Does Nginx block on file IO?

jjjx128 May 02, 2011 07:17AM

Re: Does Nginx block on file IO?

jjjx128 May 02, 2011 07:25AM

Re: Does Nginx block on file IO?

Cliff Wells May 02, 2011 02:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 251
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready