Live data from Hacker News

AWS Lambda Cold Start Times

filia-aleks.medium.com

161–170 of 233 posts

Re: AWS Lambda Cold Start Times

#161

My experience with cold starts in Azure Functions Serverless is pretty awful. Like most other Azure services, their affordable consumer grade offerings are designed from the ground up not to be good enough for "serious" use. Cold start times compared to Lambda are worse, and in addition, we would get random 404s which do not appear in any logs; inspecting these 404s indicated they were emitted by nginx, leading me to…

Azure Functions, in my opinion, should mostly be used in cases when you want to do some work over some time every now and then. It will also probably be cheaper to use something else in your case. In later versions of AF you can use a real Startup file to mitigate some life cycle related issues.

Re: AWS Lambda Cold Start Times

#162
post #88

Earlier quoted context omitted.

>"they failed to reinvent themselves to stay relevant" This sounds like it came straight out of "The Corporate BS generator" - https://www.atrixnet.com/bs-generator.html .

no, it's the direct translation of the benchmark of this post cold start should be a thing of the past, hence the "failed to reinvent themselves to stay relevant" you need to speak to the hardware directly, not to the VM or the embedded compiler with ARM and ultimately RISC-V coming, that's gonna be even more true

How does a single metric from a highly specialized runtime environment indicate a tech stack is dead?

There are things you can do right now [1] to mitigate these cold start issues.

Going forward, ahead-of-time compilation will be an option. [2]

Aside from cold starts, note that the improvements in .NET make ASP.NET Core one of the fastest web frameworks. [3]

The article: > “.Net has almost the same performance as Golang and Rust, but only after 1k iterations(after JIT).”

Additions like async/await and nullable reference types make it easier to write bug-free code, which for a lot of folks is a better trade off than “speaking to the hardware directly”.

.NET also runs natively on a bunch of platforms now, including ARM.

I’d call all of that continuous improvement. Perhaps even reinvention?

[1] https://docs.microsoft.com/en-us/dotnet/core/deploying/ready...

[2] https://github.com/dotnet/runtimelab/tree/feature/NativeAOT

[3] https://www.techempower.com/benchmarks/#section=test&runid=5...

Re: AWS Lambda Cold Start Times

#163

My experience with cold starts in Azure Functions Serverless is pretty awful. Like most other Azure services, their affordable consumer grade offerings are designed from the ground up not to be good enough for "serious" use. Cold start times compared to Lambda are worse, and in addition, we would get random 404s which do not appear in any logs; inspecting these 404s indicated they were emitted by nginx, leading me to…

Azure Functions cold start times also depend on the underlying tech stack. I was using Python on a Linux host for Slack related Azure Functions and they ran into timeouts sometimes (which for the Slack API is 3s I think). After I switched to Nodejs on Windows I never got a timeout again.

Re: AWS Lambda Cold Start Times

#164
The article states that 600ms is a low cold start figure. However, 600ms cold start is still unacceptable for usage by WebApps.

For webapp, the figure should be 100ms. The only platform that meets that figure (that I know of) is Velo by Wix with around 50ms cold start for node.js

Re: AWS Lambda Cold Start Times

#166

The best cold starts are those which aren't noticed by the user. For my blog search (which runs on Lambda), I found a nice way of achieving that [1]: as soon as a user puts the focus to the input field for the search text, this will already submit a "ping" request to Lambda. Then, when they submit the actual query itself, they will hit the already running Lambda most of the times. And, as others said, assigning more…

Just use http functions in a Velo by Wix project - you will get 50ms cold start out of the box.

Re: AWS Lambda Cold Start Times

#167

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?

With 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

Re: AWS Lambda Cold Start Times

#168
post #151

Earlier quoted context omitted.

That's not what I said or implied.

I'm not sure what you're trying to say then. > your ops cost is just yolo provisioning and never doing backups/patching. You think Amazon is the only one capable of doing backups and keeping software up to date?

No, but I think that it's super common to discount to $0 all the work that using lambda saves you from maintenance and operations. And if you can do any of that at scale for $250/mo you're lightyears ahead of nearly everyone.

Re: AWS Lambda Cold Start Times

#169

Surprised to see such mediocre performance from Node. It was an engineering decision on our team to develop one of our Lambdas with Node and we were deciding between Python and Node. Looks like Go and Rust look very promising.

OP should have tested Deno ( https://github.com/denoland/deno ) too along side Node. Alas...

Deno uses v8 too, that would be just comparing libuv to Tokio.

Re: AWS Lambda Cold Start Times

#170
post #157

The best cold starts are those which aren't noticed by the user. For my blog search (which runs on Lambda), I found a nice way of achieving that [1]: as soon as a user puts the focus to the input field for the search text, this will already submit a "ping" request to Lambda. Then, when they submit the actual query itself, they will hit the already running Lambda most of the times. And, as others said, assigning more…

Have you tried provision concurrency[1], this along with ARM based functions can help you with performance and reduce costs. 1 - https://aws.amazon.com/blogs/aws/new-provisioned-concurrency...

Provisioned concurrency is a bit of a non-starter for cold start latency reduction in user-facing applications. Its a tool in the toolbox, but the problem is: Let's say you set the provisioned concurrency at 10, then you have 11 concurrent requests come in. That 11th request will still get a cold start. PC doesn't scale automatically.

The ping architecture of warming up functions does scale (better) in this setup. Its not perfect, but nothing on lambda is; its possible that the ping request for User2 could get routed to a live function, which finishes, then starts handling a real request for User1, User2's real request comes in but this function is busy, so Lambda cold starts another one.

That being said, these ping functions can be cheap relative to PC. PC is not cheap; its ~$10/mo/gb/function.

With the ping architecture; you'd generally just invoke then immediately exit, so there's very little billed execution time. For sparsely executed functions, the ping architecture is better because PC is billed 24/7/365, whereas ping is billed per invoke (that being said: PC is a much cleaner solution). For high volume functions, PC may be cheaper, but it also won't work as well; if your concurrent executions are pretty stable, then its a great choice, but if its spiky high volume (as most setups are!) then it's hard to find a number which balances both cost and efficacy.

A setup which also includes Application Autoscaling, to automatically adjust the PC level with time of day or system load or whatever, would approach a better setup. But, of course, be more work.

The other frustrating thing about PC is its price relative to a cloudwatch events cron warming setup. Most sources say Lambdas stay warm for ~5 minutes, which means you only need ~15,000 invocations/month per "faux-Provisioned Concurrency" level. Theorycrafting at 100ms/invocation and 512mb: that's ~$0.012/month. PC is ~500 times more expensive than this. This kind of cron-based ping setup is very easy when PC=1; at 1+, it gets harder, but not impossible: You have a cron configured to execute a "proxy" lambda, which then concurrently invokes the real lambda N times depending on what level of PC you more-or-less want.

It's also worth noting that PC cannot be maintained on the $LATEST function version. It can only be maintained on an explicit Function Version or Alias (which does not point to $LATEST). So there's just more management overhead there; you can't just have a CI deploy functions and let AWS do everything else, you have to configure the CI to publish new versions, delete the existing PC config, and create a new PC config, maybe also adjust autoscaling settings as well if you configured it. All automatable, but definitely in the domain of "CloudOps Engineer Job Security"; anyone who tells you AWS will make your life easier is probably working for AWS.

Post reply on HN