Why is my initial connection stalling for 10+ seconds even with no meaningful traffic?

Posted July 21, 2019 6.1k views
Server OptimizationUbuntu 18.04

For what it helps I am running Node.js with MongoDB and using SSL connection (although the problem seems to persist o non-SSL as well). My initial connection stalls a lot even with basically no meaningful traffic, talking about +10 seconds before the page even connects. Then again, roughly 40% of the time it loads just normally.

Sure I am running the $5 plan, but could that really be a bottleneck already?

My load metrics seem fine, except Memory runs at ~50% and Disk Usage 26%. Not sure if these are normal? Perhaps these are the issues then

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Open the developer tools in the browser (give you use a browser) and check the network communication. Chrome breaks down the time it takes to communicate with the server into smaller bits, so you can see whether connecting to the socket is slow (slow network) or getting data is slow. I saw it many times that servers respond slowly to the very first request because they have to “spin up” worker threads, initialise buffers, caches, etc.

50% RAM usage is not a lot, disk usage of 26% is not a lot either.