Live data from Hacker News

AWS Lambda Cold Start Times

filia-aleks.medium.com

211–220 of 233 posts

Re: AWS Lambda Cold Start Times

#211

Earlier quoted context omitted.

You increase the usage of the lambda, sure, but not by double unless all this lambda does is respond to the search. There's a point where this is all semantics when running cloud services with regard to how you've deployed your code behind gateways and lambdas, but most applications have obvious triggers that could warm up a lambda at 10% or less overhead. And even then....lambdas are dirt cheap.

Lambdas can be dirt cheap if you use them well. But that's always what happens. I recently saw a report about contractor who used them for crawling websites. Their client saw a surprise $12k bill for Lambda, when a simple Scrapy crawler on a low-end instance would have cost them Why? Because if you spin up a ton of Lambda invocations and have them sit around waiting for the network, you pay for each CPU to sit idle,…

This is poor architecture, not Lambda's fault.

Same result would be achieved by paying tons of $$ for a high-end machine with dozens of cores, just to scrape one URL per core.

They could have implemented asyncIO within just a few Lambdas - heck even one Lambda could certainly handle hundreds, if not thousands of ASYNC jobs at once, just as a cheap machine, as you pointed.

They treated Lambda functions as threads or async jobs, while they should be looked at as core processors.

Re: AWS Lambda Cold Start Times

#212
post #189

Earlier quoted context omitted.

Thanks, will take a look. Can I run Java, or any kind of binary, there? That's why I'm not running this with CloudFlare workers, for instance. An alternative I'm actually considering is fly.io.

Velo runs only JavaScript, but unlike cloudflare, velo runs a full node.js. With that in mind, you can a lot of things, from accessing your database or any other asset on aws (or gcp or azure). You can also use other wix apis, like payment api or the wix data database.

If you need to access a DB in AWS, isn't the networking overhead on every single call going to dominate all cold start performance gains in a few occasional requests in Velo?

Re: AWS Lambda Cold Start Times

#213

Earlier quoted context omitted.

Lambdas can be dirt cheap if you use them well. But that's always what happens. I recently saw a report about contractor who used them for crawling websites. Their client saw a surprise $12k bill for Lambda, when a simple Scrapy crawler on a low-end instance would have cost them Why? Because if you spin up a ton of Lambda invocations and have them sit around waiting for the network, you pay for each CPU to sit idle,…

This is poor architecture, not Lambda's fault. Same result would be achieved by paying tons of $$ for a high-end machine with dozens of cores, just to scrape one URL per core. They could have implemented asyncIO within just a few Lambdas - heck even one Lambda could certainly handle hundreds, if not thousands of ASYNC jobs at once, just as a cheap machine, as you pointed. They treated Lambda functions as threads or a…

I didn't say it was Lambda's fault. Indeed, I said Lambdas can be cheap if you use them well. The implication being that some people don't.

Re: AWS Lambda Cold Start Times

#214

Earlier quoted context omitted.

Yes it does

You should look at offering this as a service perhaps. 2,500 250MB lambdas for $250/month with all AWS guarantees (ie, Multi-AZ, permissioning on every call etc etc) would be pretty compelling I think for folks running intermediate lambda workloads (ie, 5-10K lambadas at a time).

I'm not trying to offer it as a service. I'm trying to run my workload in a way that can scale from 0 -> 10,000 request/second in an instant and doesn't cost my company $5,000/month to do so.

It's pretty easy if you know what you're doing (or care to figure it out).

Re: AWS Lambda Cold Start Times

#215

Earlier quoted context omitted.

You should look at offering this as a service perhaps. 2,500 250MB lambdas for $250/month with all AWS guarantees (ie, Multi-AZ, permissioning on every call etc etc) would be pretty compelling I think for folks running intermediate lambda workloads (ie, 5-10K lambadas at a time).

I'm not trying to offer it as a service. I'm trying to run my workload in a way that can scale from 0 -> 10,000 request/second in an instant and doesn't cost my company $5,000/month to do so. It's pretty easy if you know what you're doing (or care to figure it out).

If you can do $250/month with all ops costs and features of lambda for 5,000 or 10,000 requests per second - you would be silly not to offer a service.

There are plenty of us who can run a system that scales to 10krps. That's relatively easy? I personally can't stand lambda and don't use it FWIW. I like EC2, I actually like fargate a lot of all sorts of things including lambda like services without a separate lambda for each request.

But for folks with a payload, that want the lambda like experience - if you have a solution, all ops cost included (ie, no well paid developer or ops person needed for customer) for $250/month for the scale we are talking here (2,500 x 250MB = 625GB etc) then you have an amazing solution going especially if you can do the networking, IAM controls etc that aws provides.

The problem I've seen, when folks say amazon is "insanely expensive" they are usually not actually comparing the AWS offering to a similar offering. If your cheap solution is not lambda like, you need to compare to EC2 or similar (with perhaps a good programmer doing something a bit more monolithic than aws).

Re: AWS Lambda Cold Start Times

#216
> NodeJs is the slowest runtime, after some time it becomes better(JIT?) but still is not good enough. In addition, we see the NodeJS has the worst maximum duration.

The conclusion drawn about NodeJS performance is flawed due to a quirk of the default settings in the AWS SDK for JS compared to other languages. By default, it opens and closes a TCP connection for each request. That overhead can be greater than the time actually needed to interact with DDB.

I submitted a pull request to fix that configuration[0]. I expect the performance of NodeJS warm starts to look quite a bit better after that.

[0]: https://github.com/Aleksandr-Filichkin/aws-lambda-runtimes-p...

Re: AWS Lambda Cold Start Times

#217
post #216

> NodeJs is the slowest runtime, after some time it becomes better(JIT?) but still is not good enough. In addition, we see the NodeJS has the worst maximum duration. The conclusion drawn about NodeJS performance is flawed due to a quirk of the default settings in the AWS SDK for JS compared to other languages. By default, it opens and closes a TCP connection for each request. That overhead can be greater than the tim…

In addition, the NodeJS cold start time can be further optimized by bundling into a single file artifact to reduce the amount of disk IO needed when requiring dependencies. Webpack, Parcel, ESBuild, and other bundlers could achieve that, I'm sure.

EDIT: That may already be happening here in the build.sh file. I see it runs `sam build --use-container NodeJsFunction -b nodejs`.

Re: AWS Lambda Cold Start Times

#218

Earlier quoted context omitted.

Lambdas can be dirt cheap if you use them well. But that's always what happens. I recently saw a report about contractor who used them for crawling websites. Their client saw a surprise $12k bill for Lambda, when a simple Scrapy crawler on a low-end instance would have cost them Why? Because if you spin up a ton of Lambda invocations and have them sit around waiting for the network, you pay for each CPU to sit idle,…

Couldn't this also have been handled efficiently in Lambda had it been configured to use batching? (Assuming it was implemented as async invocations driven by a queue of some sort.) It does seem unfortunate that Lambda cannot be configured to support concurrent synchronous invocations for serving HTTP requests concurrently.

This is a bit like asking if you can make a coal-rolling pickup truck more environmentally friendly by letting your friends carpool with you.

Technically, yes, but it's kinda missing the point.

Re: AWS Lambda Cold Start Times

#219

Earlier quoted context omitted.

This is poor architecture, not Lambda's fault. Same result would be achieved by paying tons of $$ for a high-end machine with dozens of cores, just to scrape one URL per core. They could have implemented asyncIO within just a few Lambdas - heck even one Lambda could certainly handle hundreds, if not thousands of ASYNC jobs at once, just as a cheap machine, as you pointed. They treated Lambda functions as threads or a…

I didn't say it was Lambda's fault. Indeed, I said Lambdas can be cheap if you use them well. The implication being that some people don't.

Sure. But isn't this valid to any tech? As I pointed, one could make stupid use of expensive machine with dozens of cores as well...

Re: AWS Lambda Cold Start Times

#220

Earlier quoted context omitted.

I didn't say it was Lambda's fault. Indeed, I said Lambdas can be cheap if you use them well. The implication being that some people don't.

Sure. But isn't this valid to any tech? As I pointed, one could make stupid use of expensive machine with dozens of cores as well...

Right, but at least with the expensive machine, one is making a conscious decision to spend a certain, known amount.
Post reply on HN