serverless icon indicating copy to clipboard operation
serverless copied to clipboard

Feature request: specify `reservedConcurrentExecutions` for each function

Open theburningmonk opened this issue 8 years ago • 12 comments

This is a Feature Proposal

Description

Allow you to specify the no. of reserved concurrent executions for a function via the serverless.yml now that it's supported by CloudFormation

Configuration might look like this:

functions:
  usersCreate:
    handler: users.create
    reservedConcurrentExecutions: 1 # limit concurrency of function to 1

I'm not a fan of the name reserved as it doesn't reflect the fact that it's setting a "limit" on the level of concurrency for that function.. but, it's what AWS has called it, so using a different name here might be even more confusing as user would have to a) still understand what "reserved" means in AWS Lambda, and additionally b) map a different terminology to what AWS uses already :-/

theburningmonk avatar Mar 16 '18 13:03 theburningmonk

@theburningmonk Indeed. It can be added now.

BTW: reserved is correct. It does not only limit the function but also reduces the amount of concurrent exetutions for all other functions as well from your account limit. So if you reserve one function, all others (not reserved ones) will have less available concurrency.

HyperBrain avatar Mar 16 '18 14:03 HyperBrain

I get that it takes out available concurrency for other functions, but it still doesn't feel right to me. Maybe I'm looking at it mainly from the point of "a mechanism to control concurrency of a particular function", and the reservation part of the equation is just an implementation detail of how AWS decided to enforce total no. of concurrent executions in a region.

theburningmonk avatar Mar 16 '18 14:03 theburningmonk

I see it from another point:

You have X available concurrency in your account. From that total amount you reserve Y for this single function. The reserved amount cannot be used otherwise anymore. From that point it is more a guarantee that your function always has the ability to run at ~~least~~ most Y times in parallel. For mission critical lambdas that must never be rate limited by other functions this totally makes sense. I remember one occurence where one of our developers accidentally started a self-invoking lambda in the account and thus shot down the whole system, because all lambdas were not able to start anymore.

[UPDATE: most, you're right 😄 ]

HyperBrain avatar Mar 16 '18 15:03 HyperBrain

Hi Frank, I'm confused by the example, the Y concurrency reserved for a function is the limit (so, it's at most Y times in parallel, not at least Y times in parallel). If the point is to "restrict the parallelism of non mission-critical functions" so that you leave (X - Y) total unreserved capacity for mission-critical functions that shouldn't be rate limited by other functions, then I think we're looking at this feature in the same way.

theburningmonk avatar Mar 16 '18 15:03 theburningmonk

Hi, I'm a bit confused.

How is this property different from the "reservedConcurrency" one that appears at https://serverless.com/framework/docs/providers/aws/guide/functions/ ?

Unfortunately, I've tried this "reservedConcurrency" setting but it doesn't seem to work. Perhaps I'm doing something wrong :( but in the AWS console, this lambda function always shows the default "Use unreserved account concurrency".

Thanks

nireak avatar Mar 24 '18 22:03 nireak

It looks to me like this never made it to 1.26.1 as the code is in master but not on the tag.

Can someone confirm ? @pmuens ?

When is the next release scheduled to happen?

mangas avatar Mar 28 '18 23:03 mangas

@mangas 1.26.1 was a pure bugfix release and did not contain any features. Features from master will end up in 1.27.

HyperBrain avatar Mar 29 '18 09:03 HyperBrain

Any idea when we could expect 1.27 to come out?

mangas avatar Mar 29 '18 09:03 mangas

Please could we ensure that the documentation (e.g. https://serverless.com/framework/docs/providers/aws/guide/functions/) doesn't suggest that this feature exists when it's not yet released?

duncanj avatar Jun 18 '18 10:06 duncanj

@duncanj since [email protected] the feature has been release. IMHO this issue should be closed.

mcastellini avatar Sep 14 '18 08:09 mcastellini

I have [email protected] but my lambda function still shows the default "Use unreserved account concurrency". Anyone have the same problem?

dayyash avatar Jan 14 '19 22:01 dayyash

@dayyash this issue is resolved, if you're running into another bug please open a new issue.

brianneisler avatar Jan 23 '19 23:01 brianneisler