News for hackers. Stuff that matters.
Re:AWS Lambda pricing now per ms by yeldarb on Tuesday December 01, 2020 @12:19PM (#25267241)
Anyone know why there's a hard limit of 15 minutes for Lambda (and 9 minutes for Google Cloud Functions)? Still seems really weird to me.
Re:AWS Lambda pricing now per ms by jlouis on Tuesday December 01, 2020 @12:22PM (#25267292)
Safety.

No function runs forever.

Also if you want to reboot/repurpose the server, 15 minutes is max wait time.

And finally, you don't want people running long jobs here when you have a solution there.

Re:AWS Lambda pricing now per ms by jedberg on Tuesday December 01, 2020 @12:42PM (#25267547)
Bin packing. It's a lot easier to distribute workloads around a cluster of compute if you can guarantee the maximum runtime.
Re:AWS Lambda pricing now per ms by BoorishBears on Tuesday December 01, 2020 @12:25PM (#25267344)
If I had to imagine designing a system like Lambda, people running really long operations would really throw a wrench in things.

Maybe you could let users indicate the operation will take a long time... but if the user knows the operation is long running in advance, why not just guide them to a more suitable system?

Re:AWS Lambda pricing now per ms by generj on Tuesday December 01, 2020 @12:26PM (#25267354)
One way around this limitation while still using server less (for Python only) are Glue python shell jobs. They can run for hours if not days, and default at 1 vCPU and 1GB of memory for 2.75¢ an hour.
Re:AWS Lambda pricing now per ms by tanilama on Tuesday December 01, 2020 @01:27PM (#25268099)
To limit the scope, and type of applications people should use Lambda for and Lambda is best at running them.

15 mins max runtime simplifies the resource management and avoid abuse. If you have workload for long running jobs, then that should go to something like AWS EKS/Batch/SageMaker.

That being said, things can change, if more and more people requires long running capacity for Lambda (though I am skeptical of that, as Lambda abstracts the underlying hardware away and is supposedly flexible to the requirements)

Re:AWS Lambda pricing now per ms by munns on Tuesday December 01, 2020 @12:50PM (#25267639)
How long would you like it to be?

Chris Munns - Lead of Dev Advocacy for Serverless@AWS

Re:AWS Lambda pricing now per ms by jusssi on Tuesday December 01, 2020 @01:19PM (#25268006)
Now that someone's listening: I don't mind the 15min Lambda timeout, but it would be great to get rid of the Lambda + API Gateway 30s & ~6MB limits. Those always bite unaware devs in the butt and workarounds for them take quite a bit of effort.
Re:AWS Lambda pricing now per ms by munns on Tuesday December 01, 2020 @01:28PM (#25268118)
Yes.

But being real, we hear you on this one. I can't comment on API Gateway's roadmap here but this is something both teams is aware of. The reason it is the way it is today is for a valid reason. But this is def something we hear pretty often.

- Chris

Re:AWS Lambda pricing now per ms by staticassertion on Tuesday December 01, 2020 @01:00PM (#25267776)
My lambdas run indefinitely. It's a bit silly, but basically every lambda spins up a bunch of threads, pulls messages, and then pushes them into internal buffers to be processed. There are reasons for this.

What I care about is: * Scale to 0, and automatic scaling up without configuring it

* Automatic patching of the OS

* Fault isolation

Lambda gives me that. So each one runs for 15 minutes, processing all data in an SQS queue.

I do wonder if Fargate would be cheaper per millisecond? Dunno.

Re:AWS Lambda pricing now per ms by Dunedan on Tuesday December 01, 2020 @01:35PM (#25268223)
If you want sequential processing of the data in the SQS queue, something which works really well today is to create a state machine in AWS Step Functions which triggers a AWS Lambda function which then pulls data from SQS and processes it. Using a condition in the state machine, this can be done in a loop, so when the AWS Lambda function reaches its timeout, another one gets triggered as long as there is still data in the SQS queue.

If data doesn't have to be processed sequentially an option is to configure the AWS Lambda function to get invoked for new data in the SQS queue [1], so you don't have to care about manually fetching data from SQS at all.

[1]: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html

Re:AWS Lambda pricing now per ms by staticassertion on Tuesday December 01, 2020 @01:38PM (#25268260)
Yep, but I prefer to care about manually fetching data from SQS. It's a weird system, but due to our data model there are many benefits to processing as many messages in a given lambda as possible.
Re:AWS Lambda pricing now per ms by kondro on Tuesday December 01, 2020 @07:38PM (#25271978)
This might be useful to simplify that model for you :)

https://aws.amazon.com/about-aws/whats-new/2020/11/aws-lambd...

Re:AWS Lambda pricing now per ms by staticassertion on Tuesday December 01, 2020 @09:40PM (#25272691)
Pretty cool, but not quite the model I want.
Re:AWS Lambda pricing now per ms by munns on Tuesday December 01, 2020 @01:18PM (#25267984)
Today, for a nonstop workload you might save money with Fargate or ECS.
Re:AWS Lambda pricing now per ms by staticassertion on Tuesday December 01, 2020 @01:37PM (#25268245)
Yeah, I'd be curious to see how much money we'd save with Fargate.
Re:AWS Lambda pricing now per ms by matwood on Tuesday December 01, 2020 @03:23PM (#25269429)
I'm going to assume since you're processing off a queue, the lambdas are not serving a waiting user. If you do the work to orchestrate onto Fargate, you might as well go the rest of the way and move to ECS. Then you can use spots, where real savings kick in.

Someone mentioned step functions above. All of our steps run on spots. We also have some tasks like you have that read off queues and do processing, which also all run on spots.

Re:AWS Lambda pricing now per ms by jeffcarter on Tuesday December 01, 2020 @02:02PM (#25268555)
For raw compute, Fargate is ~1/2 the cost of Lambda. But you'd have to orchestrate the launch yourself. It could be worth it though depending on your workload
Re:AWS Lambda pricing now per ms by yeldarb on Tuesday December 01, 2020 @05:31PM (#25270912)
As long as possible. Our jobs usually finish well within the limit but the top 1% hit the limit.

One example we've been wrestling with is a merge operation. Usually it's merging about 1000 records which completes in a few seconds. But every once in a while someone kicks off a job that tries to merge 1,000,000 records and it times out.

We want the benefits of serverless (scale down to zero, up to infinity at the drop of a hat) but these edge cases mean we're having to evaluate other options.

An hour or two would be a good start; then it'd cover 99.9% of requests. With a few hours we could add more nines :)

Re:AWS Lambda pricing now per ms by dodobirdlord on Tuesday December 01, 2020 @08:43PM (#25272346)
If your lambda function detects that it is going to hit the timeout you could have it launch a Fargate container to handle the long merge. Fargate is essentially a long-lived Lambda.
Re:AWS Lambda pricing now per ms by mcintyre1994 on Wednesday December 02, 2020 @02:34AM (#25274049)
It’s also probably much easier to share code between those two implementations with the new container based lambdas :)
Re:AWS Lambda pricing now per ms by BoorishBears on Tuesday December 01, 2020 @05:39PM (#25271009)
That sounds like you need a queue of some sort
Re:AWS Lambda pricing now per ms by k__ on Tuesday December 01, 2020 @01:37PM (#25268248)
Make it indefinitly and price exponentially.

;)

Re:AWS Lambda pricing now per ms by munns on Tuesday December 01, 2020 @02:59PM (#25269170)
thar be dragons :)
Re:AWS Lambda pricing now per ms by willcipriano on Tuesday December 01, 2020 @03:03PM (#25269229)
I have many workloads where 15 minutes may be just a little too short for comfort. A hour timeout would have me reaching for Lambda more often.
Re:AWS Lambda pricing now per ms by yowlingcat on Tuesday December 01, 2020 @12:23PM (#25267309)
Lambda isn't designed for long running processes. Keeping the runtime limit lower makes it a lot easier to operate the underlying metal because you can move thing around every N minutes where N is the runtime limit. For long-running processes, something like Fargate might be a better fit in the AWS side of things.
Re:AWS Lambda pricing now per ms by donor20 on Tuesday December 01, 2020 @12:42PM (#25267553)
Fargate works well especially after they fixed some of the pricing issues there. Then next step you can spin up a fleet of EC2 or EKS or something
Re:AWS Lambda pricing now per ms by Cpoll on Tuesday December 01, 2020 @01:14PM (#25267938)
> Fargate works well especially after they fixed some of the pricing issues there.

Was this recent, should I take a look at this again? My issue with Fargate as recent as a year ago was that running the same workload on ECS (if you can use your cluster nodes efficiently) was twice as cheap (even without reserved instances).

Re:AWS Lambda pricing now per ms by yowlingcat on Tuesday December 01, 2020 @12:58PM (#25267757)
Yup! In general, I prefer Fargate over Lambda because of cold starts. It's a little bit more management overhead over Lambda and it is a bit lower level. But I think it's worth it.
Re:AWS Lambda pricing now per ms by alex_duf on Tuesday December 01, 2020 @12:55PM (#25267727)
It's a new pattern, so it's only relevant for some use cases. I don't think it's meant to solve every cases: including the case of a long running job.

It's best suited for jobs that can be broken down into tons of small individual computations, or to respond directly to HTTP requests. If you can fit your pipeline / application into that model it's usually beneficial: Instant scaling, retries, reliable etc. Mixed with other concepts like SQS you can build pretty powerful things without having to pay when there's no load.