Blog ·
A spending cap is only a safety net if you know what it switches offEen uitgavenlimiet is pas een vangnet als je weet wat er uitgaat
Cloudflare has introduced Spend Management, currently in beta for pay-as-you-go customers. It starts with Workers and Durable Objects. You set a spending limit, add alert thresholds, and when the limit is reached Cloudflare pauses the product. In their own words: informing is not the same as controlling. I agree with that.
I don't run on Workers myself, so this is me reading the announcement, not me reporting from experience. Keep that in mind.
Why a cap beats an alert
Usage-based pricing is fine until something goes wrong. A bot hammers your endpoint, a loop calls itself, a post goes viral at the wrong moment. For a freelancer the scary part is not only the money. It's the invoice you have to explain to a client who thought hosting cost a few euros a month.
An alert email only helps if you read it in time. A hard cap turns an open-ended risk into a number you picked yourself. The API example in the article uses a threshold of 10000 cents with the action `usage_block`. That's the kind of boring, explicit setting I like. You can also set several alert thresholds below the limit, and there's an audit log that shows who changed a limit and when.
What "paused" actually means
This is the part I'd read twice. Once a cap is enforced, new invocations of that product are rejected. Cloudflare says it only pauses customer-code invocations that incur costs. In Workers, Cron Triggers and Queue consumers are paused, but static assets keep being served.
So it depends on what your site is:
- A mostly static site probably stays up, because the static files still get served.
- A site where a Worker handles a contact form, a checkout or an order sync stops doing those things.
- Scheduled jobs, like sending mails or syncing stock, simply stop.
The article doesn't say what a visitor sees when a Worker call gets rejected. I'd want to know that before I count on the cap. A shop that is half up is sometimes worse than a shop that is clearly down.
Then there's getting back online. You can raise the limit, disable or delete the policy, or wait for the next billing cycle. That cycle starts when the paid subscription begins, not on the first of the month. If your cycle started on the 10th, a block could last until the 10th of next month. If nobody reads the alert at night, the site stays paused until someone acts.
That is a real trade-off: a bill you didn't want against downtime you didn't want. Which is worse depends on the business. It's a decision for the owner, not something I should make silently for a client.
Also, the cap isn't instant. Spend shows up in the dashboard in near real time, which Cloudflare puts at under 10 minutes. Enforcement is asynchronous: the cap is pushed out to the network and the runtime picks it up on a periodic refresh. Cloudflare says it wants to shorten that gap. For now, treat the cap as a guardrail, not a wall that stops exactly at the cent. Set it below the amount that would really hurt, not at it.
What I would do
If I had a client on a usage-based platform, I'd do this:
- Set a cap and a few alert thresholds below it, to an address that someone actually reads.
- Write down which parts of the site stop when the cap triggers: forms, checkout, cron jobs, anything that calls a Worker.
- Ask the client which they would rather have, a surprise bill or a paused site, and put the answer in writing.
- If it's cheap to do, test it on a throwaway project with a very low limit and see what visitors get.
I haven't done step 4 on Cloudflare, so I can't tell you how it behaves in practice. It's a beta, and the first products are only the start.
I'll add one personal note. On my own servers in Germany, the worst case is usually a slow site, not a surprise bill. That's a trade-off I chose, not a rule, and it has its own work attached. But it does make me appreciate a feature that tries to put a ceiling on the unknown. Just make sure you know what the ceiling is made of.
Cloudflare heeft Spend Management aangekondigd, nu in beta voor pay-as-you-go-klanten. Het begint met Workers en Durable Objects. Je stelt een limiet in, voegt waarschuwingsdrempels toe, en als de limiet bereikt is pauzeert Cloudflare het product. In hun eigen woorden: informeren is niet hetzelfde als controleren. Daar ben ik het mee eens.
Ik draai zelf niet op Workers, dus dit is mijn lezing van de aankondiging, geen ervaringsverhaal. Houd dat in je achterhoofd.
Waarom een limiet beter is dan een melding
Usage-based prijzen zijn prima, tot er iets misgaat. Een bot hamert op je endpoint, een loop roept zichzelf aan, een bericht wordt op het verkeerde moment viraal. Voor een freelancer is niet alleen het geld het probleem. Het is de factuur die je moet uitleggen aan een klant die dacht dat hosting een paar euro per maand kostte.
Een mailtje helpt alleen als je het op tijd leest. Een harde limiet maakt van een open risico een bedrag dat je zelf hebt gekozen. Het API-voorbeeld in het artikel gebruikt een drempel van 10000 cent met de actie `usage_block`. Dat is het soort saaie, expliciete instelling dat ik prettig vind. Je kunt daarnaast meerdere waarschuwingsdrempels onder de limiet zetten, en er is een auditlog waarin je ziet wie wanneer een limiet heeft aangepast.
Wat "gepauzeerd" echt betekent
Dit deel zou ik twee keer lezen. Zodra een limiet actief is, worden nieuwe aanroepen van dat product geweigerd. Cloudflare zegt dat alleen aanroepen van klantcode die kosten veroorzaken worden gepauzeerd. Bij Workers staan Cron Triggers en Queue-consumers dan stil, maar statische bestanden blijven gewoon uitgeleverd worden.
Wat dat voor jou betekent, hangt af van je site:
- Een grotendeels statische site blijft waarschijnlijk online, want de statische bestanden worden nog steeds geserveerd.
- Een site waar een Worker het contactformulier, de checkout of een bestelsync afhandelt, doet die dingen niet meer.
- Geplande taken, zoals mails versturen of voorraad synchroniseren, stoppen gewoon.
Wat een bezoeker te zien krijgt als een Worker-aanroep wordt geweigerd, staat niet in het artikel. Dat zou ik willen weten voordat ik op de limiet reken. Een webshop die half werkt is soms erger dan een shop die duidelijk offline is.
Dan het weer online komen. Je kunt de limiet verhogen, de policy uitzetten of verwijderen, of wachten op de volgende factuurperiode. Die periode begint op het moment dat het betaalde abonnement start, niet op de eerste van de maand. Begon jouw periode op de 10e, dan kan een blokkade duren tot de 10e van de volgende maand. Als 's nachts niemand de melding leest, blijft de site gepauzeerd tot iemand ingrijpt.
Dat is een echte afweging: een rekening die je niet wilde tegenover downtime die je niet wilde. Wat erger is, hangt af van het bedrijf. Dat is een keuze voor de eigenaar, niet iets wat ik stilzwijgend voor een klant moet beslissen.
De limiet werkt ook niet direct. Het verbruik staat bijna realtime in het dashboard, volgens Cloudflare binnen 10 minuten. De handhaving gebeurt asynchroon: de limiet wordt over het netwerk verspreid en de runtime pikt hem op bij een periodieke refresh. Cloudflare zegt dat het die vertraging wil verkleinen. Zie de limiet voorlopig als vangrail, niet als muur die tot op de cent stopt. Zet hem onder het bedrag dat echt pijn doet, niet precies erop.
Wat ik zou doen
Had ik een klant op een usage-based platform, dan deed ik dit:
- Stel een limiet in met een paar waarschuwingsdrempels eronder, naar een adres dat echt gelezen wordt.
- Schrijf op wat er stopt als de limiet afgaat: formulieren, checkout, cronjobs, alles wat een Worker aanroept.
- Vraag de klant wat hij liever heeft, een onverwachte rekening of een gepauzeerde site, en leg het antwoord vast.
- Is het goedkoop te doen, test het dan op een wegwerpproject met een heel lage limiet en kijk wat bezoekers te zien krijgen.
Stap 4 heb ik bij Cloudflare nog niet gedaan, dus ik kan je niet vertellen hoe het in de praktijk uitpakt. Het is een beta, en de eerste producten zijn pas het begin.
Nog een persoonlijke noot. Op mijn eigen servers in Duitsland is het slechtste scenario meestal een trage site, geen verrassingsrekening. Dat is een afweging die ik heb gekozen, geen regel, en er hangt eigen werk aan vast. Maar ik waardeer wel een functie die een plafond probeert te zetten op het onbekende. Zorg alleen dat je weet waar dat plafond van gemaakt is.
SourceBron Introducing Spend Management: Spending limits and alerts for Cloudflare
Written with AI from my own views and notes, and checked by me before it went live.Geschreven met AI op basis van mijn eigen standpunten, en door mij nagelezen voordat hij online ging.