projectcontour / contour

Contour is a Kubernetes ingress controller using Envoy proxy.
https://projectcontour.io
Apache License 2.0
3.73k stars 681 forks source link

Cost saving: Feature request to enable switch to toggle Envoy compression filter #6511

Open chaosbox opened 5 months ago

chaosbox commented 5 months ago

Details: Currently, Contour attaches a compression filter to envoy httpConnectionManager by default, as a result compression is enabled everywhere. While this feature is beneficial in certain scenarios, we have observed that the associated CPU cost can be prohibitively high compared to network costs. Specifically, we've found that CPU is more expensive than network bandwidth in our use case.

Rationale: Compression is particularly useful for last-mile traffic. However, when CDNs front the ingress layer, which has dedicated bandwidth to origin servers, the network impact is negligible. In such cases, the return on investment for CPU cycles used in compression is significantly reduced. Therefore, the cost savings of disabling compression outweigh the benefits when not dealing with last-mile traffic or ingress layers meant for internal traffic.

Proposal: We propose adding a control-plane configuration option, such as --disable-compression=true, to allow users to skip compression from the default filters. This change would provide significant cost savings in scenarios where compression is not beneficial.

Reduces CPU usage and allows for more efficient use of resources by running lean Envoy instances. We believe it will add significant value for users who, like us, need to optimize for cost and resource efficiency.

Observations from Our Cluster Testing:

image
github-actions[bot] commented 5 months ago

Hey @chaosbox! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

aecay commented 5 months ago

Additional context: way back in https://github.com/projectcontour/contour/issues/310, the possibility was discussed to have a switch to disable the compression logic; this didn't wind up being implemented in the end. The cost savings we are discussing here (I am a colleague of @chaosbox 's) would effectively give another justification for adding the toggle (in addition to the security-related justification also mentioned on the linked ticket).

github-actions[bot] commented 3 months ago

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

You can:

Please send feedback to the #contour channel in the Kubernetes Slack

geomacy commented 1 month ago

Following initial implementation of the "disable-compression" suggestion above, it was suggested in code review to implement a choice of compression algorithms. This has now been done, see here.

geomacy commented 1 month ago

hi @tsaarni @davinci26 just to check, is there anything I need to do to move this issue into a "ready for review" status?