-
Notifications
You must be signed in to change notification settings - Fork 519
network: vote compression benchmarks and tooling #6467
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
Conversation
jannotti
left a comment
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.
I guess! That's a lot of code. I guess it benchmarks?
I don't see much reason not to approve a tooling addition.
|
@jannotti removed/shrunk some things and it is now less code |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6467 +/- ##
==========================================
- Coverage 47.54% 47.41% -0.14%
==========================================
Files 666 659 -7
Lines 88500 88393 -107
==========================================
- Hits 42081 41908 -173
- Misses 43658 43710 +52
- Partials 2761 2775 +14 ☔ View full report in Codecov by Sentry. |
f0045e9 to
4eae592
Compare
Summary
This provides benchmark code and algodump tooling for capturing network traffic and running compression on it with different window sizes, used during the development of #6351 and #6276.
Context: Previous Release (Stateless Compression)
PR #6276 and the v4.1.1 release added stateless vote compression (enabled by default with
EnableVoteCompression), achieving ~25% bandwidth reduction for vote traffic with zero memory overhead and no per-connection state. Since not everyone upgrades unless necessary, the consensus upgrade in the v4.3.0 release had a side effect of ensuring all nodes on the network are now using stateless vote compression.Stateful Compression: Additional Savings
PR #6351 and the upcoming v4.4.1 release adds optional stateful vote compression and introduces a new configuration option
StatefulVoteCompressionTableSizethat defaults to 2048, a suitable maximum table size for regular nodes that maintain ~4 connections. (The encoder and decoder both requireStatefulVoteCompressionTableSize*224 bytes, plus 800 bytes of fixed overhead per direction.) With the default table size of 2048, the memory overhead for regular nodes is ~3.5 MB for 4 connections or ~7 MB for 8 connections.Relays and nodes that maintain many connections may want to set a lower
StatefulVoteCompressionTableSize, based on memory budget and bandwidth costs.How it works: Stateful vote compression (#6351) maintains LRU tables on both ends of a connection to cache recently seen sender addresses, public keys, and signatures, converting them to short references. (Proposal values are also cached by a small sliding window.) Larger tables remember more past data, improving compression when votes from the same validators repeat across rounds. Memory cost is per bidirectional connection (encoder + decoder state for both send and receive directions).
Note: These memory estimates assume votes are flowing in both directions on all 2400 connections. Since most connected nodes are non-participating (and only receive votes to follow the chain, requiring compression state for just one direction), actual relay memory usage will typically be lower than these maximums.
Benchmark Results
Since compression performance is dependent on the distribution of stake, this is from a fresh capture of 98,170 vote messages from mainnet today (2025-11-06).
For a relay with 2400 connections (maximum):
All configurations achieve ~1800 MB/s compression throughput and ~3800 MB/s decompression throughput, with zero allocs/op (after the tables are allocated).
Raw Benchmark Output