We are planning to migrate a big project to cloudflare workers but we have a question regarding cost

We are evaluating compute platforms for a large-scale deployment and would like to confirm Cloudflare Workers pricing based on the following usage: 100 million requests per day (approximately 3 billion per month) Each request runs for approximately 50 milliseconds of CPU time Each request requires a public HTTP endpoint Approximate memory footprint per request: 128 MB (understood that Workers are billed by CPU time) Based on the published pricing model: $0.30 per 1 million requests $0.02 per 1 million CPU milliseconds Our internal estimate for Cloudflare Workers is: Request cost: 3,000 million × $0.30 = $900 CPU time cost: 150,000 million ms × $0.02 = $3,000 Total estimated monthly cost: $3,900 For comparison, the equivalent workload on AWS Lambda (128 MB, 100 ms duration) would cost: Request cost: 3,000 million × $0.20 = $600 Duration cost: 37.5 million GB-seconds × $0.0000166667 = ~$625 Total estimated monthly cost on AWS Lambda: ~$1,225 Could you please confirm whether the Cloudflare estimate is accurate and if there are any other factors we should consider at this level of usage? Thank you.
7 Replies
scotto
scottoOP4mo ago
it was a surprise to see AWS cheaper, are we doing something wrong in the math?
Chaika
Chaika4mo ago
50ms for each request would be pretty slow for Workers, did you bench mark your app or are you just going off the default?
scotto
scottoOP4mo ago
need to test that properlty and get a p95 ours APIs basically parse request and execute 1 or a few queries agains tursodb tested and normally is 10 ms still cost projection in cloudflare workers is 30 % more than AWS
Chaika
Chaika4mo ago
is it 10ms of duration or cpu time? if it's just a db proxy with retries I would doubt it takes that much, I have a Worker that uses Cloudflare's D1 DB just ingesting a bunch of results and returning errors/etc and it's ~1.1ms CPU time, pretty light. Time waiting on async i/o doesn't count towards cpu time. I don't know tooo much about Lambda's billing but my understanding is it is full duration/request time which is pretty different I think you're missing bandwidth as well in the aws calc, not sure if anything else. Cloudflare has an Enterprise tier with custom pricing for Workers but has a base fee (and paying for bandwidth used unlike normal Workers), I think your Workers pricing calculations make sense though
scotto
scottoOP4mo ago
thanks, need to investigate more if aws pricing is ok, i would prefer moving to cloudflare for several reasons, the 10 was from cloudflare dashboard that sais "Median CPU Time", not sure if there is a better way to get it
Chaika
Chaika4mo ago
the 10 was from cloudflare dashboard that sais "Median CPU Time", not sure if there is a better way to get it
As long as you have a few thousand representantive requests within the time frame, should be accurate enough if you only had a few could be skewed by fresh connections/etc but yea, there's def advantages to both platforms. AWS I believe lets you better pick the region to run in, CF has Smart Placement but it's way more loose, Turso is all on AWS now I believe so if you pick same region might be beneficial and matter less that CF bills for Cpu time vs duration, etc
scotto
scottoOP4mo ago
Good point, thanks

Did you find this page helpful?