What would cause different load times for the same page?

I’ve just set up a simple PHP/MySQL website on a new server and I’ve been testing the page load time using a command line tool called wuzz.

For some reason the load time consistently alternates between 80ms and 150ms.

If I reload the page quickly it usually sticks around 80ms, but if I leave it a few seconds it usually starts out again at 150ms. What would be causing this?

When I test on my local server I get consistent load times of 5ms, and I never get any delays that would account for the 70ms difference on the server, so I don’t think it’s to do with any variations in the way the code builds the page.

I feel like I’m missing something obvious. Is there any reason why my page load time would sometimes be double when I’m requesting from the server, especially after waiting for just a few seconds?

It’s like it’s making an extra round-trip to the server, but I’m not sure why.

Open up your browser’s Dev Tools and check out the Network tab.

2 Likes

Thanks. I’ve just checked, and it’s TTFB that’s causing the variation.

  • After a delayed refresh it’s consistently around 220ms.
  • But if I refresh the page quickly it’s down to 120ms.

What would cause TTFB fluctuate between two distinct times on the same page? Something to do with PHP or MySQL caching?