why delta only include the execution time of ngx_process_events not ngx_event_process_posted (Zhang Chao)

Valentin V. Bartenev vbart at nginx.com
Tue Oct 31 14:13:33 UTC 2017

On Sunday 29 October 2017 21:35:15 yang chen wrote:
> Thanks for your reply, why calling the ngx_event_expire_timers is
> unnecessary when ngx_process_events handler returns so quickly that the
> millisecond precision is not enough to display the calling time(less than
> 1ms maybe).
> ngx_process_events handler returns quickly which doesn't
> mean ngx_event_process_posted return quickly, maybe it excute for 2 ms or
> more

First of all, ngx_process_events() is the function that actually _waits_
and updates process time.  So, there's no sense to move the calculation
of delta elsewhere, since ngx_current_msec will be the same anyway.

In most cases the time is spend by waiting on kernel for events, not by
processing the events and executing handlers.

Normally ngx_event_process_posted should not spend 2ms, otherwise that
would result in less than 500 rps, which can only indicate blocking issue
or overload.

  wbr, Valentin V. Bartenev

More information about the nginx mailing list