Hacker News new | ask | show | jobs
by ZitchDog 2313 days ago
Kind of silly in a lambda though, as lambdas do not run concurrently. A bash script would suffice.
4 comments

Lambda for NodeJs doesn't / won't run multiple requests in the same process but different V8 contexts at the same time?

That sounds wasteful, and imo makes Cloudflare's Serverless tech superior for strictly network-io bound workloads. Lambda, to be fair, supports way many event triggers and all sorts of runtime and user-space constructs, but still manages warm start times <10ms which is really impressive.

Cloudflare uses V8 Isolates feature and they build a lot of the API backends to follow the WebWorker spec. It's very efficient and well-suited for logic running in network calls at the CDN edge but limited to Node/JS code. [1]

AWS Lambda uses their Firecracker micro-vm tech which supports more runtimes, environments and triggers than just Node and also runs container workloads. [2]

1. https://www.infoq.com/presentations/cloudflare-v8/

2. https://firecracker-microvm.github.io/

But you can still have concurrency while handling a single invocation.
I’m new at this, and would love feedback if I’m wrong, but I think that a lambda instance could be reused if the system had need. As a result the best practice is to closure global-like data in the handler function itself. This would then get passed down through the layers much like Golang’s context.
I have many that call a handful of backend services, handle errors, process the data, and send it to the client.

Very async.