Earlier quoted context omitted.
I did try and it just stalls, taking down my CPU with it. I had moved onto other tasks and found it later still killing a few cores. It's in a monorepo with maybe 3000 files. I have no trust in the project.
Yeah I understand the frustration, I had issues setting up ESLint/Prettier years ago and spent a few hours getting the Biome configuration right. Also a monorepo with ~4000 TS/TSX files. If you ever feel like trying it again, make sure that you have "files.maxSize" and "files.ignoreUnknown" set. And be very careful with the "files.includes" list.
Eliminating JavaScript cold starts on AWS Lambda
61–70 of 72 posts
Re: Eliminating JavaScript cold starts on AWS Lambda
#62No big corporate will ever use this, they'd be too worried about the compiler being compromised in some way. Llrt will never go primetime either, so we're stuck with the full Node runtime for a while.
Re: Eliminating JavaScript cold starts on AWS Lambda
#63I really don't struggle that much with cold starts on Node.js/Lambda, and I don't do anything special, my build commands look like: esbuild src/handler.ts --bundle --external:@aws-lambda-powertools --external:@aws-sdk --minify --outfile=dist/handler.js --platform=node --sourcemap --target=es2022 --tree-shaking=true Maybe I'm not doing as much as others in my functions and I tend to stick within the AWS ecosystem, so…
Re: Eliminating JavaScript cold starts on AWS Lambda
#64Awesome work, but I am genuinely curios about the use cases where the 200ms init time being a problem?
Maybe its a problem when you’re paying 200ms per small request and you have millions of them ?
When a lambda is invocated, that docker container isn’t immediately destroyed. It’s kept around for reuse.
So there isn’t a realistic scenario where you would get a million cold starts in a month.
Re: Eliminating JavaScript cold starts on AWS Lambda
#65Re: Eliminating JavaScript cold starts on AWS Lambda
#66Earlier quoted context omitted.
Serverless implementations where lambdas are being used for APIs so +200ms on a single call is not good.
It's not 200ms per call. It's 200ms cold start. Once a lambda is started, you don't pay that cost again. In most cases, you pay this a few times after a deployment or when traffic is increasing and not again.
This is now how lambda works. A lambda instance sticks around for 10s of minutes at most. So you'll have cold starts every day no matter how often you deploy.
If you have very little traffic you might actually have cold starts often as the lifetime of a lambda is determined based on its use.
Unfortunately AWS has always been rather unspecific about this behavior but here's a link to a pluralsight blog https://www.pluralsight.com/resources/blog/cloud/how-long-do...
Re: Eliminating JavaScript cold starts on AWS Lambda
#67Tl;dr Use an experimental (as in, 60% of ECMA tests passing, "currently no good I/O or Node compat") AOT compiler for JS. You remove the cold start by removing the runtime, at the cost of maybe your JavaScript working and not having a garbage collector.
It might be reasonable to go without a garbage collector if your whole lifetime is so short. GC by decapitation. Kinda clever. But other than that it's impossible to assess performance with such a tiny toy.
That isn't how lambda works. A single lambda instance can run for 10s of minutes handling thousands or requests. So not cleaning up memory sounds like a problem to me since you're billed by the GB/second
Re: Eliminating JavaScript cold starts on AWS Lambda
#68Earlier quoted context omitted.
Web workers don't share memory (other than SAB) with the main thread, they are far from traditional threads. These APIs are designed the way they are to protect end users, stop sites from consuming resources or bad code blocking the main thread. None of that is needed to be that way on the server. There is zero reason that a JS implementation cannot implement proper threads within the same memory space. The issue is…
NodeJS has worker threads[0] already [0]: https://nodejs.org/docs/latest/api/worker_threads.html
Re: Eliminating JavaScript cold starts on AWS Lambda
#69- Cold starts are kinda rare, sure it sucks that your request takes 600ms, but that means you are the first user. If you would've been served by a container that was just scaled up, you'd have been waiting for much longer
- Microservices and AWS lambda are inherently stateless, and do a ton of things to make themselves useful - get credentials, establish db connections, query configuration endpoints, all of which take time, usually more than your runtime spends booting up.
As much as I like lambdas for their deployment and operational simplicity, if you want the best UX, they have inherent technical limitations which make them the wrong choice.