4 ms·
I'm surprised Node has cold-start issues. I had it in my mind that JS was Lambda's "native" language and wouldn't have cold start issues at all. Did it used to
by losvedir 5y ago
I'm surprised Node has cold-start issues. I had it in my mind that JS was Lambda's "native" language and wouldn't have cold start issues at all. Did it used to be like that? Didn't Lambda launch with only support for JS, and maybe a couple other languages that could compile to it?
- yoava 5y agoWith node.js, the cold start problem is caused by how node loads files. For each file it does about 10 IO operations (to resolve the file from the module name), then load, parse and compile the file. If using any file system that is not super fast, this amounts to long delays. There are ways to get around that, but those are not available on lambda
- maxmcd 5y agoI thought nodejs/v8 or any javascript runtime would have some kind of startup cost since it has to parse and compile the javascript code first. See a simple hello world execution time comparison: # a Go hello world $ time ./hello hi real 0m0.002s $ time echo 'console.log("hello")' | node - hello real 0m0.039s The ~25ms of cold start noted in this article feels acceptable and impressive to me, given what node is doing under the hood.
- artimaeis 5y agoYeah, at launch Lambda only supported Node.js. https://web.archive.org/web/20141115183837/http://aws.amazon.com/lambda/faqs/ https://web.archive.org/web/20141115183837/http://aws.amazon...
- seniorsassycat 5y agoI wonder ho w much time was spent requiring all of aws-sdk. The v3 sdk is modular and should be quicker to load. Bundlers like rebuild save space and reduce parsing time.
- lukeramsden 5y agoDouble digit ms in my experience. Not including the fact that V2 will renegotiate TLS constantly when it could just keep the socket open.
- paxys 5y agoCold start has been a problem with Lambda since day 1, and in fact has massively improved in recent years. Node.js is optimized for request throughput rather than startup time. The assumption is that you will have a "hot" server running indefinitely. The Lambda pattern is in general a very recent invention, and not something that languages/rutimes have specifically considered in their design yet.