nginx workers in "D" status in top
igor at sysoev.ru
Tue Jul 27 22:45:16 MSD 2010
On Tue, Jul 27, 2010 at 11:54:31AM -0500, Ryan Malayter wrote:
> I'm seeing a number of workers periodically entering the "D" status in
> top (uninteruptible sleep). Normally, this means it is blocking on
> disk IO. However, I am using nginx 0.7.62 (default package) on Ubunutu
> 9.10, and I believe asynchronous IO should be enabled.
> We are using proxy_cache, so there is some reading from disk in our
> configuration (not just reverse proxy).
> Is it normal to have nginx workers block on the disk even on an
> asynchronous IO-capable system?
> How can I check if nginx is actually using async IO?
> My configuration is large, but I will post fragments if necessary. I
> am using 4 worker processes on a single-CPU system (recently upped to
> 10 because of this issue).
nginx supports file AIO only in 0.8.11+, but the file AIO is functional
on FreeBSD only. On Linux AIO is supported by nginx only on kerenl
2.6.22+ (although, CentOS 5.5 has backported the required AIO features).
Anyway, on Linux AIO works only if file offset and size are aligned
to a disk block size (usually 512 bytes) and this data can not be cached
in OS VM cache (Linux AIO requires DIRECTIO that bypass OS VM cache).
I believe a cause of so strange AIO implementaion is that AIO in Linux
was developed mainly for databases by Oracle and IBM.
More information about the nginx