Forum: NGINX a question about "ngx_http_log_module".

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
马国维 (Guest)
on 2008-10-08 18:22
(Received via mailing list)
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!

thanks
Grzegorz N. (Guest)
on 2008-10-08 18:28
(Received via mailing list)
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 N.
This topic is locked and can not be replied to.