Welcome! Log In Create A New Profile

Advanced

Intercepting USR1 in a module

Andrew Punch
February 12, 2014 07:16PM
Hi,

I am maintaining a custom module for nginx. We currently rotate our logs
and load dynamic data every 5 minutes by using SIGHUP. Unfortunately this
is also tears down our keepalive connections which harms our performance
(we are handling about 1500 requests per second per server). We have a
number of custom log files in addition to the access log and error log
which also need to be rotated.

I was hoping that I could use SIGUSR1 to reopen the logs (including the
module's custom logs) and notify the module that it should reload the
dynamic data without dropping the keepalive connections.

I can see that I could use ngx_conf_open_file() to open the module's custom
log files so that nginx will take care of reopening them. However for
reloading the dynamic data: I can't see a way to hook the SIGUSR1 in the
worker process (which shows up as a NGX_CMD_REOPEN in the channel for the
worker process). However if I added a new hook for NGX_CMD_REOPEN then
epoll inside the channel handler would probably return EEXIST.

So what is the best way for a module to hook NGX_CMD_REOPEN? Or is there
better way of approaching this?

-Andrew

--
NOTICE

This e-mail and any attachments are confidential and may contain copyright
material of Brandscreen or third parties. If you are not the intended
recipient of this email you should not read, print, re-transmit, store or
act in reliance on this e-mail or any attachments, and should destroy all
copies of them. Brandscreen does not guarantee the integrity of any emails
or any attached files. The views or opinions expressed are the author's own
and may not reflect the views or opinions of Brandscreen.

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Intercepting USR1 in a module

Andrew Punch 809 February 12, 2014 07:16PM

Re: Intercepting USR1 in a module

Maxim Dounin 551 February 13, 2014 05:48AM



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

Online Users

Guests: 199
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