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

Compress HTTP with GZip where available #837

Merged
merged 1 commit into from
May 17, 2022
Merged

Compress HTTP with GZip where available #837

merged 1 commit into from
May 17, 2022

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Nov 12, 2021

The server behind GitHub URLs supports GZip compressed content encoding, which we can leverage to compress the YAML database behind rosdep substantially.

This reduces the typical bandwidth usage of a call to rosdep update by 84%, from 410KiB to 64KiB. It doesn't appear to change the runtime performance on a moderately fast internet connection, but might be very helpful on less performant connections.

Note that there are a lot of other improvements we could make here, such as streaming the content from the URL directly through the GZip decompression to the YAML parser and using a context to close the connection instead of explicitly calling .close(). We should consider those improvements when we drop support for Python 2.

The server behind GitHub URLs supports GZip compressed content encoding,
which we can leverage to compress the YAML database behind rosdep
substantially.

This reduces the typical bandwidth usage of a call to `rosdep update` by
84%, from 410KiB to 64KiB. It doesn't appear to change the runtime
performance on a moderately fast internet connection, but might be very
helpful on less performant connections.
@cottsay cottsay self-assigned this Nov 12, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2021

Codecov Report

Merging #837 (7e7d158) into master (be780c4) will not change coverage.
The diff coverage is 96.55%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #837   +/-   ##
=======================================
  Coverage   74.96%   74.96%           
=======================================
  Files          42       43    +1     
  Lines        3311     3311           
=======================================
  Hits         2482     2482           
  Misses        829      829           
Impacted Files Coverage Δ
src/rosdep2/url_utils.py 95.00% <95.00%> (ø)
src/rosdep2/gbpdistro_support.py 95.28% <100.00%> (-0.13%) ⬇️
src/rosdep2/platforms/source.py 90.44% <100.00%> (-0.16%) ⬇️
src/rosdep2/rep3.py 100.00% <100.00%> (ø)
src/rosdep2/sources_list.py 85.40% <100.00%> (-0.19%) ⬇️

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 be780c4...7e7d158. Read the comment docs.

Copy link
Contributor

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

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

I'm always caught off guard when compression has to be enabled and handled rather than being the default. This is an easy enough handler to add and will be a huge benefit, especially for rosdep users who are far from the GitHub network or on constrained connections.

We've avoided additional dependencies like requests in ros-infrastructure packages in order to keep the dependency tree tight but someday we might look at https://urllib3.readthedocs.io For now though I still don't think it's worth the overhead.

@cottsay cottsay merged commit 3d6b882 into master May 17, 2022
@cottsay cottsay deleted the cottsay/gzip branch May 17, 2022 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants