cosmo icon indicating copy to clipboard operation
cosmo copied to clipboard

Ability to configure the min size for response compression

Open mrpahdan opened this issue 4 months ago • 2 comments

Component(s)

router

Is your feature request related to a problem? Please describe.

When making a request to the router, if the response is under 4KB, the response returned is not compressed. If the router receives a lot of small requests, there's a lot of unnecessary network traffic. This is an issue for router hosted in various cloud providers where data transfer costs through gateways and across networks incurs a cost.

Describe the solution you'd like

I would like to introduce a new configuration item called: response_compression_min_size.

It would sit under the yaml: traffic_shaping.router as such:

traffic_shaping:
  router:
    response_compression_min_size: 1KB

This configuration item would be consumed here

The default value should be set to 4KB so the same setting is applied.

see proposed solution: https://github.com/wundergraph/cosmo/commit/dd443fb310db10c93650d5f118aacfae43a0c737

Describe alternatives you've considered

No response

Additional context

No response

mrpahdan avatar Jul 17 '25 06:07 mrpahdan