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

feat: add gzip middleware #2178

Merged
merged 4 commits into from
Oct 20, 2021
Merged

feat: add gzip middleware #2178

merged 4 commits into from
Oct 20, 2021

Conversation

nic-6443
Copy link
Member

@nic-6443 nic-6443 commented Oct 20, 2021

Add gzip middleware to optimize user experience in a weak network environment.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

Related issues

fix/resolve #2165

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2021

Codecov Report

Merging #2178 (09f6f70) into master (9f17637) will increase coverage by 6.81%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2178      +/-   ##
==========================================
+ Coverage   62.70%   69.51%   +6.81%     
==========================================
  Files          62      189     +127     
  Lines        3928     7276    +3348     
  Branches        0      823     +823     
==========================================
+ Hits         2463     5058    +2595     
- Misses       1178     1922     +744     
- Partials      287      296       +9     
Flag Coverage Δ
backend-e2e-test 46.34% <100.00%> (+0.75%) ⬆️
backend-e2e-test-ginkgo 49.35% <100.00%> (?)
backend-unit-test 50.39% <ø> (ø)
frontend-e2e-test 68.18% <ø> (?)

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

Impacted Files Coverage Δ
api/internal/route.go 87.17% <100.00%> (+0.33%) ⬆️
web/src/components/Plugin/service.ts 96.29% <0.00%> (ø)
web/src/components/Plugin/UI/cors.tsx 89.28% <0.00%> (ø)
...omponents/passive-check/Unhealthy/HttpStatuses.tsx 8.33% <0.00%> (ø)
web/src/components/RawDataEditor/RawDataEditor.tsx 38.96% <0.00%> (ø)
...src/pages/SSL/components/CertificateForm/index.tsx 100.00% <0.00%> (ø)
web/src/components/Upstream/components/Scheme.tsx 100.00% <0.00%> (ø)
...nents/Upstream/components/ServiceDiscoveryArgs.tsx 100.00% <0.00%> (ø)
web/src/pages/SSL/components/Step1/index.tsx 40.00% <0.00%> (ø)
...components/active-check/HttpsVerifyCertificate.tsx 33.33% <0.00%> (ø)
... and 142 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f17637...09f6f70. Read the comment docs.

@bzp2010
Copy link
Contributor

bzp2010 commented Oct 20, 2021

@nic-6443 Because the frontend static files are not compiled and correctly placed during the backend E2E test, the server will respond to 404 errors. Just ignore it.

@bzp2010
Copy link
Contributor

bzp2010 commented Oct 20, 2021

@nic-6443 I have fixed this problem.
By the way, have you tested the effect of gzip compression on speeding up the transmission of static resources in your local environment?

@nic-6443
Copy link
Member Author

@nic-6443 I have fixed this problem. By the way, have you tested the effect of gzip compression on speeding up the transmission of static resources in your local environment?

Yes, static files size decrease greatly after gzip.
image
According to the maximum file size (~500k) and 5s timeout, then the network transmission speed is greater than 100 KB/s, it can work normally.

@bzp2010
Copy link
Contributor

bzp2010 commented Oct 20, 2021

@nic-6443 I have fixed this problem. By the way, have you tested the effect of gzip compression on speeding up the transmission of static resources in your local environment?

Yes, static files size decrease greatly after gzip. image According to the maximum file size (~500k) and 5s timeout, then the network transmission speed is greater than 100 KB/s, it can work normally.

Nice job!

@bzp2010
Copy link
Contributor

bzp2010 commented Oct 20, 2021

LGTM

ping @nic-chen @starsz

@bzp2010 bzp2010 merged commit 05e10ff into apache:master Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP server write timeout value too small
5 participants