Skip to content

Add Support HTTP compression#802

Open
bgunebakan wants to merge 2 commits into
mainfrom
700-support-http-compression
Open

Add Support HTTP compression#802
bgunebakan wants to merge 2 commits into
mainfrom
700-support-http-compression

Conversation

@bgunebakan
Copy link
Copy Markdown
Contributor

@bgunebakan bgunebakan commented May 15, 2026

Adds opt-in HTTP compression support to the crate-python driver to reduce bandwidth usage and improve performance for large queries.

Summary of the changes / Why this is an improvement

  • Client-side request compression (compress_client, default: True). Outgoing JSON request bodies are gzip-compressed before being sent.
  • Server-side response compression (compress_server, default: False). The driver sends Accept-Encoding: gzip, deflate to CrateDB server when it's enabled.
  • Compression is skipped for payloads below compress_threshold bytes (default 8192)
  • 6 new unit tests covering: compression disabled, compression enabled, below-threshold skip, Accept-Encoding sent/not sent, and default-args behavior.

Small note on threshold default value:

I've changed compress_threshold to 8192 while implementing. I ran a payload-size sweep against both a local CrateDB instance and a CrateDB Cloud cluster (eu-west-1 free tier), measuring round-trip latency with and without gzip compression. I saw benefits of compression when latency included over 8kb on local and 1kb on cloud instances.

Latency can vary based on my network and cluster settings/location. I decided to move on 8kb as a default value for threshold.

Checklist

  • Link to issue this PR refers to (if applicable): Fixes Support HTTP compression #700
  • Added or Changed code is covered by tests
  • Updated documentation & CHANGES.rst

@bgunebakan bgunebakan self-assigned this May 15, 2026
@bgunebakan bgunebakan linked an issue May 15, 2026 that may be closed by this pull request
3 tasks
@bgunebakan bgunebakan requested review from amotl and mfussenegger May 15, 2026 11:19
@amotl amotl requested review from matriv and seut and removed request for amotl and seut May 15, 2026 11:35
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.

Support HTTP compression

1 participant