Context and Motivation
Compact blocks significantly improve block propagation efficiency by reducing bandwidth usage and latency during transmission. Precise benchmarking of compact block reconstruction performance is crucial for detecting regressions or improvements across releases, especially when modifying related code paths affecting mempool behavior or block relay performance.
Recent analysis by B10C
highlights significant variance in compact block reconstruction efficiency depending on mempool conditions. Specifically, during periods of high mempool congestion, reconstruction success rates frequently dropped below 50%, requiring additional transaction requests and significantly increasing reconstruction times. Additionally, enabling mempoolfullrbf
was found to notably improve reconstruction efficiency, underscoring the importance of consistent mempool policies.
Proposal: Compact Block Reconstruction Macro Benchmark Suite
The goal is to create a robust macro benchmark suite measuring the performance of compact block reconstruction across Bitcoin Core releases and different node configurations. This suite would provide consistent and actionable data when reviewing changes to relevant code paths.
As part of our macro benchmarking efforts - and as Gregory Sanders also outlined in recent Benchmarking meeting notes - we propose:
- Setting up a node by syncing up to a known block height (e.g., block 840,000, ideally via quick AssumeUTXO seeding).
- Fetching the next few blocks from the network (lazy-init from network, caching the blocks locally) and adding their transactions to the local mempool.
- Replaying compact block announcements and measuring reconstruction performance (multiple times for consistent and statistically meaningful results, given variability compared to stable micro-benchmarks).
- Testing under different mempool scenarios and configurations (e.g., varying
mempoolfullrbf
settings):- Fully populated mempool (asserting the mempool contains every transaction).
- Single transaction missing (note that this will require unreliable network traffic unless we also add a local node that serves these transactions).
- Empty mempool.
RFC / Questions:
- Should this benchmark run periodically (weekly, pre-release), or should it be triggered automatically via GitHub labels on relevant PRs?
- Are there additional configurations or mempool states worth considering (such as the
mempoolfullrbf
discovery above)? - Should we measure performance for arbitrary block heights and varying subsequent block counts?