Pricing Image Resizing Requests
My nextjs-on-pages project is using R2 to store images and Image Resizing urls to serve images. The resized image responses have the following headers. But my project is showing a lot of Image Resizing requests under the billable usage panel - around 3 million requests month to date with around 30k original R2 images being resized.
Are these requests billable as per $9 every 50k requests? Confused if I did anything wrong with the setup, as I would expect these to be non-billable requests as the images should be cached for all resized images
8 Replies
^ Seems like there's lots of cache misses at the /cdn-cgi/image/ urls
Image Resizing should only bill for cache misses:
https://developers.cloudflare.com/images/faq/
Image Resizing - Cloudflare charges when there are cache misses, and for some request errors.If you have any exact questions about your bill/if you think you're being charged too much you should ticket billing. The Cache Misses and such making IR pricing unpredictable is why they made new image pricing based on unique transformations: https://blog.cloudflare.com/merging-images-and-image-resizing/, but it's been delayed launch due to the CF issues earlier this month
FAQ · Cloudflare Image Optimization docs
Below you will find answers to our most commonly asked questions regarding Cloudflare Image Optimization, namely the differences between Cloudflare …
Ah yeah I think the billing should be accurate after accounting for the cache misses. Are cache misses a problem with image resizing, even if all developer end configuration to avoid cache misses is correct? It seems weird that the same image is cached sometimes and missed other times
It seems weird that the same image is cached sometimes and missed other timesThat's just cache for you. I think Image Resizing is just limited to the per Cloudflare colo(cation)/datacenter cache, no tiered cache or cache reserve, and there's 350+ CF Locations with some 500+ colos/DCs (so 500 unique caches), and you may be getting evicted early based on access frequency (and access frequency is per colo) Some people resize images when they come in, and then store the resized variants in R2. Your way of doing things would greatly benefit by the new Image Resizing pricing, if only it was out. That's unique transforms counted globally per month Edit: It looks like Image Resizing does use Tiered Cache by default, which should be helping a bit: https://discord.com/channels/595317990191398933/973591562615390228/989517389865553960. I guess you just have a lot of unique transformations which aren't accessed too frequently? If you've got ~1.6 million image requests and the top pathes are only ~12k uses each, it seems like your resize options are bit too dynamic/varied
Oh got it, I guess I was confused at how the cache worked. Thanks for the explanation! I could try reducing the number of resizes used in the app to reduce cache misses then? 🤔
Is below the new image resizing product described in the blog post? Looks like it might be out?
Hm nvm, I guess its not out https://community.cloudflare.com/t/merging-cloudflare-images-and-image-resizing/582124/5?u=chaika
It is out now btw can upgrade here: https://dash.cloudflare.com/?to=/:account/images/delivery-zones