Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make brotli compression quality configurable #942

Copy link
Copy link

Description

@vdusek
Issue body actions

PR #927 added optional brotli request-body compression. The brotli quality is currently hardcoded to 6 in src/apify_client/http_clients/_base.py:

_brotli_compress = functools.partial(brotli.compress, quality=6)

Quality 6 is a reasonable default (better ratio than gzip, much lower CPU than brotli's max quality 11), and it's documented as such in docs/02_concepts/13_compression.mdx. But it's not tunable: users who want maximum compression (quality 11) for bandwidth-bound workloads, or a lower quality to save CPU, currently have no way to change it.

Proposal

Expose the compression quality as a client-level configuration option instead of relying only on the hardcoded value. Points to decide during design:

  • A client parameter (e.g. on ApifyClient / the HTTP client) to override the brotli quality, defaulting to the current 6.
  • Whether to also make the gzip compression level configurable for symmetry.
  • Whether to let users force a specific algorithm rather than relying purely on import-based auto-detection (br when brotli is importable, gzip otherwise) — the current behavior flips to brotli whenever the brotli package is present in the environment, even if it was pulled in transitively.

Context

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request.New feature or request.t-toolingIssues with this label are in the ownership of the tooling team.Issues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.