Why is request_time much larger than upstream_response_time in nginx access.log?

前端 未结 1 942
余生分开走
余生分开走 2021-02-01 20:54

I am trying to improve the performance of a web app. Profiling the app itself, I found its response time are quite acceptable (100ms-200ms), but when I use ApacheBench to test t

相关标签:
1条回答
  • 2021-02-01 21:07

    A high request_time may be, among others, due to a client with a slow connection, for which you can't do much about. Thus, a high request_time does not necessarily represent the performance of your server and/or application.

    You really should not spend too much time on request_time when profiling but instead measure things like the application's response time (ie. upstream_response_time).

    That said, there are some things which you are able to do and may affect the request_time. Some of them are the following:

    • Move your server on a high-speed network
    • Move your server near the client
    • Disable the Nagle's algorithm
    • Tune the server's TCP stack (see this article). However these won't necessarily make a big difference since the kernel does a good job of tuning them for you.
    0 讨论(0)
提交回复
热议问题