4 ms·
> I think the hard limit CF imposes is of wall-clock time, not CPU time specifically. No, it's the other way around. The enforced limit is strictly on CPU time
by kentonv 5y ago
> I think the hard limit CF imposes is of wall-clock time, not CPU time specifically.
No, it's the other way around. The enforced limit is strictly on CPU time, not wall time. We use Linux's timer_create() with CLOCK_THREAD_CPUTIME_ID to set a timer that delivers a signal when a CPU time threshold is reached. The signal handler immediately terminates execution of JavaScript using V8's TerminateExecution() (which only terminates the specific isolate).
It sounds like your experience is from a system where each guest runs in their own process. Cloudflare Workers runs many guest isolates in a single process, therefore we cannot simply kill the process when one guest misbehaves. So, we have to do everything very differently from what a container host would do.
The line you quoted from the docs is about billing. The enforcement of limits, and the calculation of billing, are completely unrelated.
Here are some reference links if you want to understand more about how our platform is implemented:
https://www.infoq.com/presentations/cloudflare-v8/ https://www.infoq.com/presentations/cloudflare-v8/
https://blog.cloudflare.com/mitigating-spectre-and-other-security-threats-the-cloudflare-workers-security-model/ https://blog.cloudflare.com/mitigating-spectre-and-other-sec...
- tiffanyh 5y ago> "Cloudflare Workers runs many guest isolates in a single process, therefore we cannot simply kill the process when one guest misbehaves. So, we have to do everything very differently from what a container host would do." Does this imply that another guest Worker can impact/takedown my Worker due to their tasks misbehaving?
- kentonv 5y ago> Does this imply that another guest Worker can impact/takedown my Worker due to their tasks misbehaving? No, the system is designed to prevent that. Each guest runs in its own V8 isolate which we carefully control to prevent interference. (Of course, all software has bugs from time to time. But we consider it a security flaw if one worker can somehow disrupt other workers, and handle it accordingly.)
- tiffanyh 5y agoAwesome. Thanks so much. Any considersation to expanding the Worker use case to allow for more deployment of full-blown web apps to the edge?
- kentonv 5y agoOf course! Many people are deploying full-blown web apps on Workers today. We're constantly working on new features to fill in gaps so more types of apps can be built entirely on Workers. Durable Objects, cron triggers, increasing the time limit from 50ms to 30 seconds (and eventually 15 minutes), etc. are all part of this, and we have more coming.
- tiffanyh 5y agoAny talk of a SQL database offering? The KV is awesome but there are times when a relational database is a way better fit. E.g. I'd love to be able to deploy a full blown Elixir/Phoenix/Postgres app to Cloudflare Workers.