Domdhi logoDOMDHI.OS
BACK_TO_COURSE

What a Worker Is, and What It Can't Do

Know the Walls Before You Design

The Limits Decide the Design

It's easy to design a Worker like a regular server and hit a wall later. These are the walls, straight from Cloudflare's limits page (checked November 29, 2026):

Limit Free Paid ($5/month minimum)
Requests 100,000 per day No limit (10 million a month included)
CPU time per request 10 ms 30 seconds, up to 5 minutes if you raise it
Memory 128 MB 128 MB
Calls out to other services, per request 50 10,000
Cron triggers per account 5 1,000

CPU time is thinking time, not waiting time. Waiting two seconds for a database costs you almost nothing. Resizing a photo in code can blow the free limit instantly.

What a Worker Can't Do

  • Keep files on disk. /tmp exists, but it's in memory and it's gone when the request ends.
  • Remember things reliably. One copy may serve many people at once, and it can disappear any time. A variable at the top of the file can leak one person's data to the next person. That's a security bug, not a style issue.
  • Hold huge files in memory. 128 MB is shared by every request that copy is serving. Big files get streamed through, not loaded.
  • Keep working forever after it answers. ctx.waitUntil() buys you up to 30 seconds. Past that, use a queue.
WARNING

AI often repeats numbers from old pages. Worker size is a good example: older material says 10 MB compressed on paid. Today's page says 64 MiB uncompressed on both plans. Make it look the number up and hand you the link. This table will go stale too.

What It Costs

Paid is $5 a month for the account, not per app. After the included amounts it's $0.30 per extra million requests and $0.02 per extra million CPU milliseconds (30 million included). Bandwidth is free.

Say you get 10 million requests a month at 7 ms each. That's 70 million CPU ms, 40 million over, so 80 cents. Total: $5.80. For most small apps the hosting bill is not your problem.

QUIZ

A Worker waits 3 seconds for a slow API and then does 5 ms of work. About how much CPU time did it use?

Sign in to track lesson progress and earn a certificate.SIGN IN TO SAVE PROGRESS