polygon-edge icon indicating copy to clipboard operation
polygon-edge copied to clipboard

Add gzip stream compression support

Open zivkovicmilos opened this issue 3 years ago • 2 comments

Description

This PR adds support for libp2p stream compressions, namely it introduces 2 stream compression types:

  • no compression
  • gzip

Changes include

  • [ ] Bugfix (non-breaking change that solves an issue)
  • [ ] Hotfix (change that solves an urgent issue, and requires immediate attention)
  • [x] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • [x] I have assigned this PR to myself
  • [x] I have added at least 1 reviewer
  • [x] I have added the relevant labels
  • [ ] I have updated the official documentation
  • [x] I have added sufficient documentation in code

Testing

  • [x] I have tested this code with the official test suite
  • [x] I have tested this code manually

Manual tests

Regular cluster deployment with compression support enables. Tested multiple nodes with different compression configurations

Documentation update

// TODO

Additional comments

// TODO post benchmark results

zivkovicmilos avatar Apr 15 '22 17:04 zivkovicmilos

Is this change backward compatible with running clients?

ferranbt avatar Apr 15 '22 23:04 ferranbt

Hey @ferranbt,

Yes! The idea is for this compression layer to be optional, where clients would negotiate which compression layer to use (if any). This way, if one of them supports compression, but the other one doesn't, or they support differing compression layers - they can always fall back to uncompressed streams.

The PR is still in draft because we're playing around with this idea in order to get some metrics on the savings. It will see other drastic changes until it's ready for review and mergeable - but the base idea will stay the same: allow clients to negotiate compression layers for streams, and fallback to uncompressed streams in case it's not possible to come to an agreement.

zivkovicmilos avatar Apr 16 '22 08:04 zivkovicmilos

Closed due to archiving

zivkovicmilos avatar Oct 07 '22 15:10 zivkovicmilos