directio sendfile aio

Valentin V. Bartenev vbart at nginx.com
Fri Jan 22 11:27:45 UTC 2016


On Friday 22 January 2016 16:30:38 Anoop Alias wrote:
> I think the weird issue I mentioned had something to do with ngx_pagespeed
> with a memcached backed and memcached was not running . It is working fine
> with memcached now running .
> 
> Somehow the sendfile and directio setting was affecting that. as I
> mentioned the issue fixed with enabling either sendfile and directio on
> with memcached not running (I think pagespeed falls back to a file based
> cache if memcached is not running) .
> 
> Right now with
> 
> sendfile on;
> sendfile_max_chunk 512k;
> aio threads=iopool;
> directio 4m;
> 
> and memcached running ;I dont see any issues .
> 
> if memcached is not running (used by pagespeed) and the above setting
> produce weird errors that goes away if directio and sendfile is used in a
> mutually exclusive fashion.
> 
> 
> 
> #########
> the book is NGINX High Performance
> By Rahul Sharma
> 
> You can check the exact section in page #53 available in google books as a
> sample.
> #########
> 
> So the setting
> 
> sendfile on;
> sendfile_max_chunk 512k;
> aio threads=iopool;   #thread_pool iopool is defined in the main context
> directio 4m;
> 
> 
> is good ?
> 
[..]

I wouldn't recommend these settings for everyone.  Actually there
are no settings that work for everyone and that's the reason why
these directives exist and tunable.

Direct IO is questionable if you aren't serving gigabytes of movies.
You don't need direct IO and aio if your working data set is less
than the amount of RAM.

"sendfile_max_chunk 512k" with "directio 4m" looks surplus.

Actually the default settings usually work well.  So in general it's
not a good idea to tune anything unless you're experiencing problems
and fully understand what you're going to change and why.  Also you
need some metrics and/or benchmarks to test your settings, blind
tuning can make the result worse.

  wbr, Valentin V. Bartenev



More information about the nginx mailing list