NGINX module reporting 0 time to access.log
Yichun Zhang (agentzh)
agentzh at gmail.com
Tue Dec 2 22:16:47 UTC 2014
On Tue, Dec 2, 2014 at 12:57 PM, chase.holland wrote:
> Thank you for your quick response! Could you be more specific on what is
> blocking the worker process?
Just FYI: you can always find the blocking IO calls via tools like the
off-CPU flame graphs:
> Does an instance of an nginx module only get
> one context per process (thus we need to do our own threading), or is each
> instance of the module thread-based to match nginx's threads?
Nginx worker processes are single-threaded. For any I/O operations,
you should use nonblocking IO mode and solely rely on the nginx event
loop to dispatch any IO events for your fd's. Otherwise your nginx
will just degrade to the Apache's prefork mpm.
(BTW, use of your own OS threads to work around such things will just
degrade your nginx's performance to Apache's worker mpm.)
More information about the nginx