-
Notifications
You must be signed in to change notification settings - Fork 117
Support Multiple Concurrent Runtime Interface Clients for Lambda Managed Instances #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Oh interesting, you'd want to release a new major for this? |
|
@fabianfett @adam-fowler @0xTim what do you think ? What alternatives do we have to not bring |
|
@czechboy0 If we choose this solution, a major version bump is needed because we change the public API (added |
|
@sebsto would you mind linking the relevant AWS docs? |
|
Lambda Managed Instances https://docs.aws.amazon.com/lambda/latest/dg/lambda-managed-instances.html The section about concurrency The MAX CONCURRENCY env variable |
|
I'm not a fan of this approach for multiple reasons:
Given that we can only fix 2 by spawning multiple processes, the only thang that we can solve within the scope of this repo is: 1. Given that this pr would break API and warrant a new major, which as far as I understand, we don't want, I propose the following: We introduce a new type @sebsto wdyt? |
|
Thank you @fabianfett for the analysis and the suggestion. |
|
Closing this PR. I will open a new one with the alternative approach |
AWS launched Lambda Managed Instance, i.e Lambda functions running on EC2 instances.
This comes with a major change in the programming model as function handlers are now allowed to run concurrently on the same machine (multiple in flight events being processed in parallel in the same execution environment). The maximum concurrency per runtime environment is controlled by the user.
This PR adds support for running multiple Runtime Interface Clients (RICs) concurrently when deployed on Lambda Managed Instances, enabling the runtime to handle multiple invocations simultaneously within a single execution environment.
Changes
LambdaRuntime._run()to spawn multiple RICs based on theAWS_LAMBDA_MAX_CONCURRENCYenvironment variableUnsafeTransferand mark thehandler()(and all the types in uses in various form)SendablewaitForAll()to ensure proper error propagation from all RIC tasksContext
Lambda Managed Instances support multi-concurrent invocations where multiple invocations execute simultaneously within the same execution environment. The runtime now detects the configured concurrency level and launches the appropriate number of RICs to handle concurrent requests efficiently.
When AWS_LAMBDA_MAX_CONCURRENCY is 1 or unset, the runtime maintains the existing single-threaded behavior for optimal performance on traditional Lambda deployments.