Skip to content

[Spike] Benchmark & Refactor Soroban RPC Proxy (/api/soroban-rpc) Round-Robin Connection Pooling #18

Description

@Darkvader-ship-it

Estimated Effort: 4 weeks / 7 days

Impacted Subsystems / Files:

app/api/soroban-rpc/route.ts
lib/phase-protocol.ts
Context & Problem Statement: The public Soroban testnet RPC (https://soroban-testnet.stellar.org) frequently encounters 503 Service Unavailable and 429 Rate Limit responses during peak network activity. While /api/soroban-rpc attempts fallback URL rotation, lib/phase-protocol.ts instantiates an unpooled singleton rpc.Server that stalls all concurrent UI simulations when a endpoint hangs.

Technical Requirements & Scope:

Measure RPC request latency, failure rates, and proxy timeout distributions across public and private Soroban RPC nodes.
Implement active health checking for STELLAR_RPC_FALLBACK_URLS with dynamic latency scoring.
Build connection pool mechanism in /api/soroban-rpc that routes simulation requests away from degraded RPC endpoints.
Add request retry budget and backoff circuit breaker to prevent cascading failures.
Multi-File Change Surface: Modifies app/api/soroban-rpc/route.ts proxy pipeline and lib/phase-protocol.ts RPC getter getRpc(). Alters error handling in all client components executing simulateTransaction.

Acceptance Criteria:

[ ] Proxy successfully absorbs 503/429 RPC responses without bubbling errors to client UI.
[ ] Average RPC simulation response time reduced by 40% under high network congestion.
[ ] Automatic recovery and failback when primary RPC endpoint resumes health.
Suggested Approach / Investigation Steps:

Set up load testing script targeting /api/soroban-rpc with artificial endpoint degradation.
Implement health-check daemon inspecting node block heights and response times.
Refactor proxy route to select optimal RPC node per request.
Test fallback resilience against network partition simulations.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions