Logo
New RPC users get 35% off their first monthView the offer
OnFinality Learn
RPC Troubleshooting12 min read

Solana RPC Latency: Measuring, Sources, and Optimization for Trading and dApps

Learn what drives Solana RPC latency, how to measure it with a reproducible script, and when to move from public to dedicated endpoints for trading bots.

TL;DR

Solana RPC latency is dominated by geographic distance, endpoint load, request weight, and data path. This guide explains each component, provides a reproducible measurement script, and offers a decision framework for when to upgrade from public to dedicated endpoints.

Direct Answer: What Determines Solana RPC Latency?

Solana RPC latency is the time between sending a request and receiving a response from an RPC endpoint. For trading bots and dApps, this latency directly impacts execution speed and user experience. The primary sources are: geographic distance between client and server, load on the endpoint (especially shared public endpoints), the request-unit weight of the method called, and the data path (HTTP JSON-RPC vs. streaming gRPC). Slot propagation delay from the cluster also adds a baseline latency that no endpoint can eliminate.

In practice, a public endpoint may add hundreds of milliseconds under load, while a dedicated endpoint in the same region can reduce that to tens of milliseconds. However, the cluster's slot time (~400ms per slot) means that even the fastest endpoint cannot deliver data faster than the network propagates it. This guide will help you measure your current latency, understand the bottlenecks, and decide when to upgrade.

Mechanism: The Components of Solana RPC Latency

Geographic distance is the most obvious factor. Light travels about 5 microseconds per kilometer, so a round trip from New York to Tokyo (~11,000 km) adds at least 110 ms of pure propagation delay, plus routing and processing overhead. Choosing an endpoint close to your application's region is the first optimization.

Shared public endpoints are free but often saturated. They serve thousands of requests per second, and a single heavy request (like getProgramAccounts) can block others. Request-unit (RU) weight varies by method: getHealth is light, getBalance is moderate, but getSignaturesForAddress and getProgramAccounts are heavy and can consume significant CPU and memory. Public endpoints may rate-limit or throttle heavy requests, increasing latency.

The data path matters for real-time data. HTTP JSON-RPC is request-response: you poll for new data, which adds latency and wasted bandwidth. Yellowstone gRPC streaming provides a persistent connection that pushes updates as they happen, reducing latency for trading bots that need to react to slot updates or account changes. The Solana documentation notes that gRPC subscriptions are more efficient for real-time use cases.

Finally, slot propagation delay is inherent to the cluster. When a transaction is confirmed, it takes time for the block to propagate to all validators. An RPC node can only serve data it has seen; it cannot predict the future. This delay is typically a few hundred milliseconds and is unavoidable.

How to Measure Solana RPC Latency: A Reproducible Script

To measure latency accurately, you need to test both sequential and concurrent requests, and include a heavy method to see its impact. The following bash script uses curl to time three light methods (getHealth, getSlot, getBalance) and one heavy method (getSignaturesForAddress). It runs each sequentially and then concurrently to simulate load. Replace the endpoint URL with your target (e.g., a public endpoint or your dedicated one).

This script is a measurement method, not a vendor benchmark. Run it multiple times at different times of day to get a distribution. Fill in the results table below with your own numbers.

#!/bin/bash
# Solana RPC Latency Measurement Script
# Usage: ./measure_rpc_latency.sh <RPC_URL>

RPC_URL=${1:?Usage: $0 <RPC_URL>}

# Function to time a single request
measure() {
  local method=$1
  local params=$2
  local start=$(date +%s%N)
  curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" \
    -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"$method\",\"params\":$params}" \
    "$RPC_URL" > /dev/null
  local end=$(date +%s%N)
  echo $(( (end - start) / 1000000 )) # milliseconds
}

# Sequential measurements
echo "Sequential measurements:"
for method in "getHealth:[]" "getSlot:[]" "getBalance:[\"some_address\"]" "getSignaturesForAddress:[\"some_address\",{\"limit\":1}]"; do
  m=${method%%:*}
  p=${method#*:}
  time_ms=$(measure "$m" "$p")
  echo "$m: ${time_ms} ms"
done

# Concurrent measurements (10 parallel requests for each method)
echo "\nConcurrent measurements (10 parallel):"
for method in "getHealth:[]" "getSlot:[]" "getBalance:[\"some_address\"]" "getSignaturesForAddress:[\"some_address\",{\"limit\":1}]"; do
  m=${method%%:*}
  p=${method#*:}
  start=$(date +%s%N)
  for i in $(seq 1 10); do
    measure "$m" "$p" &
  done
  wait
  end=$(date +%s%N)
  total_ms=$(( (end - start) / 1000000 ))
  echo "$m (10 parallel): total ${total_ms} ms, avg $((total_ms / 10)) ms"
done

Expected Results and How to Verify

Fill in the table below with your measurements. For a public endpoint, you might see getHealth around 50-200 ms, getSlot similar, getBalance slightly higher, and getSignaturesForAddress significantly higher (500 ms or more) due to its heavier weight. Concurrent requests will increase latency, especially for heavy methods.

To verify your measurements, compare against a known baseline: run the same script against a local Solana validator (if you have one) or a dedicated endpoint. The difference will highlight the network and load overhead. Also, use the Solana CLI's solana ping to measure cluster latency, but note that it measures transaction confirmation, not RPC response time.

  • Method | Sequential (ms) | Concurrent (ms) | Notes
  • getHealth | | | Lightest method
  • getSlot | | | Light, but depends on node sync
  • getBalance | | | Moderate, requires account lookup
  • getSignaturesForAddress | | | Heavy, use with limit

Common Failures and Fixes

High latency on public endpoints is often due to rate limiting or throttling. If you see HTTP 429 responses, you're being rate-limited. Fix: reduce request frequency, use batching, or upgrade to a dedicated endpoint.

Heavy methods like getProgramAccounts can cause timeouts. Fix: use filters to narrow the scope, or switch to gRPC streaming for real-time data. The Solana documentation recommends using gRPC subscriptions for efficient real-time data.

Geographic distance can be mitigated by using a geo-distributed RPC provider. OnFinality offers endpoints in multiple regions; choose the one closest to your application. See our Solana network page for available regions.

If you're building a trading bot, consider using Yellowstone gRPC for streaming slot updates and account changes. This reduces polling overhead and latency. Our api service supports gRPC.

Tradeoffs and Limitations

Dedicated endpoints cost money, but they offer consistent performance and higher rate limits. For a trading bot that executes frequently, the cost is justified by reduced latency and fewer failed requests. However, even a dedicated endpoint cannot overcome slot propagation delay; you'll always be at least one slot behind the cluster head.

gRPC streaming reduces latency for real-time data but requires a persistent connection and more complex client code. It's not suitable for one-off queries. Also, gRPC may not be available on all providers.

When optimizing, consider tail latency vs. throughput. A dedicated endpoint may have higher throughput but still have occasional spikes. Read our general RPC latency reduction guide for a deeper dive into tail latency tradeoffs.

Decision Guide: When to Move from Public to Dedicated

If your application is a simple dApp that occasionally queries balances, a public endpoint may suffice. But if you're running a trading bot that needs to react to price changes within milliseconds, or if you're making more than a few requests per second, you should consider a dedicated endpoint.

Signs you need an upgrade: consistent latency above 200 ms, frequent rate limiting (HTTP 429), timeouts on heavy methods, or your bot misses opportunities due to slow data. Start with a dedicated endpoint in the same region as your server. OnFinality offers flexible pricing for dedicated endpoints.

For real-time data, switch to Yellowstone gRPC streaming. This can cut latency by eliminating polling intervals. Our RPC Assistant can help you configure the right endpoint for your use case.

Next Steps and Further Reading

Now that you understand the components of Solana RPC latency and how to measure it, you can make informed decisions. Start by running the measurement script against your current endpoint and a dedicated one to compare.

Explore our Solana network page for endpoint options, and check out our learn hub for more guides. For a deeper understanding of latency optimization, read our general RPC latency reduction article. If you're ready to upgrade, see our pricing and api service pages.

Measuring Tail Latency and Concurrency: A Practical Guide

Average latency can mask severe performance issues in production. For Solana RPC workloads, tail latency (e.g., p95, p99) and behavior under concurrency are critical because user-facing applications often experience the worst-case response times. To measure these, you need to run load tests that simulate realistic request patterns, not just single sequential calls.

A reproducible method is to use a script that issues a fixed number of concurrent requests (e.g., 50, 100, 200) to your RPC endpoint and records the latency of each. Tools like oha, wrk, or a custom Python script with asyncio can be used. For example, a Python script using aiohttp can send getLatestBlockhash requests concurrently and collect timings. After the test, compute percentiles (p50, p95, p99) and the maximum latency. Repeat the test at different concurrency levels to observe how latency scales.

When interpreting results, note that Solana RPC endpoints have rate limits and may queue requests. A healthy endpoint should show a gradual increase in p99 latency as concurrency rises, but a sharp spike or timeouts indicate saturation. Also, compare results across different endpoints (public, dedicated, gRPC) to understand their capacity. For production, you should monitor tail latency continuously, not just during tests, using metrics like histogram from your load balancer or client-side instrumentation.

  • Use a load-testing script that sends concurrent requests and records per-request latency.
  • Compute p50, p95, p99, and max latency for each concurrency level (e.g., 10, 50, 100, 200).
  • Look for latency spikes or timeouts at higher concurrency—these indicate endpoint saturation.
  • Compare tail latency across endpoints to choose the right one for your latency budget.
  • Set up continuous monitoring of tail latency in production using client-side metrics or RPC provider dashboards.

Request Weight and Load Shedding: Implications for Latency-Budgeted Apps

Not all RPC requests are equal in cost. Heavy methods like getProgramAccounts or getSignaturesForAddress can be orders of magnitude more expensive than getLatestBlockhash. Public endpoints often enforce rate limits based on request weight, not just count. For latency-sensitive applications, it's crucial to understand the weight of your requests and how they affect your latency budget.

When you send a mix of heavy and light requests, the heavy ones can monopolize server resources, causing latency spikes for all requests. This is why many providers implement load shedding: they prioritize lighter requests or reject heavy ones when under load. For your application, you should design your request patterns to minimize heavy calls—for example, by caching getProgramAccounts results or using gRPC streaming for real-time data.

To manage latency, you can also implement client-side load shedding: if your request is likely to exceed your latency budget (e.g., a heavy method), you can fall back to a lighter alternative or use a dedicated endpoint with higher limits. OnFinality's pricing page details request weights and limits for different tiers, which helps you estimate your capacity. Additionally, consider using the Solana RPC Assistant to analyze your request patterns and optimize them.

  • Understand that methods like getProgramAccounts have high request weight and can cause latency spikes.
  • Check your provider's rate limits and request weight policies (e.g., OnFinality's pricing).
  • Implement client-side caching and batching to reduce heavy calls.
  • Use gRPC streaming for real-time data to avoid polling heavy methods.
  • Set up client-side timeouts and fallbacks to maintain your latency budget under load.

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started