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

Support sending gzipped request body when uploading #2004

Merged
merged 10 commits into from
May 23, 2023
Merged

Support sending gzipped request body when uploading #2004

merged 10 commits into from
May 23, 2023

Conversation

omarismail94
Copy link
Contributor

@omarismail94 omarismail94 commented May 10, 2023

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #1988

Description

  • Support sending gzipped request body when uploading to the server. Inspired by the recipe in the OKHttp repo to do this
  • Make uploading with gzip an option that developers can set
  • No need to add code to support download as OkHTTP does this for us automatically
  • Tested on local HAPI server and it works

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

Copy link
Collaborator

@aditya-07 aditya-07 left a comment

Choose a reason for hiding this comment

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

Nice PR @omarismail94 . Left a few comments.

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Great PR thanks omar!

if you can, please also test on gcp, and if possible, azure, ibm, firely. and knowing the default behavious of all these servers will help us make an informed decision on the default value of the new network config.

Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

Great PR thanks omar!

if you can, please also test on gcp, and if possible, azure, ibm, firely. and knowing the default behavious of all these servers will help us make an informed decision on the default value of the new network config.

@omarismail94
Copy link
Contributor Author

omarismail94 commented May 22, 2023

@aditya-07 @jingtang10 resolved all comments

@omarismail94
Copy link
Contributor Author

I re-ran the benchmark to see how adding content-length influences the time taken to upload and plotted the results below. Yes, it does increase at a faster rate as more data is compressed, but I think for now, this is OK. Even if we do upgrade to the OkHttp library that adds the content length for us, it does so in the same way we do, so we would face the same issue. The alternative is to have the gzip interceptor after the HttpLoggingInterceptor, however, that would mean the LoggingInterceptor would be printing the content-length of the uncompressed request

with addContentLength and without addContentLength

@omarismail94 omarismail94 merged commit 3d6c259 into google:master May 23, 2023
1 of 2 checks passed
@omarismail94 omarismail94 deleted the gzip branch May 23, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Support sending gzipped request body
5 participants