Best page-level cache option for live odds

We have thousands of pages that pull in live odds from an API, and while the rest of the site is loading OK (in terms of performance), these pages are extremely slow. I think we can solve some of the load issues with improved caching settings.

Here is one example URL https://usbettingreport.com/sports/baseball/mlb/

Any thoughts on what type of page-level caching we should have on these pages? Thanks in advance!

There’s really only one choice, and that would be “Cache Everything.” Anything else won’t apply because Cloudflare won’t cache HTML unless you set Cache Everything.

Next you’ll have to settle on an Edge Cache TTL. That depends on the maximum amount of time you want a page cached. And the lowest TTL you can set depends on your plan level:
Free - 2 hours
Pro - 1 hour
Business - 30 minutes
Enterprise - 1 second

Though you might be able to set cache-control at the server to override this.

This surprises me, though, since it looks like you already have an x-frontend-cache. Why isn’t that enough?

1 Like

Doing webpagetest.org page speed tests of that URL have 3+ seconds TTFB which is slow and bad and suggests poor origin server performance maybe even database server performance and/or just the origin is not performing well.

To fully optimise a site for performance and speed, you need to optimize 3 segments.

  1. segment 1 - connection between visitor and CF edge server i.e. CDN cache, WAF, Firewall, Page Rules, Mirage, Polish webP, HTTP/2, HTTP/3, CF Workers (i.e. custom/advanced caching) etc
  2. segment 2 - connection between CF edge server and your origin i.e. Argo, Railgun & Full SSL/ECDSA SSL certificates
  3. segment 3 - your origin server’s performance/optimisations i.e. web server, PHP, MySQL server optimisations and server hardware specs.

Cloudflare can only help for segments 1 & 2 for cached guest/non-logged based visitors. Now for Cloudflare CDN cache miss/bypass and logged in user for web apps like forums/wordpress performance or in your case non-cacheable pages due to frequency of updates, is determined by segment 3.

So dynamic pages’ performance could purely be due to segment 3 factors related to your origin server itself i.e. web server, php and/or mysql database performance which need optimizing and/or better hosting.

As @sdayman suggested, setting a lower TTL for Cloudflare CDN edge cache time might help sometimes, but it will still be slow for non-cached hits until you fix the origin server itself.

Thanks @sdayman for your quick response. I can’t tell you why x-frontend-cache is not enough (not even sure what it is to be honest)

Thanks @eva2000 for helping out. What do you recommend looking into at a server level? Shouldn’t issues with server performance be apparent on other pages like the blog posts? For reference, I just did a check with lighthouse on this post which got 100/100

depends on how the problematic pages data is compiled and served by the origin server

here’s WPT results WebPageTest Test Details - Virginia USA - E...orts/baseball/mlb/ - 09/27/21 00:40:48

Got it. The data is pulled from an external API once the page is called and the server settings are global so they should behave just like the standard WordPress pages and blogs. I thought that the actual connecting to the API is what is causing the loading issue but this problem started last week and we have had these pages up for longer than that. Maybe something changed with CloudFlare during that time?

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