Repository navigation
Conversation
Read chunks of 1 MiB or more are verified inline on the event-loop thread again by default, so the CRC32C worker pool never starts. Setting GCS_PYTHON_CLIENT_CRC32C_OFFLOAD to 1 (or true, yes, on) hashes them on the pool instead. The variable is read when a chunk arrives, so a library can opt in before it opens a stream. The threshold is fixed at google-crc32c's GIL-release threshold (1 MiB), and GCS_PYTHON_CLIENT_CRC32C_OFFLOAD_MIN_BYTES is removed. In the SDK and gcsfs read microbenchmarks, offloading gained 22% to 47% when several streams shared one event loop and chunks reached the destination as memoryview slices. With one stream per loop it showed no consistent gain, and with the generated parser or accepts_memoryview=False, gcsfs lost in 9 of 18 read cases.
This file contains hidden or 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
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.
Summary
This makes the off-loop CRC32C verification from googleapis#18628 opt-in before it ships.
GCS_PYTHON_CLIENT_CRC32C_OFFLOAD=1, read chunks of 1 MiB or more are verified on the worker pool, as in perf(storage): verify CRC32C of large read chunks off the event-loop thread googleapis/google-cloud-python#18628.Offloading helps most when several streams share one event loop and chunks reach the destination without a
bytescopy (the zero-copy parser with a google-crc32c that acceptsmemoryview, andaccepts_memoryview=Trueor a buffer destination). With one stream per loop it shows no consistent gain, and with the generated parser oraccepts_memoryview=False, gcsfs loses in 9 of 18 read cases:c4-standard-192, median MiB/sread,seq 16p_1t16 MiB, generated parserread,seq 1p_1t1 MiB, zero-copy,accepts_memoryview=Falsetime_based/reads,seq 8p_16c, 1 stream per process, generated parsertime_based/reads,seq 8p_16c, 4 streams per process, zero-copy,accepts_memoryview=Trueread,seq 1p_32t100 MiB, zero-copy,accepts_memoryview=TrueThe SDK benchmark opens one stream per process. The 4-stream row passes
MultiStreamConfig(min_streams=4, max_streams=4).Changes
GCS_PYTHON_CLIENT_CRC32C_OFFLOADreplacesGCS_PYTHON_CLIENT_CRC32C_OFFLOAD_MIN_BYTES, which never shipped.1,true,yesoron, the same values asGCS_PYTHON_CLIENT_ZERO_COPY_BIDI_READ.enable_checksumdocstring ofdownload_rangesnow describes the opt-in.test_mrd_zero_copy_bidi_readopts in, so the Rapid system test still covers the offload path.Testing