Skip to main content

Overview

Lasso RPC uses intelligent routing strategies to distribute requests across multiple blockchain providers. Each strategy optimizes for different goals: latency, availability, or load distribution.

Available Strategies

Load Balanced

Strategy: load_balanced (alias: round_robin) Endpoint: POST /rpc/load-balanced/:chain Randomly distributes requests across available providers with health-aware tiering.

How It Works

  1. Randomly shuffles healthy providers
  2. Applies tiered reordering based on circuit breaker state and rate limits:
    • 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
  3. Attempts providers in order until success

Use Cases

  • High-volume applications requiring even distribution
  • Multi-provider redundancy without latency optimization
  • Default strategy for most workloads
load_balanced is the default strategy when no explicit strategy is specified.

Fastest

Strategy: fastest Endpoint: POST /rpc/fastest/:chain Routes all requests to the single fastest provider based on measured latency.

How It Works

  1. Ranks providers by measured latency (ascending) for the specific RPC method
  2. Uses method-specific, transport-specific latency metrics
  3. Filters providers requiring minimum quality thresholds:
    • Minimum 3 calls for stable metrics
    • Minimum 90% success rate
  4. Falls back to other providers on circuit breaker or rate limit

Staleness Handling

Metrics older than 10 minutes are considered stale and treated as cold start, preventing routing decisions based on outdated performance data.

Configuration

Use Cases

  • Low-volume, latency-sensitive applications
  • Real-time trading or gaming applications
  • Scenarios where response time is critical
The fastest strategy concentrates traffic on a single provider, which may trigger rate limits faster than distributed strategies.

Latency Weighted

Strategy: latency_weighted Endpoint: POST /rpc/latency-weighted/:chain Probabilistically routes requests with bias toward lower-latency providers.

How It Works

  1. Calculates weight for each provider based on:
    • Latency: Lower latency increases weight
    • Success rate: Higher success rate increases weight
    • Confidence: More data points increase weight
    • Exploration: Minimum weight ensures all providers receive some traffic
  2. Weight Formula:
  3. Selects providers probabilistically based on weights

Configuration

Staleness Handling

Metrics older than 10 minutes receive only the explore_floor weight, maintaining exploration while preventing decisions based on outdated data.

Use Cases

  • Balanced latency optimization with load distribution
  • Medium to high-volume applications
  • Scenarios requiring both speed and redundancy
latency_weighted provides a middle ground between fastest (concentrated) and load_balanced (random), offering latency optimization while maintaining load distribution.

Provider Override

Bypass strategy selection and route directly to a specific provider.

URL Path Override

Alternative syntax:

Header Override

Query Parameter Override

Use Cases

  • Testing specific provider implementations
  • Debugging provider-specific issues
  • Compliance requirements for specific providers
  • Bypass smart routing for known-good providers

Strategy Comparison

Strategy Selection Priority

When multiple strategy specifications are present, Lasso uses this priority order:
  1. URL path: /rpc/fastest/:chain
  2. Query parameter: ?strategy=fastest
  3. Header (via conn.assigns)
  4. Default: load_balanced

Health-Aware Tiering

All strategies apply health-aware tiering after initial ranking:
  1. Closed circuit, not rate-limited (preferred)
  2. Closed circuit, rate-limited
  3. Half-open circuit, not rate-limited
  4. Half-open circuit, rate-limited
  5. Open circuit (excluded)
This ensures that even with fastest strategy, a provider with circuit breaker issues will be deprioritized below healthy providers.

Failover Behavior

All strategies support automatic failover:
  1. Try selected provider
  2. If failure is retriable:
    • Circuit breaker errors
    • Rate limit errors
    • Timeout errors
    • Network errors
  3. Move to next provider in ranked list
  4. Repeat until success or all providers exhausted

Observability

Track which strategy and provider handled your request:

Headers Mode

Check response headers:
  • X-Lasso-Request-ID: Request tracking ID
  • X-Lasso-Meta: Base64url-encoded routing metadata

Body Mode

Response:

Profile-Scoped Strategies

All strategies are available under profile namespaces:
Each profile maintains independent:
  • Provider configurations
  • Latency metrics
  • Circuit breaker states
  • Rate limit tracking