I was a bit surprised to see the billing spikes this month for CloudFlare Worker. As one of the "Free" API has a huge number of requests.
Everything comes at a price. The CloudFlare worker has the following pricing plans:
I contacted the CloudFlare's Technical/Billing Team, and they provide me the details of Usage:
And they added:
Workers Usage ReviewWe have reviewed your account records as well as the respective Workers charges linked to the usage period of 07/25/2022 - 08/24/2022.
When doing so, we are pulling the data for the usage period in a different system from the one that was used to collect data for invoice CFUSA5139857, which was issued on August 25th, 2022. We then pull the data and compare against the one on your invoice.
We consider what you have been invoiced correctly if:
The second data set shows the same usage amount as the data set you were invoiced for,
The second data set shows a usage amount that is slightly above the usage amount in the data set you were invoiced for,
The second data set shows a usage amount that is slightly below the usage amount in the data set you were invoiced for.
We consider that you have been invoiced incorrectly if:The second data set shows a usage amount that is a lot or more than just slightly above the usage amount in the data set you were invoiced for;
The second data set shows a usage amount that is a lot or more than just slightly below the usage amount in the data set you were invoiced for.
Result:The second data set shows the exact usage amount as the data set your invoice is based on.
Invoiced Usage Amount:106,342,195
Invoiced Usage Charge:$48.00Second Data Set Usage Amount:106,342,195
Second Date Set Usage Charge:$48.00
Then after an investigation - we can find out the number of requests and subsequent requests for the last 30 days for each worker, I have to disable the "Free-tier" of one of my API.
I even renamed the API so that no more surprise.
Avoid Billing Surprise of CloudFlare Worker
Unfortunately, CloudFlare does not provide a Usage Cap on Paid Worker Plan, but here are things we can do to avoid a billing surprise:
- Require Authentication e.g. Bearer Token, for your CloudFlare Worker
- Rate Limit Your CloudFlare Worker
- Disallow the Bots Access
- set up billing usage notification email to report when the number of requests exceeds a threshold.
- downgrade to Free Tier for free APIs. Free Tiers have a daily 100K requests and won't charge you if there is a spike. The APIs will get status code 1000+ to reflect the rate limited.
- avoid exposing the API endpoint unless you have to (providing public APIs)
--EOF (The Ultimate Computing & Technology Blog) --
Reposted to Blog: Cloudflare Unexpected High Usage of API Requests - How to Avoid Surprising Billing?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^
NEW! Following my Trail (Upvote or/and Downvote)
Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com
My contributions
- Video Downloader
- Steem Blockchain Tools
- Free Cryptos API
- VPS Database
- Computing Technology Blog
- A few useless tools
- And some other online software/tools
- Merge Files/Videos
- LOGO Turtle Programming Chrome Extension
- Teaching Kids Programming - Youtube Channel and All Contents
Delegation Service
Voting Power Considered in Voting Schema and Important Update of Delegation Service!
Support me
If you like my work, please:
- Buy Me a Coffee, Thanks!
- Become my Sponsor, Thanks!
- Voting for me:
https://steemit.com/~witnesses type in justyy and click VOTE
- Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
- Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
- Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses
Hi, @justyy,
Thank you for your contribution to the Blurt ecosystem.
Your post was picked for curation by @onchain-curator.
Please consider voting for our Upkeep Proposal by Symbionts.