-
Notifications
You must be signed in to change notification settings - Fork 438
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
feat: Improved latency for executeStreaminSql calls #7254
Merged
Merged
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
bshaffer
reviewed
Apr 25, 2024
bshaffer
requested changes
Apr 25, 2024
Update GrpcTest Co-authored-by: Brent Shaffer <[email protected]>
bshaffer
approved these changes
Apr 26, 2024
@saranshdhingra @bshaffer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Earlier the
encodeMessage
was used to convert thePartialResultSet
proto to an array. Now, with googleapis/gax-php#554 in GAX, we can provide a way to convert the proto to an array which gets us this huge improvement in the conversion. The improvements are visible specially when the protobuf PECL extension is enabled.A few tests that I ran:
On my local mac (Protobuf extension enabled):
Test 1:
Load a proto with JSON size ~ 1MB
Time to serialize the proto into an array:
Without this fix: 810 ms
With this fix: 28 ms
Test 2:
Call a
SELECT * FROM <table> LIMIT 100
(23 column table) using$database->execute
twice. The time recorded is end-to-end, including looping through the results. Please note that, the first query can often be slower due to many network/GRPC related reasons.Without this fix:
Iteration 1 completed in 110.547951 ms
Iteration 2 completed in 80.933988 ms
With this fix:
Iteration 1 completed in 76.404962 ms
Iteration 2 completed in 57.99326 ms
Test 3:
Call a
SELECT * FROM <table> LIMIT 10000
(23 column table) using$database->execute
twice. The time recorded is end-to-end, including looping through the results. Please note that, the first query can often be slower due to many network/GRPC related reasons.Without this fix:
Iteration 1 completed in 4.09 s
Iteration 2 completed in 3.37 s
With this fix:
Iteration 1 completed in 706.560961 ms
Iteration 2 completed in 321.485171 ms
On a high power compute VM (protobuf enabled)
Test 1:
Load a proto with JSON size ~ 1MB
Time to serialize the proto into an array:
Without this fix: 345 ms
With this fix: 42 ms
Test 2:
Call a
SELECT * FROM <table> LIMIT 100
(23 column table) using$database->execute
twice. The time recorded is end-to-end, including looping through the results. Please note that, the first query can often be slower due to many network/GRPC related reasons.Without this fix:
Iteration 1 completed in 31 ms
Iteration 2 completed in 26 ms
With this fix:
Iteration 1 completed in 16 ms
Iteration 2 completed in 15 ms
Test 3:
Call a
SELECT * FROM <table> LIMIT 10000
(23 column table) using$database->execute
twice. The time recorded is end-to-end, including looping through the results. Please note that, the first query can often be slower due to many network/GRPC related reasons.Without this fix:
Iteration 1 completed in 1.83 s
Iteration 2 completed in 1.78 s
With this fix:
Iteration 1 completed in 204 ms
Iteration 2 completed in 185 ms
It's important to note that in tests 2 and 3, there are many more factors involved like the regions of the application and Spanner instance, internet speed, machine capabilities.