Skip to content

feat(picod): add gzip middleware for response compression#339

Open
Abhinav-kodes wants to merge 1 commit into
volcano-sh:mainfrom
Abhinav-kodes:feat-picod-gzip
Open

feat(picod): add gzip middleware for response compression#339
Abhinav-kodes wants to merge 1 commit into
volcano-sh:mainfrom
Abhinav-kodes:feat-picod-gzip

Conversation

@Abhinav-kodes
Copy link
Copy Markdown
Contributor

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.md design doc.

By injecting the gin-contrib/gzip middleware, 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 bulky stdout/stderr payloads from /api/execute or downloading large text/JSON files via /api/files/*path.

The middleware uses standard content negotiation:

  • Clients requesting Accept-Encoding: gzip will receive compressed payloads.
  • Clients not supporting compression will seamlessly fall back to plain text.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

  • Downgraded gin-contrib/gzip explicitly to v1.0.1 to maintain compatibility with the project's Go 1.24.4 toolchain, avoiding unintended transitive upgrades to Go 1.25.0+.
  • Uses gzip.DefaultCompression (level 6) to provide the optimal balance between high compression ratios and low CPU overhead.
  • All existing tests pass, as compression is completely transparent to the application logic.

Does this PR introduce a user-facing change?:

Added Gzip compression support to the PicoD daemon to significantly improve file transfer and command execution speeds over constrained networks.

Copilot AI review requested due to automatic review settings May 14, 2026 18:34
@volcano-sh-bot volcano-sh-bot added the kind/enhancement New feature or request label May 14, 2026
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevin-wangzefeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/picod/server.go Outdated
Signed-off-by: Abhinav Singh <abhinavsingh717073@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.14%. Comparing base (524e55e) to head (3f3db68).
⚠️ Report is 54 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     
Flag Coverage Δ
unittests 49.14% <100.00%> (+1.57%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants