-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Manage Lambda code in code objects / share code between identical versions #7019
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
Merged
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
7af1a92
to
e7f47d3
Compare
db1c508
to
9439d7c
Compare
dominikschubert
approved these changes
Oct 18, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't see any major issues 👍
Really awesome that we can now properly use versions "instantly" without skipping all the state verifications 😎 🚀
050c1cb
to
c47238b
Compare
Co-authored-by: Dominik Schubert <[email protected]>
cmoralesmx
pushed a commit
to cmoralesmx/localstack
that referenced
this pull request
Oct 24, 2022
10 tasks
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.
Motivation
Currently, we store the code of a lambda on disk for every version. This has the following problems:
Changes
This PR fixes this behavior by encapsulating the unzipped code on disk with the code storage in S3. As long as the code is not updated, it will be shared (across versions of a function, never across functions).
This leads to faster preparation times and better API parity.
The publish version preparation is now nearly instantaneous, and therefore handled synchronously. The only exception is when publish is triggered by a state changing operation, like the publish=True parameter of
create_function
andupdate_function_code
, in this case it will still be asynchronous, and both versions will wait for the unzipping (but its only unzipped once, due to a lock).Cleanups will be only done after ensuring no other version is taking up the code, on delete of the version or on function updates. Those complete cleanups will also delete the data in S3.
Cache cleanups of the code, namely cleaning up only the unzipped code on disk, will be done on service stop. In this case, the S3 data is not deleted, to enable persistence.