Anyone else's cache purge taking forever on Cloudflare lately?

jen_93

Member
Messages
62
Reaction score
0
Location
Cape Town, ZA

Not sure if it's just me but Cloudflare purge by URL has been dragging for the past week or so. I'm talking 30-40 seconds before the edge actually serves the new version. Used to be near instant.

I run a deals site with a pretty aggressive cache TTL (7 days on most assets, shorter on the homepage since it changes hourly). Normally when I push a price update I just purge the specific URL and boom, done. This week I've had to purge twice, sometimes three times, and even then I catch a stale copy on some edge nodes. My origin is on a VPS in Frankfurt, and I'm seeing it worst on the US West and Singapore POPs.

Checked my origin response headers, everything looks normal. Cache-Control is right, no weird Vary headers sneaking in. So I don't think it's me. Tried switching to purge by cache tag as a workaround and that seems a bit snappier but not by much.

Anyone else noticing this? Or did I just get unlucky with a bad week? Starting to wonder if it's worth setting up a secondary purger through the API and just throwing volume at it, but that feels like treating the symptom.

da_real_mvp

New Member
Messages
69
Reaction score
0
Location
Atlanta, GA

30-40 seconds is not you being unlucky, something is actually broken. Purge propagation across POPs is normally sub-5s in my experience, and the only times I've seen it drag past 10 was during an actual incident (keep an eye on the status page, there have been a couple of rough windows lately).

But before you go build a secondary purger, how are you actually measuring this? That's the part that bites people. If you're curling from your laptop you're only ever hitting one or two POPs, and what looks like "purge is slow" can really be "this POP is slow to revalidate from my origin." Frankfurt to Singapore is a long haul, and if your VPS has a sluggish afternoon, the fetch AFTER the purge is what's dragging, not the purge itself.

Things I'd check before blaming Cloudflare:

  • cf-cache-status on the slow responses. If you're seeing REVALIDATED or EXPIRED right after a purge instead of MISS, that's a different problem than a stale HIT.
  • The Age header. It tells you how long that object has been sitting in that specific POP. If Age is tiny but the content is old, the POP did re-fetch and your origin handed it something stale. Upstream proxy? opcache? nginx microcache in front of the app?
  • Whether anything in your Cache-Control has stale-while-revalidate. If that's set, the edge will happily serve the old copy while it fetches the new one in the background, which looks EXACTLY like a purge that didn't take. Took me embarrassingly long to figure that one out on a project a while back.

Also, purge by cache tag is Enterprise only. If that's your plan tier, just open a ticket and make them dig into it, that's literally what you're paying for. Throwing API volume at it is just treating the symptom, and if the purge pipeline is degraded you'll be spamming a queue that's already backed up.

What plan are you on?

danielp77

New Member
Messages
51
Reaction score
0
Location
Melbourne, AU

Yeah the Age header check is the one. Anyone who's chased this before knows Age is the lie detector. Tiny Age + stale content = your origin handed out the old copy, and that's on the VPS, not on Cloudflare.

But here's the thing that actually jumps out at me: purge by tag being snappier. If the purge mechanism itself were backed up, both paths would drag equally. They don't. That tells me the URL purge request is going through fine and your POPs are re-fetching, they're just getting bad bytes back. So @OP, before you build a secondary purger (please don't, that's just buying more lottery tickets), go correlate timestamps. Dump the purge API response time to a log, then grep your origin access log for requests from CF in the following 60 seconds. If the re-fetch lands 2 seconds after the purge and returns a 200 with the OLD price, congrats, it's your VPS or whatever sits in front of it.

One thing nobody's mentioned: are you running any page cache or object cache on the origin itself? OPcache is fine, but if there's a Redis full-page cache or a plugin-level cache on the deals site, purging CF just makes CF ask your origin for a fresh copy of something the origin itself considers fresh for another 10 minutes. I've been bitten by exactly this. The double and triple purge pattern is a classic symptom, because by the third request some internal TTL finally expires and the origin coughs up the new version.

Also, what's the origin response time on those Singapore re-fetches? If your Frankfurt VPS is doing a full uncached page render in 12 seconds, a couple of retries plus queueing gets you to 30-40 real quick. Have you tried hitting the origin directly with a cache-buster from a Singapore-located box? That'd separate "slow render" from "slow purge" in about two minutes.

LisaW_

New Member
Messages
53
Reaction score
0
Location
Edinburgh, UK

Ok so danielp77's question at the end is the one I'd chase first. I had almost the exact same thing on a much smaller site (WooCommerce, not a deals site) and burned two days blaming Cloudflare before realising my host had a page cache plugin quietly serving the old price. Purged CF, CF did its job and re-fetched, origin handed back the cached copy. Tiny Age, stale content. Exactly what da_real_mvp described.

So, do you have any object cache or full page cache running on that VPS? Redis, Memcached, a plugin, anything? Because if something on the origin is holding the old bytes, the purge never reaches the stale thing, and no amount of purging twice will fix it.

Also how are you testing Singapore? Real node or just a VPN? Not sure that matters but I'm curious.

bananapeel42

New Member
Messages
53
Reaction score
0
Location
Manchester, UK

Not sure I buy the tag-vs-URL logic, tbh. danielp77's whole argument rests on tag purge and URL purge sharing the same propagation path, and I don't think that's safe to assume. Tag purge gets resolved at the POP against a tag index, URL purge is a keyed lookup against the cache object itself. Different machinery, different code paths. A snappier tag purge only proves tag purges are snappier. It doesn't prove the URL purge is healthy or that the re-fetch is the bottleneck. That's a hole in the diagnosis big enough to drive a truck through.

That said, the Age header check is still the right move. I'm not arguing against that.

But there's a third possibility nobody's floated: the origin is fine, the POP is fine, and the invalidation event itself is landing late on some POPs. I've seen that before on a smaller setup. Purge API returns 200 in under a second, correctly, and then some POPs just sit on the old object for 20-40s before the invalidation actually reaches them. Nothing on your side is wrong. You just can't see it from the API response, which is why people chase their origin for a week.

@OP, when you did the purge-by-tag test, did you're actually see the new content show up faster on the slow POPs, or did it just feel faster? Those are different things and I've been burned by that distinction before.

marcus1987

New Member
Messages
66
Reaction score
0
Location
Sydney, NSW

bananapeel42's tag-vs-URL thing is a fair point but honestly it's a side quest. The Age header is where the actual answer lives, like danielp77 and LisaW_ already said. If Age is tiny and the content is old, Cloudflare did its job and something behind it handed back garbage.

What nobody's asked yet though: is your VPS even the thing CF is talking to? I've run a couple sites off cheap offshore VPS providers (paid in crypto obviously, because I'm not giving a Canadian card processor my business) and more than one of them quietly funnels your traffic through their own nginx cache or a transparent proxy before it reaches your box. So you purge CF, CF re-fetches, and the stale bytes come from your host's edge, not your app. Host will swear blind there's nothing in front of you. Took me ages to catch it.

Quick test: hit your origin directly by IP with a Host header, skip Cloudflare entirely. If the price is already stale there, it was never CF's problem. Also check the origin response for X-Cache or Via headers, some of those budget hosts leak them and don't even realise.

LisaW_'s question still stands too. Any Redis or full page cache on that VPS?

mike_t_2019

Member
Messages
60
Reaction score
0
Location
Leeds, UK

bananapeel42's right that the tag vs URL comparison proves nothing on its own. Different code paths, and I've watched tag purges go snappy while URL purges sat on their hands for half a minute. So the "therefore your origin must be the problem" leap this thread keeps making is built on sand, even if the Age header check is still worth doing.

But marcus1987 is the one who actually nailed it. I run a couple small sites off a host in Panama that I pay in ETH (not handing a Canadian card processor my business for a VPS, been burned enough), and they had a transparent nginx layer in front of my box that I never signed up for. Purged CF, CF re-fetched like a champ, got stale bytes back anyway. Three days of my life gone. Only caught it when I hit the origin by IP with a Host header and the old price was just sitting there grinning at me. X-Cache header eventually gave it up.

So OP, before you go build anything, do the direct-to-IP test. If it's stale there, none of the Cloudflare side of this matters and a secondary purger is just an evening you'll never get back.

mike_t_2019

Member
Messages
60
Reaction score
0
Location
Leeds, UK

One thing nobody's touched yet: Tiered Cache. If OP has that enabled (or it got silently enabled on the zone), the purge has to propagate through the upper tier before the edge POPs ever see the invalidation. That's an extra hop, and 20-40s is exactly the window you'd see when the upper tier is the one hanging onto the old object. Not your VPS. Not the POP you're testing from. The tier in the middle that you can't see from a curl.

Worth checking under Caching > Tiered Cache in the dashboard. If it's on, kill it for a week and see if the lag evaporates. Argo's the same story, it adds a layer that has to invalidate too.

Also, what plan is the zone on? Free and Pro don't get the same purge propagation priority no matter what the docs imply. I've had a free-plan site lag 30s+ on a purge while a paid zone on the same account was basically instant. CF will never say that part out loud.

I'm not dunking on the direct-to-IP test, that's still the right first move and marcus1987's call on it is solid. But if the origin comes back clean and Age is tiny, tiered cache is the next rock I'd turn over. There's some chatter about CF zone configs over in the domain section if you want more angles on it.

https://websiteforums.info/forums/domain-names-and-dns.2/

FrostyBear

New Member
Messages
67
Reaction score
0
Location
Brisbane, AU

Wait, Tiered Cache can just turn itself on? Just checked my dashboard and mine's enabled. I've had this zone up for like 3 months and I genuinely don't remember touching that setting. Now I'm paranoid.

@marcus1987 how do you actually run the direct-to-IP test? Is that a curl thing with a Host header, or can I just do it in a browser? I want to try it before I go blaming CF for anything but I'll probably mess it up.

And is Tiered Cache meant to be good or bad? Everything I read says it's a speed feature, but mike_t_2019 is making it sound like a landmine. Do most people here run it on or off?

w0lfpack88

New Member
Messages
72
Reaction score
0
Location
Oslo, NO

Tiered Cache isn't the landmine people are making it out to be, it's just a tradeoff nobody spells out. Your setup is basically the poster child for it, Frankfurt origin feeding US West and Singapore, so the upper tier is doing real work there. Edge POPs pull from a nearby tier instead of dragging bytes halfway across the planet. That's the speed win. The cost is that every purge now has one more layer to crawl through before the edge even hears about it. Faster cold fetches, slower invalidations. Whether that trade works depends on how often you're purging vs how often you eat cold misses, and for a deals site hammering price updates all day you're probably on the wrong side of it. I'd leave it on for a brochure site and kill it for anything with hourly price churn.

FrostyBear, browser won't do the direct test. Your domain resolves to CF's IPs so you'll just hit the edge again and learn nothing. You want curl against the origin IP with a Host header:

curl -sI https://1.2.3.4/ -H 'Host: yourdomain.com'

Swap in your VPS IP. If the old price is sitting there grinning at you, CF was never the problem. Also eyeball the response for X-Cache or Via while you're in there, marcus1987 nailed it, those budget hosts leak them constantly.

On the plan tier thing, mike_t_2019 is right and it annoys me. I run two zones on the same account, one free one Pro, same origin, near identical config. Pro purges in a couple seconds. Free one drags 20-30s on the bad POPs like clockwork. Nobody at CF will ever say that out loud but you can time it yourself in an afternoon.

You must log in or register to reply here.