Adding asynchronous logging
mdounin at mdounin.ru
Mon Apr 27 19:40:05 UTC 2015
On Mon, Apr 27, 2015 at 12:19:09PM -0700, Shawn J. Goff wrote:
> I have been doing some load tests against Nginx and have found significant
> client-side latency outliers at the 99.9th percentile. During the load test,
> I'm looking at iostat and it's showing me mostly zero utilization. When I
> log to a tmpfs instead, the outliers go away. When I use buffer=32M, the
> outliers come much less frequently. This leads me to believe that the
> synchronous write in the ngx_http_log_module is contributing to the latency
> as the worker threads can't accept until they're done writing.
Just a side note: as nginx does nothing to make writes
synchronous, it's up to OS to optimize writes as long as it is
able to do it. You may want to look into what your OS can do here
and how to tune it.
> I'm considering adding asynchronous logging to the module and wanted input.
> So far, I planning on using aio and would like to know if this is a bad idea
> or not. I saw recently that the aio module was deprecated, but I'm not sure
The module that was deprecated (and removed) is the aio event
module, an experimental module to work with sockets with AIO
operations as available on FreeBSD. Not to be confused with file
AIO functions available if nginx is compiled with --with-file-aio
More information about the nginx-devel