Workers vs Cloud Functions costs?

I was comparing costs between the services and it seems Cloudflare workers is a lot cheaper.

Cloud functions:

Memory: 256MB CPU: 200Mhz
Execution time: 4000ms (Our estimated request time towards third party API)
Bandwidth: 3kb (equals 3 request payloads in our worst use-case)
Invocations: 10 million
Scripts: Unlimited

Cost: 663$

Cloudflare workers:

Memory: 256MB CPU: ?
Execution time: 15 000ms max
Bandwidth: Unlimited
Invocations: 10 million
Scripts: Unlimited (1 per domain)

Cost: 200$

EDIT: Nevermind, Cloud functions actually meassure the WHOLE execution time, not CPU time - so in this case Cloudflare workers offer 15 seconds! I’ve updated the numbers above to reflect this.

Thinking about this even more, Cloud Function containers can take seconds to boot up! This means that the estimated 4000ms above can potentially be several times larger.


Question though: Does internal traffic count? Let’s say i setup two scripts and i make requests between them - does that count as requests too, even between edge-servers? (This is free on Cloud Functions, Amazon and OpenWhisk)

1 Like

They are different things though, one is a full Node.js environment, the other is a V8 JS Engine…

Both run JS so to those implementing functionality - costs, performance and development time matters.

Cloudflare provides the best performance and the lowest costs, although, development costs might be higher due to not being able to use many node.js specific packages.

But that’s not clear cut either, Cloudflares engine implement more modern features than node.js do, like almost the full Web API spec - making it possible to build more efficient apps than using bloated node.js packages (One of the most common packages “request” is 1MB packed!) which can be exchanged by the native fetch API.

1 Like

You can only have one worker script, unless you are on the Enterprise plan.

You can have as many as you want, but you’ll have to add a new domain for each script.

1 Like

Yeah, but that becomes a little impractical. As for requests between scripts I would assume almost at 100% certainty that they count towards your billing.

It certainly is impractical for big apps, so is the 1MB script limit. So it’s not for every use-case.

I’m waiting for an official answer, I’m thinking, maybe we can call it like “localhost” or something and it won’t count.

Thanks for the detailed comparison! You do get charged for every execution of your Worker, whether it’s being requested from another Worker or the public internet.

In general the economics of Workers is 3-10x cheaper than other Cloud function providers. It can be even more dramatic when you include all the things they charge you for (like bandwidth) which are included with Cloudflare.


Yeah, I noticed that even 1MB (Basically a single image) of bandwidth per request would raise the above example from 663$ to 1356$. That’s an insane difference compared to Cloudflare Workers! Guess they have to earn their revenue somehow.

Just to help with those landing here from Google. The memory limit for workers are 128MB according to the Resource Limits page.

I believe I’ve seen that 256MB is allocated when on the 200$ plan?

Maybe CF can chip in?

I knew of only the change in CPU time upgrading the plan level…

Hey @thomas4
How did you arrive at the $200, any breakdown? Doesn’t Cloudflare charge per invocation and not CPU time? 10M invocations are about $5 on the .50 per million invocations pricing. :thinking:

He is mentioning an increase in RAM on a Business Plan, which wasn’t true at the time. Now the pricing structure is different, there is the free tier of 100k reqs/day, 1000/10 minutes and the unlimited one with the pricing you mentioned.