-
Notifications
You must be signed in to change notification settings - Fork 52
feat: optional throttling when reading blocks from the chain #2966
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
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.
Pull request overview
This PR adds optional throttling functionality to the CardanoBlockScanner and BlockStreamer to reduce CPU load during block import operations. The throttling ensures a minimum interval between consecutive block polls, helping to limit resource consumption on aggregator and signer infrastructure.
Changes:
- Implemented
BlockStreamerWithThrottlingdecorator to throttle block polling operations - Added
cardano_transactions_block_streamer_throttling_intervalconfiguration parameter with 400ms default - Configured throttling in both signer and aggregator dependency injection with the new parameter
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/block_streamer_with_thottling.rs |
New throttling decorator implementation with comprehensive tests |
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/block_scanner.rs |
Added throttling interval support and conditional wrapper logic |
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/mod.rs |
Registered new throttling module |
internal/cardano-node/mithril-cardano-node-chain/Cargo.toml |
Added tokio test-util feature for paused time testing |
mithril-signer/src/configuration.rs |
Added throttling interval configuration field with 400ms default |
mithril-signer/src/dependency_injection/builder.rs |
Applied throttling interval to block scanner |
mithril-aggregator/src/configuration.rs |
Added throttling interval configuration field with 400ms default |
mithril-aggregator/src/dependency_injection/builder/enablers/cardano_node.rs |
Applied throttling interval to block scanner |
mithril-test-lab/mithril-end-to-end/src/mithril/signer.rs |
Configured 30ms throttling for faster end-to-end tests |
mithril-test-lab/mithril-end-to-end/src/mithril/aggregator.rs |
Configured 30ms throttling for faster end-to-end tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/mod.rs
Outdated
Show resolved
Hide resolved
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/block_scanner.rs
Outdated
Show resolved
Hide resolved
c71c4aa to
e28e426
Compare
jpraynaud
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.
LGTM 👍
internal/cardano-node/mithril-cardano-node-chain/src/chain_scanner/block_scanner.rs
Outdated
Show resolved
Hide resolved
e28e426 to
f9aeb37
Compare
turmelclem
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.
LGTM 👍
…igner With a default configuration value of `400ms`
Use an interval of `30ms` to keep the throttler enabled but without slowing the scenarios.
f9aeb37 to
1f3fd68
Compare
* mithril-cardano-node-chain from `0.1.16` to `0.1.17` * mithril-aggregator from `0.8.16` to `0.8.17` * mithril-signer from `0.3.11` to `0.3.12` * mithril-end-to-end from `0.4.116` to `0.4.117`
Content
This PR add an optional throttling ability to the
CardanoBlockScannerandBlockStreamerused to poll blocks from the chain. The goal is to reduce the aggregator and signer load on the servers when running the import process (which take more than 60% of the CPU time today).It works by configuring an interval in milliseconds, the throttler then ensure that each calls that polls an group of blocks from the
BlockStreamertake at least the given time, if the calls was slower than the interval it execute immediately.It's configured with a default value of
400msin the signer and aggregator, and setting the configuration value to0disable the throttler entirely.Pre-submit checklist
Issue(s)
Closes #2909