Hi,
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
NGX_CMD_RELAY_CMD.
browser nginx_master nginx_worker_1 nginx_worker_2 WorkerN
| | | | |
Admin_Request |--------+-------------->| | |
notify() | |<==============| | |
notify() | |==============>| | |
notify() | |===============+==============>| |
notify() | |===============+===============+==============>|
Questions:
- 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,
Regards,
Samuel
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel