Site Load speed cyclical (every 2 hours) with Cloudflare proxy

Hi there

I have a wordpress site with WP rocket for speed optimisation.

When I enable the proxy on Cloudflare, the performance becomes cyclical. Every two hours it takes 7-8 seconds to load, and the other hours it takes 2 seconds.

When I disable the proxy on Cloudflare I get 4-5 seconds consistently. Any ideas what’s causing this?

Screenshot attached.

Thanks
Donal

Could you share the domain name? :slightly_smiling_face:

Thanks!

The site does not seem to be proxied at the moment - I guess you paused Cloudflare due to the issues?

It sounds like WP Rocket runs those tests from the server hosting the site - is this correct? Have you tried measuring the page load times externally?

1 Like

Hi Albert, thanks for the interest in this.

The proxy was disabled due to the issue. I’ve re-enabled it two hours ago and you can see the pattern repeat itself.

FYI - WP Rocket doesn’t run the tests. Rocket is a site optimisation plugin. I’m using GT to run the tests, making it independent.

Thanks

Thanks for the report link. Could you share one of the slow measurements as well? And could you check what the Cache TTL is set to in the dashboard? :slightly_smiling_face:

Of course! This is an interesting case.

1 Like

Ahh, nevermind I found a link to the latest report :sweat_smile:

It seems the slowdown is caused by cache expiration (check the CF-Cache-Status header in the waterfall). When the cached resource expires, Cloudflare needs to revalidate it, which requires a request to the origin. If the cache TTL is set to 2 hours, that would explain why every other measurement is slow.

Although this assumes GMetrix is the only visitor to the site going through the SEA colo - or at least the first visitor after the cache expires.

Assuming my theory is correct, the GMetrix measurements are probably not representative of real world performance. If you did a measurement ever minute, you would still only see a spike every 2 hours.

In this case, you might benefit from enabling Tiered Caching in the dashboard.

Thank you for your input. It’s beginning to make sense.

I also thought that the first user would get a slow experience but I still wanted to avoid that as we get so few users anyway.

I’m on a pro plan so I believe the TTL is hourly Edge and Browser Cache TTL · Cloudflare Cache docs. That might explain why the second hour is slow.

The browser caching is set to a year in Cloudflare.

Do you have a sense of how best to resolve it?

I would recommend against setting browser caching to a year unless you are absolutely sure content will not change. It will just cause problems when your content updates.

The first visitor connecting through a colo after the cache expires will always have a slower experience than subsequent visitors. This is because each colo has its own cache. However, I believe the delay could be significantly reduced by turning on Tiered Caching in Caching → Tiered Cache.

Another step towards improving load times is setting a longer Edge Cache TTL. You can do so using a Page Rule:
https://developers.cloudflare.com/cache/how-to/create-page-rules

Hi Albert

Thank you for the tips. I made three changes

  • Using the URL rules, I set the Browser Cache TTL to 8 hours
  • Changing browser caching to 1 day
  • I’ve enabled the Tiered Cache.

I’ll monitor this for a few hours and will share the results later.

Thanks
Donal

Browser caching will not help with this. Instead, you should try setting the Edge Cache TTL to 8 hours :slightly_smiling_face:

Thank you. I’ve changed that.

Hi Albert

That worked perfectly. I haven’t labelled the graph but you can where the load time drops. It’s also faster than with proxy disabled.

I thought the load time would jump up every 8 hours (aligned with the Edge Cache setting) but it doesn’t seem to be happening that way.

I’m delighted with the results.

Thank you

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.