Skip to content

Conversation

@DaMandal0rian
Copy link
Contributor

@DaMandal0rian DaMandal0rian commented Aug 24, 2025

Summary

This PR introduces dynamic weight adjustment for RPC providers, improving failover and resilience by adapting to real-time provider health. The system now dynamically adjusts provider selection weights based on health metrics including latency, error rates, and consecutive failures.

This enhancement builds upon the static weighted RPC steering implemented in #6126, making the RPC management more adaptive and robust.

Changes

Core Implementation

  • Health Monitoring Module (chain/ethereum/src/health.rs): New module to track RPC provider health metrics
    • Monitors provider latency with exponential moving average
    • Tracks error rates and consecutive failures
    • Calculates health scores for weight adjustment

Integration Points

  • Dynamic Weight Adjustment (chain/ethereum/src/network.rs): Integrated health metrics into provider selection logic

    • Provider weights are now dynamically adjusted based on health scores
    • Traffic is automatically steered away from underperforming endpoints
    • Maintains compatibility with existing weighted selection algorithm
  • Health Checker Initialization (node/src/network_setup.rs): Setup and management of health checkers for Ethereum RPC adapters

    • Initializes health monitoring for each RPC provider
    • Manages lifecycle of health check processes

Dependencies

  • Added tokio dependency to chain/ethereum and node crates for asynchronous health checks

Testing

  • Updated test cases in chain/ethereum/src/network.rs to accommodate dynamic weighting behavior

Related Issues

Builds on #6126 - Weighted RPC load balancing

Test Plan

  • Unit tests pass with dynamic weight adjustments
  • Integration tests verify failover behavior
  • Manual testing with multiple RPC providers shows proper weight adjustment
  • Verify health metrics correctly influence provider selection
  • Confirm graceful degradation when providers become unhealthy

Closes OPS-727

🤖 Generated with Claude Code

…lience

This commit introduces dynamic weight adjustment for RPC providers, improving failover and resilience by adapting to real-time provider health.

Key changes include:
- Introduced a `Health` module (`chain/ethereum/src/health.rs`) to monitor RPC provider latency, error rates, and consecutive failures.
- Integrated health metrics into the RPC provider selection logic in `chain/ethereum/src/network.rs`.
- Dynamically adjusts provider weights based on their health scores, ensuring traffic is steered away from underperforming endpoints.
- Updated `node/src/network_setup.rs` to initialize and manage health checkers for Ethereum RPC adapters.
- Added `tokio` dependency to `chain/ethereum/Cargo.toml` and `node/Cargo.toml` for asynchronous health checks.
- Refactored test cases in `chain/ethereum/src/network.rs` to accommodate dynamic weighting.

This enhancement builds upon the existing static weighted RPC steering, allowing for more adaptive and robust RPC management.

Fixes #6126
@DaMandal0rian DaMandal0rian force-pushed the feature/dynamic-rpc-weighting branch from f7bdd4d to a66d004 Compare August 26, 2025 19:28
@lutter
Copy link
Collaborator

lutter commented Jan 5, 2026

This PR and #6126 seem to do the same thing. Which one of these two should I review?

@DaMandal0rian
Copy link
Contributor Author

DaMandal0rian commented Jan 21, 2026

@lutter this PR actually adds to #6126 as the target branch.

This enhancement builds upon the static weighted RPC steering implemented in #6126, making the RPC management more adaptive and robust.

@DaMandal0rian DaMandal0rian requested a review from lutter January 21, 2026 19:28
@linear
Copy link

linear bot commented Jan 21, 2026

@lutter
Copy link
Collaborator

lutter commented Jan 21, 2026

Can you combine the two into one PR? The base PR also needs to be rebased against latest master

Looking at the two PR's, the first one introduces a new way to configure weights for RPC providers, and the second one seems to make that obsolete by making decisions on dynamic rather than static data but doesn't remove the additional config. What is the interplay between them? If we are doing dynamic weight calculations, which I think is the right way to go, we should not make weights configurable that are mostly ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants