Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Conversation

chaz-doyle-cko
Copy link
Contributor

@chaz-doyle-cko chaz-doyle-cko commented Nov 11, 2021

Fix to LAMBDA_EXECUTOR=docker-reuse by using the DOCKER_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 runtime provided.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

@jamietanna
Copy link

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!

@barnc
Copy link

barnc commented Nov 12, 2021

You legend! This is huge for our team - massive thanks. 👍

Copy link
Member

@whummer whummer left a 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
)

Copy link
Member

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 = ...
    ...

Copy link
Contributor Author

@chaz-doyle-cko chaz-doyle-cko Nov 16, 2021

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

@chaz-doyle-cko
Copy link
Contributor Author

Superseded by 4914 (building on the work in this PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants