getRecentPerformanceSamples - Solana

This method returns performance samples taken over recent 60-second windows, including transaction counts and slots elapsed. It is the standard source for calculating observed throughput.

Parameters

ParameterTypeRequiredDescription
limitnumberNoNumber of samples to return, up to 720. Defaults to 720

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getRecentPerformanceSamples",
    "params": [2],
    "id": "getblock.io"
}'
javascriptconst { Connection } = require('@solana/web3.js');

const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');

const samples = await connection.getRecentPerformanceSamples(2);

console.log(samples[0].numTransactions / samples[0].samplePeriodSecs);
pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getRecentPerformanceSamples',
        'params': [2],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])
rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getRecentPerformanceSamples",
            "params": [2],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;

    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": [
        {
            "numNonVoteTransactions": 68412,
            "numSlots": 149,
            "numTransactions": 182934,
            "samplePeriodSecs": 60,
            "slot": 397234561
        }
    ]
}

Response Parameters

ParameterTypeDescription
jsonrpcstringJSON-RPC protocol version ("2.0")
idstringRequest identifier matching the request
resultarrayArray of performance sample objects, most recent first

Sample Entry

FieldTypeDescription
slotnumberSlot the sample was taken at
numTransactionsnumberTotal transactions processed during the sample period
numNonVoteTransactionsnumberTransactions excluding validator vote transactions
numSlotsnumberSlots completed during the sample period
samplePeriodSecsnumberLength of the sample window in seconds

Use Cases

  • True TPS: Divide numNonVoteTransactions by samplePeriodSecs to exclude vote traffic
  • Congestion Signals: Raise priority fees when recent samples show sustained load
  • Status Pages: Chart throughput and slot rate on a public network dashboard
  • Capacity Planning: Compare peak and baseline throughput across 12 hours of samples

Error Handling

Error CodeMessageDescription
-32602Invalid paramsLimit exceeds 720 or is not a positive integer
-32603Internal errorNode failed to read the performance sample store