Welcome! Log In Create A New Profile


info exchange between workers

March 03, 2010 10:56PM

I'm writting a nginx module to handle special requests and it needs
to maintain a list of open file descriptors. If NGINX is configured
with several workers, each worker will keep its own list of FD.

Upon the processing of an 'Admin request', I'd like to reopen differents
files (closing the old FDs, and reopen new ones).

My problem is that the 'Admin request' will be handled by only one
worker, but I'd like each worker to take actions.

So I'd one request to be processed by all the workers.

browser nginx_worker_1 nginx_worker_2 nginx_worker_n
| | | |
Admin_Request |------->| | |
notify() | |==============>| |
notify() | |===============+==============>|

I found one way to reach my goal, but I don't know if there is a better
one with the current nginx code.

When the worker is processing the request, it writes a new command
(NGX_CMD_RELAY_CMD) in its ngx_processes[ngx_process_slot].channel[1]

It triggers SIGIO on the master, the master reads its channel[0] and for
each worker writes in the channel[0].

Then each worker receives and takes action when it receives the

browser nginx_master nginx_worker_1 nginx_worker_2 WorkerN
| | | | |
Admin_Request |--------+-------------->| | |
notify() | |<==============| | |
notify() | |==============>| | |
notify() | |===============+==============>| |
notify() | |===============+===============+==============>|

- Is there a different/easier way to do it?
- Do you have any feedback on my proposal? I have a diff ready, but it
needs some 'cleanup', I can provide it if needed.

Thanks in advance for the feedback,


nginx-devel mailing list
Subject Author Views Posted

info exchange between workers

nunspeed 2988 March 03, 2010 10:56PM

Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 87
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready