6 ms·
AWS Lambda Cold Start Language Comparisons
- sieabahlpark 7y agoOf course js is the fastest. It's built to be cold started in the browser.
- tomComb 7y agoTheir Node runtime (based on 8.x) is now the fastest, but I note that Node 12 includes the version of v8 that supports snapshots. Node 12 goes LTE next month and from what I understand, once snapshots could give Node another significant start-up speed boost.
- tomcam 7y agoAppears I am painfully behind js tech. How can starting a JavaScript interpreter be faster than compiled Go?
- _peeley 7y agoForgive me if I'm wrong, but I believe it's because Node is implemented with V8 which is a JIT compiler rather than just an interpreter, not to mention that Node is a more mature and optimized runtime than the Go toolchain.
- ivanvanderbyl 7y agoMy assumption here is that the Node implementation loads your code off disk during cold start using standard require(). Whereas the Go implementation requires loading a small wrapper (probably also in Node) which execs the Go process which then handles your request. In my experience, GCP Functions Go cold start time is almost nil because they compile your code into the function entry point directly, so it's as quick as calling a function in process.
- adamhepner 7y agoOK, so the main takeaway for me for example would be that if I want write lambdas in Go (because it's awesome), then GCP would be better choice for me. But anyway, I'm not too current when it comes to lambdas. Are they compiled everytime when cold started, or is a compiled binary stored in some sort of image?
- ivanvanderbyl 7y agoThey are compiled during the deploy process, with the binary or code + deps (for JS etc) stored on S3 and loaded on demand. This counts as part of the cold boot time.
- tomcam 7y agoThank you. So a Lambda always starts as a node program? I just sort of assumed that it could be any executable.
- ivanvanderbyl 7y agoThis varies by cloud provider. I'm not 100% sure this is still the case with Lambda, but this was the case when they originally added Go support.
- robbyt 7y agoGo 1x? I assume this is 1.12.x? v1.13 has some start-up time enhancements. I wish there was some more info about the testing methodology...
- jaequery 7y agoSo as of 2019, all languages are pretty much on par the same? Is that the conclusion?