Website occasionally has a 20-25sec idle time since using Cloudflare

I’ve setup a couple of websites on Cloudflare, and since then the websites sometimes idle around 20 to 25 seconds before loading the website. It’s not a specific page on the website, if I click around on the website, it just happens once in a while (like once every 10 clicks to navigate to a new page, but this is quite irregular).

The websites are running on the same server as before I started using Cloudflare, and I didn’t have this problem before, so I don’t think it’s the server. I’ve looked up similar topics and setup Cloudflare using tips of others which should resolve this problem. The websites use “Always online” and “Cache everything” for example and I even tried using “Edge cache” in the custom page rules. I’ve made screenshots of the settings I’m using for the websites:

I also have test results of one of the websites showing the idling problem:

https://www.webpagetest.org/result/190709_3A_10970368447bdafd95d221d406c7b284/1/details/#waterfall_view_step1
https://www.webpagetest.org/result/190709_13_0d3ef31436ad52cb987ebb9104c86d7b/1/details/#waterfall_view_step1

There are no 404 errors in the network tab, while inspecting the website, so I don’t think it’s a resource file that can’t be found which is causing the delay.

Hopefully someone has a solution for this problem. If more information is required, please let me know.
Thanks in advance!

One quick tip delete the always use https rule. Then active in the crypto section of the dashboard Always use HTTPS.

Do you have HSTS active?

Thank you, I deleted the rule. I don’t have HSTS active at the moment, should I enable HSTS?

Hi @KWi1984,

In the webpagetest.org report you provided, it’s clear that the delay is only with the initial file, the HTML page itself. Initial connection, SSL negotiation etc are fast, but TTFB is taking too long. That’s an origin server issue, as far as why it’s taking too long. You may want to investigate your website setup to see if there are any events (such as cron jobs) that may be causing the server to at times be so slow in responding to Cloudflare. If you are using WordPress or other CMS you may want to create a page cache to make these events less frequent (or review its settings if you already have one in place).

Now, as for the issue of why Cloudflare isn’t always serving the page from its cache, even with the cache everything page rule, Cloudflare caches each page and file after it’s been first requested. Then it keeps it in cache at the specific data center where the page was requested, but will fetch again from the origin if a request is made through other datacenters. Also, even pages already in cache may be purged from cache before the Edge Cache TTL you’ve set if it is not frequently requested.

@cbrandt Thanks for your reply. I will look into it. The websites didn’t have this problem prior to Cloudflare, so I thought the problem must have something to do with the settings of Cloudflare. The websites already have their own cache, which was implemented to speed up the website before we started using Cloudflare. I’ll ask my colleague if he can check the server for events like you described (I don’t know that much about servers). If I have more information about this issue, I’ll let you know.

Thank you for also explaining the cache issue.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.