Overview
Lasso provides four routing strategies that control how providers are ranked before health-based tiering is applied:- load_balanced (default): Random distribution with health tiering
- fastest: Lowest latency based on method-specific metrics
- latency_weighted: Probabilistic selection weighted by performance
- priority: Explicit provider precedence from configuration
Strategy Selection
Select strategy via URL path:Load Balanced
Module:Lasso.RPC.Strategies.LoadBalanced
Randomly distributes requests across available providers. After shuffling, health-based tiering reorders providers by circuit breaker state and rate limit status.
Use Cases
- Maximizing throughput across multiple providers
- Avoiding rate limits through even distribution
- Multiple providers of similar quality
Behavior
Example Traffic Distribution
Scenario: 3 providers (A, B, C)- Provider A: Closed circuit, not rate-limited → Tier 1
- Provider B: Closed circuit, rate-limited → Tier 2
- Provider C: Half-open circuit → Tier 3
Fastest
Module:Lasso.RPC.Strategies.Fastest
Selects the lowest-latency provider for the specific RPC method based on passive benchmarking. Latency is tracked per provider, per method, per transport.
Use Cases
- Latency is the primary concern
- Willing to concentrate load on fastest provider
- Latency-sensitive methods (e.g.,
eth_getBlockByNumber)
Behavior
Ranks providers by measured latency (ascending):Staleness Handling
Metrics older than 10 minutes are considered stale and treated as cold start:- Fresh metrics (< 10min): Use actual latency
- Stale metrics (> 10min): Treat as cold start
- Missing metrics: Use P75 of known providers as dynamic baseline
Configuration
Example
Method:eth_getLogs
| Provider | HTTP Latency | WS Latency | Selected Transport |
|---|---|---|---|
| Alchemy | 450ms | 280ms | WS |
| Infura | 520ms | N/A | HTTP |
| QuickNode | 380ms | 420ms | HTTP |
Strategy ranking is applied before health tiering. A fast provider with a half-open circuit will be deprioritized below any closed-circuit provider.
Latency Weighted
Module:Lasso.RPC.Strategies.LatencyWeighted
Probabilistic selection weighted by latency, success rate, and confidence. Routes more traffic to faster providers while still using slower ones.
Use Cases
- Balance between performance and distribution
- Avoiding single-provider concentration
- Providers with significantly different performance profiles
Weight Formula
Each provider receives a weight calculated as:Formula Components
Latency Term:1 / latency^beta
- Beta (default: 3.0) controls latency sensitivity
- Higher beta = stronger preference for low latency
- Floor (default: 30ms) prevents division by near-zero
success_rate * confidence
- Filters unreliable providers
- Confidence increases with call volume
calls / min_calls
- Reduces weight for providers with insufficient data
- Minimum calls (default: 3)
0.05
- Ensures all providers receive some traffic
- Prevents complete starvation of slower providers
Implementation
Configuration
Example
Method:eth_call
| Provider | Latency | Success Rate | Calls | Weight | Selection % |
|---|---|---|---|---|---|
| Alchemy | 200ms | 0.98 | 100 | 0.00012 | 60% |
| Infura | 350ms | 0.95 | 80 | 0.00002 | 30% |
| QuickNode | 500ms | 0.92 | 50 | 0.00001 | 10% |
Priority
Module:Lasso.RPC.Strategies.Priority
Selects providers in the order defined by the priority field in the profile. Lower priority values are tried first.
Use Cases
- Preferred provider (e.g., your own node) with fallbacks
- Predictable routing order
- Explicit control over provider precedence
Configuration
Setpriority in the profile YAML:
Behavior
Example
Providers:- Provider A (priority: 1): Your node
- Provider B (priority: 2): Alchemy
- Provider C (priority: 3): Public RPC
Priority strategy still respects health tiering. A priority-1 provider with an open circuit will be excluded.
Health-Based Tiering
All strategies are subject to health-based tiering after strategy ranking. The tiering pipeline reorders providers into 4 tiers:The 4 Tiers
- Tier 1: Closed circuit + not rate-limited (preferred)
- Tier 2: Closed circuit + rate-limited
- Tier 3: Half-open circuit + not rate-limited
- Tier 4: Half-open circuit + rate-limited
Strategy-Health Interaction
| Strategy | Within-Tier Behavior | Cross-Tier Impact |
|---|---|---|
| Load Balanced | Random shuffle | No preference, healthy tiers dominate |
| Fastest | Latency-ordered | Fast provider may not receive traffic if unhealthy |
| Latency Weighted | Weighted random | Weights apply only within each tier |
| Priority | Priority-ordered | Priority applies only within each tier |
Per-Method Routing
Profiles support per-method strategy and provider overrides:Provider Override
Bypass strategy selection entirely by routing directly to a specific provider:- Debugging specific provider behavior
- Testing provider-specific features
- Custom provider selection logic outside Lasso
Execution and Failover
After strategy ranking and tiering, Lasso attempts providers sequentially: Success: First provider that returns a valid RPC response (2xx status, valid JSON-RPC structure) Failure: Provider is skipped and the next provider in the list is tried. Failures increment circuit breaker counters. All Exhausted: Returns503 Service Unavailable with details about which providers were tried and why they failed.
Configuration Summary
| Variable | Strategy | Default | Description |
|---|---|---|---|
FASTEST_MIN_CALLS | Fastest | 3 | Minimum calls for stable metrics |
FASTEST_MIN_SUCCESS_RATE | Fastest | 0.9 | Minimum success rate filter |
LW_BETA | Latency Weighted | 3.0 | Latency exponent |
LW_MS_FLOOR | Latency Weighted | 30.0 | Minimum latency denominator (ms) |
LW_EXPLORE_FLOOR | Latency Weighted | 0.05 | Minimum selection probability |
LW_MIN_CALLS | Latency Weighted | 3 | Minimum calls for stable metrics |
LW_MIN_SR | Latency Weighted | 0.85 | Minimum success rate |
Next Steps
Provider Selection
Understand the 7-stage filter pipeline
Circuit Breakers
Learn about fault tolerance and automatic recovery
Profiles
Configure multi-tenant routing policies
Architecture
Explore the OTP supervision tree