-
Notifications
You must be signed in to change notification settings - Fork 221
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
accept gzip encoding #365
accept gzip encoding #365
Conversation
Codecov Report
@@ Coverage Diff @@
## main #365 +/- ##
==========================================
+ Coverage 80.94% 81.41% +0.47%
==========================================
Files 5 5
Lines 677 678 +1
==========================================
+ Hits 548 552 +4
+ Misses 99 97 -2
+ Partials 30 29 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Could you add a little bit of context please? |
Internally our testing of the [edit] math on whether this would work or not[end edit] did show a time to last packet reduction in deliveries of blocks of roughly 1-5ms depending on the resources of the validator. Additionally this change can lead to more time for validators to propose on chain and thereby potentially lead fewer missing proposals though more efficient packet transport over the wider internet. |
added some more context @metachris , didn't realize drafts showed up in public repos whoops! |
Thanks. It seems |
Very cool feature btw and just 1 line of code with significant impact. I strongly support this. |
Co-authored-by: Chris Hager <chris@linuxuser.at>
Awesome good fix! I added a note to the PR as well that for relays and others to enable this make sure you configure your reverse proxy [HA Proxy, NGINX, etc] to support gzip! |
The test that lint is tripping up passes for me locally 🤔 |
Failing lint step fixed in #374 |
@dmarzzz could you add a test where the mockserver returns a gzipped response? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice addition. Thanks!
test for gzip response
@metachris thanks appreciate it, wasn't able to get to it till this weekend. When I merged it auto dismissed @jtraglia review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Thanks for the extra test.
* accept gzip encoding * Capitalize and remove deflate Co-authored-by: Chris Hager <chris@linuxuser.at> * test for gzip response Co-authored-by: Chris Hager <chris@linuxuser.at>
📝 Summary
From a discussion with @zeroecco on how to lower bandwidth on the blocknative relay we came to the idea that we could utilize well known compression like gzip, but only if requests coming from mev-boost specified that.
Minimum transmittable unit is 1500 Bytes total w/ 1250 Bytes realistically usable and a block is around ~12KB, gzip will compress ~60% to ~6Kb which would be a packet reduction from 10 to 5 for the total packet train. This also reduces time to last packet and bandwidth, which could be 1 - 5ms based on response time at this size.
If a system doesn't have this enabled the content-encoding will simply be ignored.
On top of that, this improvement will really only be visible for GetPayload response.
To benefit from this in your relay or other components make sure you configure your reverse proxy [HA Proxy, NGINX, etc] to support gzip!
⛱ Motivation and Context
I want to go fast
📚 References
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
https://www.rfc-editor.org/rfc/rfc2616#section-3.5
✅ I have run these commands
make lint
make test-race
go mod tidy