News for hackers. Stuff that matters.
Re:AWS Lambda Web Adapter by johtso on Saturday June 22, 2024 @04:44PM (#40762042)
That's one thing that's really nice about Cloudflare workers, you're billed on CPU time, not duration, so you can happily make slow requests to other services.
Re:AWS Lambda Web Adapter by throwAGIway on Saturday June 22, 2024 @04:47PM (#40762074)
How does that work? How can they determine my execution time is spent waiting and not processing?
Re:AWS Lambda Web Adapter by CaliforniaKarl on Saturday June 22, 2024 @05:01PM (#40762183)
When a Linux process is waiting for a socket to have data ready to read (using a system call like select, poll, or epoll), that process is put into a sleep state by the kernel. It continues accruing “wall-clock time” (“wall time”) but stops accruing CPU time. When the kernel has data for the socket, the process starts running again.

The above tracking method works for containerized things. For virtualized things, it’s different: When a Linux system has nothing to do (all processes sleeping or waiting), the kernel puts the CPU to sleep. The kernel will eventually be woken by an interrupt from something, at which point things continue. In a virtualized environment, the hypervisor can measure how long the entire VM is running or sleeping.

Re:AWS Lambda Web Adapter by throwAGIway on Saturday June 22, 2024 @05:06PM (#40762212)
Thanks to you and the others who replied too, very insightful. You put me on the right track to learn more about this, much appreciated.
Re:AWS Lambda Web Adapter by btown on Saturday June 22, 2024 @09:45PM (#40763964)
Economically, Cloudflare can do this because they only need a V8 isolate per instance (so barely any RAM besides instantiated JS objects), whereas a Lambda needs RAM for the entire runtime environment. So many more customers can run on the same machine, even if many are waiting on I/O simultaneously.

https://blog.cloudflare.com/cloud-computing-without-containe...

Re:AWS Lambda Web Adapter by paulgb on Saturday June 22, 2024 @04:55PM (#40762138)
They use their own runtime for V8 isolates, so they have a lot of leeway into how they measure/meter it.
Re:AWS Lambda Web Adapter by navaati on Saturday June 22, 2024 @04:57PM (#40762154)
At the most basic level, your process is in the D or S states rather than R state. Cloudlflare workers are not exactly Unix processes, but the same concept applies.