Nginx logging phase
mdounin at mdounin.ru
Thu Oct 29 15:51:20 UTC 2020
On Thu, Oct 29, 2020 at 06:23:59PM +0530, Vikas Kumar wrote:
> Do you have a recommendation on what handlers are suitable for my use case?
In nginx itself, proper approach to count in-flight request would
1. Increment the counter only if no module's cleanup handler is installed
in the request pool. This way the counter can be incremented
in any phase, which makes it possible to do this in a
particular location. If the handler is called multiple times,
additional calls are simply ignored.
2. Once the counter incremented, install module's cleanup handler
to decrement the counter. This ensures that the counter is
always properly decremented when the requst is freed.
This is more or less what limit_conn module does (except it uses
some bits in the request structure to optimize checking if the
cleanup handler is installed).
No idea though if something similar can be done with the Lua
module you are trying to use.
More information about the nginx