Website is very slow on first access but fast afterwards

I recently noticed that when we try to access our site via a new browser. The first search takes a really long time to load. Almost a minute. Subsequent searches for the page lead to instant results. Some online research indicates it could be a server side issue. What settings can I change to stop this behavior?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

I fully agree with what @KFSys mentioned. One extra thing that I could suggest is to open your browser developer tools and check the network tab and the console and look for some errors in there.

It is possible that the site is pulling very large images or other static assets which could also explain the slowness only for the first request.

Hope that this helps! Regards, Bobby

Hi @jamboauction,

Usually, the Time To First Byte - TTTB is serverside, yes. Having said that, this can be caused from your application as well.

Looking into the server itself, there isn’t one option that you cna turn on and it to start working. What I’ll suggest is to try and optimize your server by using a caching service like Redis for instance.

Additionally, my recommendation would be to install OPcache for some server-side caching and add PHP-FPM to it.

Oh, and make sure you are using the latest PHP version.

Regards, KFSys