5 ms·
What kinds of things are you wanting to do with more CPU time?
by geostyx 8y ago
What kinds of things are you wanting to do with more CPU time?
- davidjnelson 8y agoDatabase and third party api access were the use cases that initially came to mind.
- zbentley 8y agoDo you mean total runtime or actual CPU time? Total runtime would be affected by the use cases you mention; CPU time would not (or would not be affected nearly as much, at least). A function waiting on an HTTP response is not burning CPU.
- davidjnelson 8y agoInteresting, I thought they were measuring runtime when they said cpu time. AWS Lambda is priced on runtime so I figured it would work the same. Thanks for pointing this out. I re-read the article and it is indeed cpu time not runtime for Cloudflare Workers. Sweet! The part of the article that clarifies this: > This is not meant to be a referendum on AWS billing, but it’s worth a quick mention as the economics are interesting. Lambdas are billed based on how long they run for. That billing is rounded up to the nearest 100 milliseconds, meaning people are overpaying for an average of 50 milliseconds every execution. Worse, they bill you for the entire time the Lambda is running, even if it’s just waiting for an external request to complete. As external requests can take hundreds or thousands of ms, you can end up paying ridiculous amounts at scale. > Isolates have such a small memory footprint that we, at least, can afford to only bill you while your code is actually executing. > In our case, due to the lower overhead, Workers end up being around 3x cheaper per CPU-cycle. A Worker offering 50 milliseconds of CPU is $0.50 per million requests, the equivalent Lambda is $1.84 per million. I believe lowering costs by 3x is a strong enough motivator that it alone will motivate companies to make the switch to Isolate-based providers.
- elithrar 8y agoYep: 50ms CPU time is a lot. Network calls aren’t meaningful CPU time, which is why you can use Workers to call to third party APIs. You may want to be mindful of doing that during a user request as it now adds a dependency & latency, but it’s certainly possible to call out to a translation API or mapping API & cache the results...
- davidjnelson 8y ago> Network calls aren’t meaningful CPU time I understand how async io works. I'm used to AWS Lambda charging for request start to end time regardless of cpu usage.