Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 594
NeoWang Avatar asked Jun 20 '16 10:06

NeoWang


2 Answers

The initial connection refers to the time taken to perform the initial TCP handshake and negotiating an 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.

like image 118
Gideon Pyzer Avatar answered Sep 20 '22 13:09

Gideon Pyzer


Use dig command to check you domain name resolution process. if return multi answer section, check these ips is valid.

like image 27
宫宜栋 Avatar answered Sep 21 '22 13:09

宫宜栋