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

Skip to content

Support "stay open" mode for Lambda invocations (updated PR) #4914

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
merged 2 commits into from
Nov 16, 2021

Conversation

whummer
Copy link
Member

@whummer whummer commented Nov 14, 2021

Support "stay open" mode for Lambda invocations.

Based on #4906 . Recreated the PR, to trigger the CI builds, and added a few minor fixes.

Replaces #4185
Closes #4123

@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 00:42 Inactive
@github-actions
Copy link

github-actions bot commented Nov 14, 2021

LocalStack integration with Pro

βŸβ€„βŸβ€„3 files  Β±0β€‚β€ƒβŸβ€„βŸβ€„3 suites  Β±0   35m 38s ⏱️ +55s
681 tests Β±0  664 βœ”οΈ Β±0  17 πŸ’€ Β±0  0 ❌ Β±0 
813 runs  Β±0  783 βœ”οΈ Β±0  30 πŸ’€ Β±0  0 ❌ Β±0 

Results for commit d013ee7. ± Comparison against base commit 07b6887.

♻️ This comment has been updated with latest results.

@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from 1838726 to 6ee228e Compare November 14, 2021 13:34
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 13:34 Inactive
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 20:22 Inactive
@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from 369fa06 to 6f41e99 Compare November 14, 2021 20:26
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 20:26 Inactive
@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from 6f41e99 to 4b41eda Compare November 14, 2021 20:32
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 20:33 Inactive
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 20:43 Inactive
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 21:16 Inactive
@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from c045d84 to 990cda0 Compare November 14, 2021 22:59
@whummer whummer temporarily deployed to localstack-ext-tests November 14, 2021 23:00 Inactive
@coveralls
Copy link

coveralls commented Nov 14, 2021

Coverage Status

Coverage decreased (-0.07%) to 81.1% when pulling d013ee7 on chaz-doyle-cko/docker-reuse-stay-warm into 07b6887 on master.

@whummer whummer requested a review from dfangl November 15, 2021 09:49
@whummer whummer changed the title WIP: Support "stay open" mode for Lambda invocations (updated PR) Support "stay open" mode for Lambda invocations (updated PR) Nov 15, 2021
@@ -1410,18 +1477,6 @@ def docker_image_for_lambda(cls, lambda_function: LambdaFunction):
)
docker_tag = runtime
docker_image = config.LAMBDA_CONTAINER_REGISTRY
# TODO: remove prefix once execution issues are fixed with dotnetcore/python lambdas
Copy link
Member Author

@whummer whummer Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These patches seem to be no longer required - in fact, some of these older images do not support $DOCKER_LAMBDA_STAY_OPEN, hence removing this code from here.

@@ -854,8 +904,13 @@ def prime_docker_container(

LOG.debug("Starting docker-reuse Lambda container: %s", container_name)
DOCKER_CLIENT.start_container(container_name)

def wait_up():
cont_status = DOCKER_CLIENT.get_container_status(container_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wait here for the container to start up, but would that necessarily include that the 9001 socket is already available? It only checks if the container status is up, not whether the port is already open. Might be a small window we never hit though.
This would also tie in nicely with the availability check for port 9001 to check against networking issues.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, thanks @dfangl . πŸ‘ Updated the PR - it now also contains logic to assert availability of the target port, where appropriate (only in case we're running in Docker, and if the IP address of the target container can be determined by the Docker client).

@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from 990cda0 to 7c94a0d Compare November 15, 2021 21:42
@whummer whummer temporarily deployed to localstack-ext-tests November 15, 2021 21:42 Inactive
@whummer whummer requested a review from dfangl November 15, 2021 23:19
@chaz-doyle-cko
Copy link
Contributor

@whummer - this all looks good, nicely extending my stuff from #4906. I'm more than happy for my PR to be closed and this to move forward. :)

@whummer whummer force-pushed the chaz-doyle-cko/docker-reuse-stay-warm branch from 7c94a0d to d013ee7 Compare November 16, 2021 15:26
@whummer whummer temporarily deployed to localstack-ext-tests November 16, 2021 15:26 Inactive
@whummer
Copy link
Member Author

whummer commented Nov 16, 2021

Thanks a bunch @chaz-doyle-cko . Rebased the branch and squashed the commits into two parts, to retain the history and authorship. πŸ‘

We'll also acknowledge the authorship of @jamietanna (original author) and @wesselvdv (contributor) and @dfangl (reviewer) in the commit messages. (will get merged once the builds are passing..)

Thanks all for helping get this over the line!

@whummer whummer merged commit d5b9d1c into master Nov 16, 2021
@whummer whummer deleted the chaz-doyle-cko/docker-reuse-stay-warm branch November 16, 2021 16:16
@jamietanna
Copy link

Amazing, thanks @chaz-doyle-cko for getting this over the line, I know a lot of folks are going to really appreciate this πŸ™Œ

Did we want to add anything extra in the docs to note this is better for Java Lambda performance?

@wesselvdv
Copy link

When can we expect a release to be cut that includes this wonderful change?

@jamietanna
Copy link

This should be available in the :latest tag if you want to give it a go in the meantime, btw πŸ˜„

@wesselvdv
Copy link

This should be available in the :latest tag if you want to give it a go in the meantime, btw πŸ˜„

ohhhh, I should've thought of this myself. yay!

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.

Support "stay open" mode for Lambda invocations
6 participants