a question about "ngx_http_log_module".

Grzegorz Nosek grzegorz.nosek at gmail.com
Wed Oct 8 18:18:22 MSD 2008

On Wed, Oct 08, 2008 at 10:10:28PM +0800, =?GB2312?B?wu25+s6sIDxtYWd1b3dlaUBiYWlkdS5jb20+?= wrote:
> Hi,all:
> I have a question about "ngx_http_log_module".
> If we set the "worker_processes" to 2, how the nginx promises the two
> process can write to the same access log without disturbing by eachother!

AFAIK (and I may be wrong) POSIX guarantees that writes below a certain
length (I think it's 512 bytes in POSIX and a page in Linux) are atomic
and thus guaranteed to never get mixed up. So nginx can simply write()
the log entry to the log file and not care at all about synchronisation.

If I'm wrong, I hope somebody will correct me :)

Best regards,
 Grzegorz Nosek

More information about the nginx mailing list