Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for response compression #602

Closed
StarpTech opened this issue Mar 5, 2024 · 23 comments
Closed

Add support for response compression #602

StarpTech opened this issue Mar 5, 2024 · 23 comments
Labels

Comments

@StarpTech
Copy link
Contributor

StarpTech commented Mar 5, 2024

Component(s)

router

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

As a user, I'd like to be able to compress data between the client <-> router to save bandwidth and improve performance.

Describe the solution you'd like

Response compression is done transparently. The user of the router doesn't need to configure anything. The exchange is done through HTTP headers Accept-Encoding. The implementation should support Gzip, Deflate and Brotli as compression methods.

We need to extend the router to compress responses. A very reasonable choice for gzip could be https://github.com/klauspost/compress/tree/master/gzhttp which also serve as good inspiration for the other methods.

Requirements:

  • No CGO.
  • Functionality must be provided in separate Go modules with unit tests and integration test. See test suite.
  • Use compression defaults that favor a good mix between compute time and space savings.

Describe alternatives you've considered

No response

Additional context

We use gin as http framework. The router engine transport can be found here https://github.com/wundergraph/cosmo/blob/main/router/core/transport.go

Previous issue #153

Copy link

github-actions bot commented Mar 5, 2024

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

@StarpTech
Copy link
Contributor Author

/bounty $200

Copy link

algora-pbc bot commented Mar 5, 2024

## 💎 $100 bounty • WunderGraph Cosmo

### Steps to solve:
1. Start working: Comment /attempt #602 with your implementation plan
2. Submit work: Create a pull request including /claim #602 in the PR body to claim the bounty
3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Important
Bounty is up for challenger for those who can independently solve the task. We're here to support you with a final review and architectural assistance, but it's designed to be a solo challenge. Certain tasks require a deep understanding of the technology and ecosystem. Please consider this before diving in and spending your time on it. You are subject to a maximum attempt of 3 and you have 3 weeks after first attempt to complete the challenge. After that, you can no longer participate in the selected bounty.

Thank you for contributing to wundergraph/cosmo!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🔴 @ibishal Mar 5, 2024, 9:56:36 PM WIP
🟢 @pi600 Mar 5, 2024, 9:57:23 PM WIP
🟢 @Rutik7066 Apr 11, 2024, 4:16:20 AM #723

@pi600
Copy link

pi600 commented Mar 5, 2024

/attempt #602
can i get assigned

@Rutik7066
Copy link
Contributor

@StarpTech do we need prehandler and posthandler to decode and encode the request body?

@Rutik7066
Copy link
Contributor

Rutik7066 commented Apr 11, 2024

/attempt #602

Algora profile Completed bounties Tech Active attempts Options
@Rutik7066 5 bounties from 4 projects
Go, Rust,
TypeScript & more
Cancel attempt

Copy link

algora-pbc bot commented Apr 11, 2024

Note

The user @pi600 is already attempting to complete issue #602 and claim the bounty. We recommend checking in on @pi600's progress, and potentially collaborating, before starting a new solution.

Copy link

algora-pbc bot commented Apr 11, 2024

💡 @Rutik7066 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

@Rutik7066
Copy link
Contributor

Hi @StarpTech I have raised the draft PR. I would appreciate your help with further development. I need to know where I should use compression and decompression functions to achieve the desired results.

@StarpTech
Copy link
Contributor Author

Hi @Rutik7066, I really like your ambitions but please respect the bounty requirements. We picked small tasks which should be solved alone. If you believe this task is too complicated, please move on with another one.

We're here to support you with a final review and architectural assistance, but it's designed to be a solo challenge.

@Rutik7066
Copy link
Contributor

Hi @StarpTech I need you help in architectural understanding in know in I have to add it as prehandler and posthandler. But I am unable to understand where other prehandler and posthandler is added.

@StarpTech
Copy link
Contributor Author

StarpTech commented Apr 11, 2024

@Rutik7066 take a look at the referenced issue #153 We want to support client response compression. This means, a middleware needs to be implemented that overwrites responseWriter to support the compression algorithm. You can use https://github.com/go-chi/chi/blob/master/middleware/compress.go
This is already almost the full story. If I assistant you more, I could the address the bounty myself 😄

@Rutik7066
Copy link
Contributor

@Rutik7066 take a look at the referenced issue #153 We want to support client response compression. This means, a middleware needs to be implemented that overwrites responseWriter to support the compression algorithm. You can use https://github.com/go-chi/chi/blob/master/middleware/compress.go
This is already almost the full story. If I assistant you more, I could the address the bounty myself 😄

Got it 🫡

@Rutik7066
Copy link
Contributor

Hi @StarpTech work is completed. Could you please review PR

@leonhfr
Copy link

leonhfr commented May 6, 2024

I'm interested in taking a shot at this, adding my name to the queue!

@Rutik7066
Copy link
Contributor

I'm interested in taking a shot at this, adding my name to the queue!

PR submitted already everything is done. I am waiting for @StarpTech to review the PR

@Rutik7066
Copy link
Contributor

Hi @StarpTech could you please review the PR

@StarpTech
Copy link
Contributor Author

StarpTech commented May 11, 2024

Hi @Rutik7066 , there is a lot going on right now. I promise to review it at the beginning of next week. Thank you for your patience.

Copy link

algora-pbc bot commented May 26, 2024

🎉🎈 @Rutik7066 has been awarded $100! 🎈🎊

@StarpTech
Copy link
Contributor Author

I have decreased the scope of the ticket and therefore also the reward. Thanks for the contribution @Rutik7066

@Rutik7066
Copy link
Contributor

@StarpTech what?

@Rutik7066
Copy link
Contributor

@StarpTech I think you know I worked because of 200$ bounty price right. If anything from my side needs to be corrected or completed then you should tell me instead of this thing.

@StarpTech
Copy link
Contributor Author

Hi @Rutik7066,

I appreciate the effort you put into the project. However, it's important to note that the requirements were clearly outlined from the start. We've provided significant guidance throughout this process, which wasn't the intent of the bounty. You have completed response compression, which is only half of the requirement, and therefore received $100 as a reward.

The issue is closed.

Thank you for your understanding and contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants