DRIVER-409 Add gzip request compression - #54
Merged
Conversation
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.
Jira: https://scylladb.atlassian.net/browse/DRIVER-409
Closes #22
Summary
Config::request_compressorAPI and built-inGzipRequestCompressor, disabled by default unless configured.HttpRequestCompressor::Compressstream from request input to compressed output and returnfalsewhen the compressor chooses to leave the request uncompressed.GzipRequestCompressor: it skips bodies smaller than 1024 bytes by default, withGzipRequestCompressor(0)available to compress every body.Content-Encodingand exactContent-Lengthso compressed requests are not chunked.Content-Length.Configuration API
scylladb::alternator::Config cfg; cfg.request_compressor = std::make_shared<scylladb::alternator::GzipRequestCompressor>();Custom compressors implement:
Returning
falseleaves the request uncompressed, which lets implementations make their own size or content-policy decision without adding more config fields.Testing
git diff --checkcmake -S . -B build-check -DALTERNATOR_CLIENT_CPP_ENABLE_AWS=OFFcmake --build build-check -j$(nproc)ctest --test-dir build-check --output-on-failurecmake -S . -B build-no-zlib-check -DALTERNATOR_CLIENT_CPP_ENABLE_AWS=OFF -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=ONcmake --build build-no-zlib-check -j$(nproc)ctest --test-dir build-no-zlib-check --output-on-failureAWS adapter unit and integration tests were added for request compression, small-body skip behavior, and header optimization interop, but could not be compiled locally because this environment does not have
AWSSDKwith thedynamodbcomponent installed. Confirmed withcmake -S . -B build-aws-check -DALTERNATOR_CLIENT_CPP_REQUIRE_AWS=ON.