Skip to content

[DE-716] Compression of requests and responses #328

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

Merged
merged 10 commits into from
Mar 14, 2024

Conversation

apetenchea
Copy link
Member

@apetenchea apetenchea commented Feb 26, 2024

Adding compression of requests and responses, as implemented in arangodb/arangodb#20128

By default compression is turned off, so this change has no effect unless the user specifies one of the newly introduced parameters.

The ArangoClient gets two optional parameters:

  • request_compression - Represents the compression strategy, None by default. The reason for passing in an object instead of a string (such as deflate) is to allow the client to fine tune the compression algorithm.
  • response_compression - The equivalent of an Accept-Encoding string. This has no effect unless the server is configured to use encoding.
client = ArangoClient(
    hosts="http://127.0.0.1:8529",
    request_compression=DeflateRequestCompression(),
    response_compression="deflate",
)

A new documentation page has been added specifically for guiding users on how to use compression.

@apetenchea apetenchea self-assigned this Feb 26, 2024
@@ -33,7 +38,7 @@ def default_serializer(x: Any) -> str:
:return: The object serialized as a JSON string
:rtype: str
"""
return dumps(x)
return dumps(x, separators=(",", ":"))
Copy link
Member Author

Choose a reason for hiding this comment

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

Small optimization, eliminates whitespace from the JSON structure.

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.02%. Comparing base (ed35c9d) to head (3f44634).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #328   +/-   ##
=======================================
  Coverage   98.01%   98.02%           
=======================================
  Files          26       26           
  Lines        4231     4252   +21     
=======================================
+ Hits         4147     4168   +21     
  Misses         84       84           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@apetenchea apetenchea marked this pull request as ready for review March 10, 2024 14:07
Copy link
Member

@aMahanna aMahanna left a comment

Choose a reason for hiding this comment

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

lgtm!

@apetenchea apetenchea merged commit dd0be28 into main Mar 14, 2024
52 checks passed
@apetenchea apetenchea deleted the feature/de-716-request-compression branch March 14, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants