Skip to content

Conversation

@Alenar
Copy link
Collaborator

@Alenar Alenar commented Jan 29, 2026

Content

This PR add an optional throttling ability to the CardanoBlockScanner and BlockStreamer used 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 BlockStreamer take at least the given time, if the calls was slower than the interval it execute immediately.

It's configured with a default value of 400ms in the signer and aggregator, and setting the configuration value to 0 disable the throttler entirely.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • No new TODOs introduced

Issue(s)

Closes #2909

@Alenar Alenar self-assigned this Jan 29, 2026
@Alenar Alenar added the feature 🚀 New implemented feature label Jan 29, 2026
@github-actions
Copy link

github-actions bot commented Jan 29, 2026

Test Results

    5 files  ± 0    172 suites  ±0   31m 37s ⏱️ -36s
2 460 tests + 6  2 460 ✅ + 6  0 💤 ±0  0 ❌ ±0 
7 680 runs  +24  7 680 ✅ +24  0 💤 ±0  0 ❌ ±0 

Results for commit d86a584. ± Comparison against base commit 7588307.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a 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 BlockStreamerWithThrottling decorator to throttle block polling operations
  • Added cardano_transactions_block_streamer_throttling_interval configuration 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.

@Alenar Alenar force-pushed the djo/2909/chain_data_preloader_throttling branch from c71c4aa to e28e426 Compare January 30, 2026 10:37
@Alenar Alenar temporarily deployed to testing-preview January 30, 2026 10:49 — with GitHub Actions Inactive
Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Alenar Alenar force-pushed the djo/2909/chain_data_preloader_throttling branch from e28e426 to f9aeb37 Compare January 30, 2026 17:31
@Alenar Alenar temporarily deployed to testing-preview January 30, 2026 17:43 — with GitHub Actions Inactive
Copy link
Collaborator

@turmelclem turmelclem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Alenar Alenar force-pushed the djo/2909/chain_data_preloader_throttling branch from f9aeb37 to 1f3fd68 Compare February 3, 2026 08:47
@Alenar Alenar temporarily deployed to testing-preview February 3, 2026 09:14 — with GitHub Actions Inactive
* 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`
@Alenar Alenar temporarily deployed to testing-preview February 3, 2026 10:44 — with GitHub Actions Inactive
@Alenar Alenar merged commit a6c09e9 into main Feb 3, 2026
98 of 99 checks passed
@Alenar Alenar deleted the djo/2909/chain_data_preloader_throttling branch February 3, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 New implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add throttling to Blocks and Transactions preloader

4 participants