httpnginxgoogle-chrome-devtools

Why is the initial connection time for a HTTP request so long?


My web app sits behind a Nginx. Occasionally, the loading of my web page takes more than 10 seconds, I used Chrome DevTools to track the timing, and it looks like this: enter image description here

The weird thing is, when the page loads slowly, the initial connection time is always 11 seconds long. And after this slow request, subsequent loading of the same page becomes very fast.

What is the possible problem that cause this?

P.S. If this is caused by a resource limitation on my server, can I see some errors/warnings in some system log?


Solution

  • The initial connection refers to the time taken to perform the initial TCP handshake and negotiating SSL (where applicable). The slowness could be caused by congestion, where the server has hit a limit and can't respond to new connections while existing ones are pending. You could look into some performance enhancements in your Nginx configuration.