What is the best strategy to control worker scaling?

There are many great things about Cloudflare as a platform when you have paid account. Also, everything is limit guarded and counted towards your bill, except worker scaling. That has no limit, afaik. What is the best approach on $5 paid tier to avoid an unpleasant morning surprise? Besides ddos or other script kiddies trying to temper with the API, there could be also a dev mistake in a form of a recursive call anywhere in the stack (we've seen even the best are not immune to this). I'm aware there are some notifications but I don't want to be in constant FOMO waiting for those and it could be late when they come.
4 Replies
Daniel Rivas
Daniel Rivas2w ago
Hello, I'm Daniel with the Workers D&C (Deploy and Config) team. For paid users you can configure the CPU time a Worker consumes (and hence, how much you get billed).
Daniel Rivas
Daniel Rivas2w ago
Cloudflare Docs
Limits
Cloudflare Workers plan and platform limits.
Gab
Gab2w ago
also, if your are using cloudflare queues, you can set max_concurrency flag to limit your consumers,
{
"$schema": "./node_modules/wrangler/config-schema.json",
"queues": {
"consumers": [
{
"queue": "my-queue",
"max_concurrency": 1
}
]
}
}
{
"$schema": "./node_modules/wrangler/config-schema.json",
"queues": {
"consumers": [
{
"queue": "my-queue",
"max_concurrency": 1
}
]
}
}
pinky
pinkyOP2w ago
Thanks for the hint but is not this per request? So if I make an infinite recursive call towards my API or page goes viral (a good problem to have but just as an example here), this would not help with billing because more workers would spawn to handle all those short requests?

Did you find this page helpful?