outmoded / discuss

The "mailing list"
99 stars 9 forks source link

hapi 13.x is computing/writing response time incorrectly in logs #802

Closed subi-kp closed 5 years ago

subi-kp commented 5 years ago

Noticed application is computing/writing response time incorrectly in logs on heavy/peak load(ie: 500 request/ second). Hapi logged in the log response time as 37 seconds. And I have a nginx proxy running behind the application and where I have noticed that application took 40 seconds to process the request in nginx access logs. Also to improve application performance we are using async logging. Any idea on this?

Context node version: 6.11.5 hapi version: 13.5.3

hueniverse commented 5 years ago

3 seconds is a big difference but I don't know what's going on in your setup. It makes sense that hapi had a smaller number since it's the deeper measure covering less processing than nginx.

hapi v13 is too old for me to help you with.

subi-kp commented 5 years ago

May I know, how the response time is calculated ? will it includes event queue delay time ?

hueniverse commented 5 years ago

Just look at the code. When the request is received a timestamp is taken, and when it is replied to, duration calculated. So yes, it includes actual time passed from start to finish, not cpu time.

subi-kp commented 5 years ago

Thanks for your prompted response. But in my case, we are seeing the difference in response time between proxy and application. My assumption is below for the issue.

nginx[40 sec] -->[3 sec]application[37 sec]

Application took 37 sec to process the request. Application received the request from nginx and started processing request after 3 sec - No proof for this. Is there any way we can calculate this ? Nginx/proxy recorded as 40 sec as response time with the waiting time of 3 sec instead of 37 sec.

We need to measure this delay, could you help to understand and fix this? @hueniverse

hueniverse commented 5 years ago

Sorry, I don't have any free time. You can try asking around Slack but honestly, you need someone to look at your code and config and figure out where the time is being spent.