Live data from Hacker News

AWS Lambda pricing now per ms

aws.amazon.com

281–290 of 291 posts

Re: AWS Lambda pricing now per ms

#281

For reference - Lambda functions used to billed at 100ms intervals. My Node.Js function usually only takes 37-40ms to run. So this is a pretty good advancement for cost savings.

Just out of curiosity, could you share what kind of things you use it for?

I've never used Lambda, but any time I have a function that I need to run in response to some event or perodically (that's what Lambda is, right?), it's set up in a background worker specifically because it's long and slow, as anything fast can be done synchronously without the overhead.

Re: AWS Lambda pricing now per ms

#282

For reference - Lambda functions used to billed at 100ms intervals. My Node.Js function usually only takes 37-40ms to run. So this is a pretty good advancement for cost savings.

Just out of curiosity, could you share what kind of things you use it for? I've never used Lambda, but any time I have a function that I need to run in response to some event or perodically (that's what Lambda is, right?), it's set up in a background worker specifically because it's long and slow, as anything fast can be done synchronously without the overhead.

Lambda is not specifically made for long and slow tasks; AWS Lambda specifically has a maximum execution time of 15 minutes (and you have to explicitly configure it to do so, see https://aws.amazon.com/about-aws/whats-new/2018/10/aws-lambd....).

For longer tasks, spinning up an EC2 or Beanstalk instance is probably the way to go.

As for what to use it for, we used it in our application (deployed to Netlify which uses Lambda under the hood) where lambdas operated like a 'proxy' to various 3rd party API suppliers (Commercetools, Adyen, some age verification service), and those too would use a lambda function to ping back at us (e.g. when payment was confirmed). Worked pretty well, although in retrospect I would've preferred a 'normal', monolithic server to do the same thing.

Re: AWS Lambda pricing now per ms

#283
post #56

Earlier quoted context omitted.

Awesome! That was the idea here. Lots of sub 100ms workloads and we really want you to be able to pay for what you use. - Chris, Serverless@AWS

> ...we really want you to be able to pay for what you use. Cloudflare Workers has the right pricing model. They only charge for CPU time and not wall time. They also do not charge for bandwidth. > Lots of sub 100ms workloads... AWS Lambda (or Lambda at Edge), as it stands, is 10x more expensive for sub 50ms workloads (Workers does allow upto 100ms for the 99.9th percentile) that can fit 128MB RAM. https://medium.com…

>> AWS Lambda (or Lambda at Edge), as it stands, is 10x more expensive for sub 50ms workloads

Not sure about this, most use cases of Lambda use other resources and do not exist in a vacuum. Comparison should be made using complete systems not only parts.

Re: AWS Lambda pricing now per ms

#284
post #139

Earlier quoted context omitted.

Interesting. Not possible today. We'd still encourage paralyzation up through multiple concurrency of functions being executed.

"paralyzation" -> parallelization, yeah? :)

It was a long day yesterday, thank you :)

Re: AWS Lambda pricing now per ms

#285
post #280

This is great, AWS. A feature I'd really like next is secrets as environment variables like ECS. Retrieving SecretsManager secrets and SSM Secure Parameters in application code is messy and provides significant friction for developers on my team.

I’m confused. This is available already for more than a year (maybe 2). https://docs.aws.amazon.com/AmazonECS/latest/developerguide/...

Yes, it's in ECS, which is why I said "like ECS"

I'm asking for Lambda to have externally supplied secrets

Re: AWS Lambda pricing now per ms

#286
post #174
post #89

Earlier quoted context omitted.

Except that none of the rest of your infrastructure is there, and that APIs represent just a non-majority part of Lambda workloads.

Yet, if you're a Cloudflare user, all of your edges are there - so it doesn't matter. We use Workers extensively for "edge" related things. Lambda, never - but for working with S3 buckets, sure. They feel similar, but differently specialized.

Lambdas are UDFs for S3.

Re: AWS Lambda pricing now per ms

#287
post #239

I find it annoying to have all these pricing per second, and now per millisecond. It's really hard for my mind to visualize what `$0.0000000021 per millisec` actually is. Being billed by the millisecond does not mean that you should give a pricing per millisecond. I prefer Digital Ocean or Heroku's approach of billing by the second, but giving the price per month. How on hell is `$0.0000000021 per millisec` better th…

There is simply an enourmous amount of assumptions that would go into estimating anything else, because ms is the only correct metric. Lambda billing for a month? What on earth does that say? 10 invocations running 15 minutes? 90,000 invocations running 100ms? (Those two are equivalent btw). If I know my function takes around ~35ms ballpark, and I will probably invoke it 5,000 times per day, then I can calculate my m…

Gotta be sure to have that number of 0s exactly right.

Re: AWS Lambda pricing now per ms

#289
post #202

Earlier quoted context omitted.

Curious why it would take 5 seconds? The way I'm using lambda, I compile the lambda build image beforehand which contains the python packages already installed, and the only "time" restraint is that of the lambda spinning up itself. If you ran e.g. "pip install -r requirements.txt" inside the lambda, then yes it would take time to install the packages.

Installing packages onto the system (“pip install”) is different than the interpreter importing them (loading them when the interpreter hits an “import” statement). Not only is it resolving imports into file paths and loading them into memory, but it’s also executing module-level code which tends to be quite common in Python, so it’s not at all uncommon for imports to take 5s or more. Meanwhile in Go, dependencies ar…

Interesting, I see what you mean, but in my time working with python I've never seen that as an issue. Perhaps in different domains such as big data it might be a problem.

Re: AWS Lambda pricing now per ms

#290
post #279

Earlier quoted context omitted.

I saw the news around running container images as artifacts which is welcome. Still the 15 min limit restricts a lot of use cases. https://aws.amazon.com/blogs/aws/new-for-aws-lambda-containe...

As far as I know, if you run for more than a few seconds Lambda’s cost will _really_ not worth it. One should prefer ECS or Batch.

On Fargate? I agree.
Post reply on HN