-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
WIP: Support "stay open" mode for Lambda invocations #4906
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
WIP: Support "stay open" mode for Lambda invocations #4906
Conversation
I've validated this with the blank-java project, and can see that cold starts are not present after the intiial call 🙌 Awesome stuff, @chaz-doyle-cko! |
You legend! This is huge for our team - massive thanks. 👍 |
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.
Great, thanks for digging into this @chaz-doyle-cko @jamietanna @barnc ! 👍
Looks like the tests haven't been triggered on this PR - usually this can be fixed if you log in to CircleCI with your Github credentials to re-initialize the repo permissions - can you please give that a try? (hope that helps..)
I've left a few initial comments - perhaps it would be easier if I quickly raise a PR with these changes against your fork, or simply create a new/updated PR in this repo (we'll make sure that your authorship is retained..). Thanks!
Edit: see updated PR #4914
@@ -783,14 +789,47 @@ def execute_in_container( | |||
container_info.name, f"{lambda_cwd}/.", DOCKER_TASK_FOLDER | |||
) | |||
|
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.
One possible issue I'm seeing is that we may not always be able to rely on connectivity to the Lambda container via its IP address and port 9001. For example, this does not work when starting LocalStack in host mode (outside of Docker). Host mode is not really a supported currently (the default being Docker), but a few users are still relying on it.
We could add a check here to determine whether we are running inside Docker (using in_docker()
from utils/common.py
):
if not in_docker():
return DOCKER_CLIENT.exec_in_container(...)
lambda_docker_ip = ...
...
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.
@whummer - Completely agree... Have updated
Superseded by 4914 (building on the work in this PR) |
Fix to
LAMBDA_EXECUTOR=docker-reuse
by using theDOCKER_LAMBDA_STAY_OPEN
in lambci/lambda containers to allow faster lambda invocations.This as been tested against both
nodejs
and.NET
lambdas (.NET
using custom runtimeprovided.al2
)Please feel free test further @jamietanna, @wesselvdv
NOTE: I had to fork brand new as the current changes in
master
are extensive enough to warrant a clean slate.Replaces PR-4185
Closes #4123