I have a LAMP server which I host my website off of. I used webpagetest.org to test the speed of my website. Sometimes I get good speeds (under a second) which is what I want. Then If I test it a minute later, I get between 30 and 32 second load times. My website does not seem to be consistent and I want to know how I can fix it.
When I access my website if I haven’t visited it in a couple hours, it takes very long ( more than 20 seconds for it to load). If I hit the reload button while the page is loading, it suddenly connects to my website. How can I make my website load consistently? The test results are shown below.
In this image, my website takes 30 seconds to wait for gstatic.com? What is that and why is the request taking so long. How can I prevent my webserver from connecting to gstatic to speed up the performance of my website?
Source: Ask PHP