Skip to content
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(storage): faster InsertObject() uploads #9997

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Oct 7, 2022

With this change the client library will optimistically use a randomly generated string as a message boundary, but will not validate if the string appears in the payload.

The new behavior makes sense as (1) it saves about 2ms of client CPU time for 128MiB uploads, (2) if there is a collision this will be detected by the service via the upload checksums, and (3) the probability of a collision is small.

The current implementation has a population of more than $10^{100}$ strings to pick from. The probability of finding this string in a EB of data is less than $1 / 10^{95}$. You could upload a EB of data per second for a billion years and still not find a collision.


This change is Reviewable

With this change the client library will only validate message
boundaries for `InsertObject()` **only** if requested. The
new default makes sense as (1) it saves about 2ms of client
CPU time for 128MiB uploads, (2) if there is a collision this will be
detected by the service via the upload checksums, and (3) the
probability of a collision is small. The current implementation has
a population of more than $$10^100$$ strings to pick from. The
probability of finding this string in a EB of data is less than
$$1 / 10^95$$.  You could upload a EB of data per second for a billion
years and still not find a collision.
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Oct 7, 2022
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: cc0033ad65756adf9ced50245885c9683106925f

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Oct 7, 2022

Codecov Report

Base: 94.22% // Head: 94.23% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (ef7b242) compared to base (1d2f953).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9997   +/-   ##
=======================================
  Coverage   94.22%   94.23%           
=======================================
  Files        1501     1501           
  Lines      141086   141085    -1     
=======================================
+ Hits       132943   132948    +5     
+ Misses       8143     8137    -6     
Impacted Files Coverage Δ
google/cloud/storage/internal/curl_client.h 100.00% <ø> (ø)
google/cloud/storage/internal/curl_client.cc 98.81% <100.00%> (-0.01%) ⬇️
...loud/storage/internal/generate_message_boundary.cc 88.88% <100.00%> (+7.07%) ⬆️
...ge/internal/generate_message_boundary_benchmark.cc 98.14% <100.00%> (+0.18%) ⬆️
google/cloud/storage/internal/rest_client.cc 73.85% <100.00%> (-0.06%) ⬇️
...e/cloud/spanner/testing/cleanup_stale_instances.cc 75.40% <0.00%> (-3.28%) ⬇️
...sub/internal/batching_publisher_connection_test.cc 99.44% <0.00%> (-0.19%) ⬇️
google/cloud/pubsub/samples/samples.cc 90.70% <0.00%> (-0.08%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: e77232cadddea1c38b4449dcade1fbd21285de4e

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: ef7b2429b7b822bff37af5abc2c3e1bcda76a84c

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

Copy link
Contributor

@devbww devbww left a comment

Choose a reason for hiding this comment

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

Obligatory reminder to update the commit message.

@coryan coryan marked this pull request as ready for review October 7, 2022 19:01
@coryan coryan requested a review from a team as a code owner October 7, 2022 19:01
@coryan coryan enabled auto-merge (squash) October 7, 2022 19:05
@coryan coryan disabled auto-merge October 7, 2022 19:06
@coryan coryan enabled auto-merge (squash) October 7, 2022 19:06
@coryan coryan merged commit 0851a91 into googleapis:main Oct 7, 2022
@coryan coryan deleted the feat-storage-I-am-feeling-lucky branch October 7, 2022 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants