-
Notifications
You must be signed in to change notification settings - Fork 118
Add support for Lambda Managed Instances without changing the public API [CORE] #629
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
Open
sebsto
wants to merge
23
commits into
main
Choose a base branch
from
sebsto/lambda-managed-instances-core
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove deleted Lambda+JSON.swift file - Split JSON support into separate files: - LambdaRuntime+JSON.swift for regular runtime - LambdaManagedRuntime+JSON.swift for managed runtime - Clean up ManagedInstances example directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AWS launched Lambda Managed Instances, 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.
This PR is a followup to #617 which used another approach to support Lambda Managed Instances by changing the public API and requiring that all handlers must conform to
Sendable. The original PR was closed as we agreed that only a fraction of the Lambda functions will be deployed on EC2 and it was not worth adding aSendablerequirement for all.Changes
Introduced thread-safe LambdaManagedRuntime: Created new Sendable-conforming runtime class that supports concurrent handler execution with atomic guards to prevent multiple runtime instances and thread-safe handler requirements (
Handler: StreamingLambdaHandler & Sendable)Implemented ServiceLifecycle integration: Added managed runtime support for structured concurrency lifecycle management, allowing proper startup/shutdown coordination in multi-concurrent environments
This PR contains only changes to the core runtime, convenience functions, handlers, adapters, and a comprehensive example will be added in a follow up PR.
Context
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_CONCURRENCYis 1 or unset, the runtime maintains the existing single-threaded behaviour for optimal performance on traditional Lambda deployments.