The getRecentPerformanceSamples RPC method provides a snapshot of the Solana network’s recent performance. It returns a list of samples, taken approximately every 60 seconds, detailing the number of transactions and slots processed within those periods. This data is invaluable for monitoring network throughput and health. For more context on Solana’s performance metrics like TPS and slot times, you can read the Solana for Enterprise guide.

Common Use Cases

  • Network Health Monitoring: Track transaction processing rates and slot production to assess overall network health and identify potential congestion or slowdowns.
  • Performance Analysis: Analyze historical performance data to understand network behavior under different conditions.
  • Dashboarding: Display key performance indicators (KPIs) like transactions per second (TPS) and slots per minute on monitoring dashboards.
  • Capacity Planning: Observe trends in network load to inform scaling decisions for applications or infrastructure.

Request Parameters

  1. limit (usize, optional):
    • The number of most recent performance samples to return.
    • Maximum value: 720 (representing approximately 12 hours of data, as samples are taken every 60 seconds).
    • If omitted, the RPC node will return a default number of samples (the exact default can vary by RPC provider).

Response Structure

The result field of the JSON-RPC response is an array of performance sample objects, returned in reverse chronological order (most recent sample first). Each object has the following structure:

  • slot (u64): The slot number in which this performance sample was recorded.
  • numTransactions (u64): The total number of transactions (including vote and non-vote transactions) processed during the samplePeriodSecs leading up to this slot.
  • numSlots (u64): The number of slots that were processed during the samplePeriodSecs leading up to this slot.
  • samplePeriodSecs (u16): The duration, in seconds, over which this sample was taken (typically 60).
  • numNonVoteTransactions (u64): The number of transactions that were not consensus vote transactions, processed during the samplePeriodSecs.

Examples

1. Get the Last 5 Performance Samples

This example requests the five most recent performance samples from the network.

# Replace <api-key> with your Helius API key
curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
  '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getRecentPerformanceSamples",
    "params": [5]
  }'

2. Get Default Number of Performance Samples

This example omits the limit parameter, requesting the RPC node’s default number of samples.

# Replace <api-key> with your Helius API key
curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
  '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getRecentPerformanceSamples"
  }'

Developer Tips

  • Sampling Interval: Samples are typically taken every 60 seconds, but this is an approximation. The samplePeriodSecs field in the response indicates the actual duration for each sample.
  • Historical Data Limit: The maximum limit of 720 samples provides a window of approximately 12 hours of historical data. For longer-term performance analysis, external data logging and aggregation are necessary.
  • Vote vs. Non-Vote Transactions: numTransactions includes all transactions, while numNonVoteTransactions specifically counts those that are not part of the consensus voting process. The latter is often a better indicator of user-driven network activity.
  • Node Variability: The exact data might vary slightly between different RPC nodes depending on their synchronization state and local view of the network when a sample is taken.

By utilizing getRecentPerformanceSamples, developers and network observers can gain valuable insights into the operational status and throughput of the Solana network.