Skip to content

add in-memory ASF request dispatching for boto clients #7396

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

Closed
wants to merge 1 commit into from

Conversation

thrau
Copy link
Member

@thrau thrau commented Dec 28, 2022

This PR adds code to make calls from boto clients directly to a Gateway without an HTTP server roundtrip. This can make internal calls much faster because they don't require IO.

The mechanism used to achieve this is botocore's before-send event, which can be used to short-circuit the request logic by returning a response from the event handler, before the HTTP request is even made.

I did some basic refactoring to make this easier, including:

  • created localstack.runtime.components as a place for runtime-level singleton components
  • added a new method to Gateway with the signature def handle(self, context: RequestContext, response: Response), which now makes the Gateway a drop-in replacement for a handler chain (and easier to call if you want to invoke it with a pre-existing RequestContext).

TODO:

  • basic PoC implementation
  • integration with the client factory and connect_to
  • more benchmarks to see whether/where this is really useful
  • more unit tests for different protocols
  • documentation

@thrau thrau temporarily deployed to localstack-ext-tests December 28, 2022 00:55 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests December 28, 2022 00:57 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Dec 28, 2022

LocalStack integration with Pro

0 files   -        3  0 suites   - 3   0s ⏱️ - 1h 25m 24s
0 tests  - 1 609  0 ✔️  - 1 317  0 💤  - 292  0 ±0 
0 runs   - 2 261  0 ✔️  - 1 687  0 💤  - 574  0 ±0 

Results for commit 9d4ae7e. ± Comparison against base commit d3f51d5.

♻️ This comment has been updated with latest results.

@thrau thrau force-pushed the gateway-botocore-integration branch from e48f6e5 to 7038265 Compare December 28, 2022 18:07
@thrau thrau temporarily deployed to localstack-ext-tests December 28, 2022 18:07 — with GitHub Actions Inactive
@thrau thrau force-pushed the gateway-botocore-integration branch from 7038265 to ead511a Compare December 29, 2022 01:04
@thrau thrau temporarily deployed to localstack-ext-tests December 29, 2022 01:04 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests December 29, 2022 13:29 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests December 29, 2022 13:45 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests December 29, 2022 14:21 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests December 29, 2022 14:58 — with GitHub Actions Inactive
@thrau thrau force-pushed the gateway-botocore-integration branch from 8f10977 to 67edc7f Compare January 5, 2023 18:24
@thrau thrau temporarily deployed to localstack-ext-tests January 5, 2023 18:25 — with GitHub Actions Inactive
@coveralls
Copy link

coveralls commented Jan 6, 2023

Coverage Status

coverage: 82.895% (-0.1%) from 82.999% when pulling 69e4e34 on gateway-botocore-integration into 1251fef on master.

@thrau thrau force-pushed the gateway-botocore-integration branch from 67edc7f to 0a1d555 Compare January 7, 2023 21:08
@thrau thrau temporarily deployed to localstack-ext-tests January 7, 2023 21:08 — with GitHub Actions Inactive
@thrau thrau temporarily deployed to localstack-ext-tests January 8, 2023 17:37 — with GitHub Actions Inactive
@thrau thrau force-pushed the gateway-botocore-integration branch from 9d4ae7e to 93574e3 Compare May 16, 2023 00:11
@thrau thrau added this to the Playground milestone Jul 13, 2023
@thrau thrau force-pushed the gateway-botocore-integration branch from 93574e3 to 69e4e34 Compare September 25, 2023 12:27
@github-actions
Copy link

LocalStack Community integration with Pro

       2 files         2 suites   1h 12m 8s ⏱️
2 218 tests 1 721 ✔️ 497 💤 0
2 219 runs  1 721 ✔️ 498 💤 0

Results for commit 69e4e34.

@thrau
Copy link
Member Author

thrau commented Jun 17, 2024

using ben's PR instead #9569

@alexrashed alexrashed deleted the gateway-botocore-integration branch October 30, 2024 10:14
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.

2 participants