-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
add in-memory ASF request dispatching for boto clients #9569
Open
bentsku
wants to merge
11
commits into
master
Choose a base branch
from
gateway-botocore-integration-ben
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
bentsku
added
area: asf
semver: minor
Non-breaking changes which can be included in minor releases, but not in patch releases
labels
Nov 7, 2023
bentsku
force-pushed
the
gateway-botocore-integration-ben
branch
2 times, most recently
from
November 9, 2023 09:41
71efcc8
to
4a28905
Compare
bentsku
force-pushed
the
gateway-botocore-integration-ben
branch
from
January 10, 2024 16:58
4a28905
to
4229261
Compare
LocalStack Community integration with Pro 2 files 2 suites 1h 43m 15s ⏱️ Results for commit e8a9390. ♻️ This comment has been updated with latest results. |
bentsku
force-pushed
the
gateway-botocore-integration-ben
branch
3 times, most recently
from
May 21, 2024 10:53
6e40664
to
a8249ce
Compare
bentsku
force-pushed
the
gateway-botocore-integration-ben
branch
from
May 23, 2024 11:01
20308e7
to
011b952
Compare
thrau
force-pushed
the
gateway-botocore-integration-ben
branch
from
May 24, 2024 16:59
011b952
to
45591a0
Compare
bentsku
force-pushed
the
gateway-botocore-integration-ben
branch
from
May 29, 2024 12:32
45591a0
to
e8a9390
Compare
thrau
force-pushed
the
gateway-botocore-integration-ben
branch
from
June 1, 2024 18:47
e8a9390
to
430d6fc
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: asf
semver: minor
Non-breaking changes which can be included in minor releases, but not in patch releases
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
Taken from #7396 from @thrau:
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:
localstack.runtime.components
as a place for runtime-level singleton componentsGateway
with the signaturedef 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).I believe we could merge this as is, as it's only opt-in, and we could improve in follow-up iterations. We'd at least get a preview version of it, and we can give it more tries.
Benchmarks:
Results:
In-memory only with cloudwatch SQS metrics + SNS delivery logs:
1000 requests took 34.5011 s = 34.5011 ms/op = 28.98 req/sec
All fixes:
1000 requests took 9.7307 s = 9.7307 ms/op = 102.77 req/sec
Testing
Ext Integration Tests 6506 ✅
Successful run with the flag enabled: https://app.circleci.com/pipelines/github/localstack/localstack/25062/workflows/401a985e-e287-483e-82f3-229daf251654
TODO:
connect_to