Nginx + embedded perl, timer based on signal handling


I’m trying to use a perl handler to count the global number of GET/POST
requests issued towards the server (the existing rate/connection limit
modules are of no use to me as they are per-source).

The main problem I’m facing is not being able to reset the counter every
second - I tried installing a timer function as the signal handler for
SIGALRM, but when an alarm is received the worker process exists saying
“worker process 73712 exited on signal 14”;

Is there a way to make the worker process pass SIGALRM handing to
embedded perl?
Are there any other ideas of how to achieve the same goal, of defining a
function within that perl handler memory space that executes every 1
second without blocking nginx?


Posted at Nginx Forum: