Nginx Logging to Zeromq Module - Sparkngin

W-Mark Kubacki wmark+nginx at hurrikane.de
Tue Dec 3 13:49:48 UTC 2013


2013/11/16 Steve Morin <steve at stevemorin.com>:
> Does anyone have experience integrating zeromq with Nginx.  I am looking for
> some pointers, to see what concerns I should look out for.
>
> I am trying to contribute this code to a open source project.
> -Steve

This seems to me being a good template for what you want to accomplish:
[1] http://www.binpress.com/app/nginx-redislog-module/998

Keep in mind that »ØMQ sockets are not threadsafe« and don't share
them between threads.
[2] http://zguide.zeromq.org/page:all#Multithreading-with-MQ

See also:
[3] http://forum.nginx.org/read.php?2,243942,243986#msg-243986 (master
process → init_module callback; don't define sockets here; zmq_init
goes here)
[4] http://www.evanmiller.org/nginx-modules-guide.html#definition

A note on performance:
• Use zero-copy wherever possible. (I would make a custom string an
optional last part of a message.) — [5]
http://zeromq.org/blog:zero-copy
• Does ØMQ have UDP or similar for PUB sockets? If so, use that.
• I guess that logging or queuing through Redis will perform better
than utilizing ØMQ for that matter iff everything is done on one
machine under high load.

-- 
Mark



More information about the nginx-devel mailing list