feat(picod): add gzip middleware for response compression#339
feat(picod): add gzip middleware for response compression#339Abhinav-kodes wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces Gzip response compression to the Gin server by adding the github.com/gin-contrib/gzip dependency and registering it as global middleware. Feedback suggests optimizing the compression level to BestSpeed to reduce CPU overhead and excluding the /health endpoint from compression to avoid unnecessary processing for small responses.
Signed-off-by: Abhinav Singh <abhinavsingh717073@gmail.com>
a1f2284 to
3f3db68
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #339 +/- ##
==========================================
+ Coverage 47.57% 49.14% +1.57%
==========================================
Files 30 30
Lines 2819 2859 +40
==========================================
+ Hits 1341 1405 +64
+ Misses 1338 1301 -37
- Partials 140 153 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What type of PR is this?
/kind enhancement
/kind feature
What this PR does / why we need it:
This PR implements Gzip compression for the PicoD daemon, fulfilling one of the planned network enhancements in the
picod-proposal.mddesign doc.By injecting the
gin-contrib/gzipmiddleware, the PicoD server can now perform on-the-fly compression for HTTP responses. This drastically reduces network bandwidth and improves latency for large data transfers, such as retrieving bulkystdout/stderrpayloads from/api/executeor downloading large text/JSON files via/api/files/*path.The middleware uses standard content negotiation:
Accept-Encoding: gzipwill receive compressed payloads.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
gin-contrib/gzipexplicitly tov1.0.1to maintain compatibility with the project's Go1.24.4toolchain, avoiding unintended transitive upgrades to Go 1.25.0+.gzip.DefaultCompression(level 6) to provide the optimal balance between high compression ratios and low CPU overhead.Does this PR introduce a user-facing change?: