[Feature] Add weighted load balancing support for RPC providers

オープン
#6,104 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

@DaMandal0rian がすでに取り組んでいます。

2025年8月14日 から。

評価

この issue はまだ評価されていません。

説明

enhancement Stale

Problem

Currently, Graph Node uses a sequential failover approach for RPC providers. It attempts to use the first configured provider and only moves to the next provider if there are issues or if a required feature is not available. This means traffic is not distributed across providers - instead, the first healthy provider handles all requests until it fails.

This limitation prevents operators from:

  • Distributing load across multiple healthy RPC endpoints
  • Utilizing all available RPC capacity efficiently
  • Preventing single provider overload when multiple endpoints are available
  • Optimizing costs by balancing requests across providers with different pricing
  • Achieving true high availability through active load distribution

Proposed Solution

Implement weighted random load balancing for RPC provider selection, allowing operators to configure traffic distribution percentages for each endpoint.

Example Use Cases
  1. Performance-based routing: Direct 80% of traffic to a high-performance dedicated node and 20% to a backup
  2. Cost optimization: Route 90% to cheaper endpoints and 10% to premium endpoints for critical requests
  3. Gradual rollout: Start a new provider at 5% traffic and increase as confidence grows
  4. Capacity management: Distribute load according to each endpoint's actual capacity

Implementation

I've created PR #[YOUR_PR_NUMBER] that adds this functionality with:

  • Configurable decimal weights (0.0-1.0) per RPC provider
  • New --weighted-rpc-steering CLI flag and config option
  • Backward compatibility (defaults to equal weights when not specified)
  • Weighted random selection algorithm for provider choice
Configuration Example
[chains.mainnet]
weighted_rpc_steering = true
provider = [
 { 
   label = "primary-node",
   details = { type = "web3", url = "https://fast.example.com", weight = 0.7 }
 },
 { 
   label = "secondary-node", 
   details = { type = "web3", url = "https://medium.example.com", weight = 0.2 }
 },
 { 
   label = "backup-node",
   details = { type = "web3", url = "https://backup.example.com", weight = 0.1 }
 }
]

Related Work

  • PR - Implementation of weighted load balancing
  • This addresses a common request for managing multiple RPC endpoints with varying characteristics
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

No response

Some information to help us out
  • Tick this box if you plan on implementing this feature yourself.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphprotocol/graph-node のほかの issue

graphprotocol/graph-node の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。