How to prevent multiple requests from being proxied to the origin server before 1st request cache?
Hello, I found that our client will burst multiple request of same file path which can cache for a year, but my problem is when burst request like 130 requests to my origin. That my origin need to process and prepare 130 times of these requests.
How to group or somehow delay another 129 requests and let just 1 request to reach my origin before serve another 129 requests from cloudflare cache?
8 Replies
Those client came from single client which connect to single Edge cloudflare server.
could use a worker for this, cf wrote a blog on preventing cache stampedes:
https://blog.cloudflare.com/sometimes-i-cache/
wow, thank you so much. I will learn it.
I'm finished with that blog.
While in the blog suggest the way revalidate content without shared lock logic. but in my case is for the freshness cache, let's say www.example.com/file.pdf is never in the cache before, and 10 of client from the same Edge server (of cloudflare) try to download this file from the same time, How to prevent those of 10 requests goes to my origin and allow only 1 request?
I found the similar problem on here https://developers.cloudflare.com/cache/concepts/revalidation/#example-2
but I don't know how to enable this feature.
Cloudflare Docs
Revalidation and request collapsing · Cloudflare Cache (CDN) docs
Revalidation is a caching mechanism that involves checking the freshness of cached data before serving it to a client or user. If a cached object is no longer fresh and Cloudflare receives a request for it, a request is made to the origin to revalidate the object in the Cloudflare cache.
It's on by default, just needs to a cachable asset
Yes, that content is cachable but from my picture. My content got multiple 130 requests from same time and tell me those 130 requests got MISS. After that this content got cache. I want to avoid 129 requests reach my origin, How to avoid it?
Anyone have more idea about this issue? I can't fix it.
fyi; I use enterprise plan, but support can't tell me the solid solution to prevent this problem.
probably because cache lock should just simply work as long as it is
- A cachable asset
- requests to the same colo
is the zone you're testing on also enterprise? would exclude you from some of the tests they're currently running
@Chaika Yes, this zone is enterprise plan for more than 3yrs.
1. Yes that cacheable asset and I set page rule to hint cloudflare as "Browser Cache TTL: 6 months, Cache Level: Cache Everything, Edge Cache TTL: 2419200 seconds, Cache TTL by status code"
2. Yes same colo because this came from 1ip address of user as well.
I try to open support case to consult this, but they didn't give the correct information about this problem.