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.
33d8c76155a3676160693c8f315b51a5?d=identicon&s=25 马国维 (Guest)
on 2008-10-08 16: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
E88f834c0785a399b498b6cf70d10223?d=identicon&s=25 Grzegorz Nosek (gnosek)
on 2008-10-08 16: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 Nosek
This topic is locked and can not be replied to.