getRecentPerformanceSamples
Returns recent 60-second performance samples in reverse slot order. Each sample includes the number of transactions and slots recorded in that time window.
Request
Send a JSON-RPC 2.0 POST request with method: "getRecentPerformanceSamples". The optional params array accepts a single integer limiting how many samples are returned.
curl · JSON-RPCjson
{ "jsonrpc": "2.0", "id": 1, "method": "getRecentPerformanceSamples", "params": [ 2 ]}@solana/kit
kit.tsts
import { createSolanaRpc } from "@solana/kit"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let limit = 2; let performanceSamples = await rpc.getRecentPerformanceSamples(limit).send(); console.log(performanceSamples);@solana/web3.js
web3.tsts
import { Connection } from "@solana/web3.js"; const connection = new Connection("https://rpc.openinfra.sh", "confirmed"); let limit = 2; let performanceSamples = await connection.getRecentPerformanceSamples(limit); console.log(performanceSamples);Rust
main.rsrs
use anyhow::Result;use solana_client::nonblocking::rpc_client::RpcClient;use solana_commitment_config::CommitmentConfig; #[tokio::main]async fn main() -> Result<()> { let client = RpcClient::new_with_commitment( String::from("https://rpc.openinfra.sh"), CommitmentConfig::confirmed(), ); let limit = 2; let performance_samples = client.get_recent_performance_samples(limit.into()).await?; println!("{:#?}", performance_samples); Ok(())}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| limit | usize | No | Number of samples to return. Defaults to 720; maximum is 720. |
Response
response.jsonjson
{ "jsonrpc": "2.0", "result": [ { "slot": 348125, "numTransactions": 126, "numSlots": 126, "samplePeriodSecs": 60, "numNonVoteTransactions": 1 }, { "slot": 347999, "numTransactions": 126, "numSlots": 126, "samplePeriodSecs": 60, "numNonVoteTransactions": 1 } ], "id": 1}The result is an array of performance sample objects, each covering a 60-second window, ordered from newest to oldest slot.
| Field | Type | Description |
|---|---|---|
| slot | u64 | Slot at which the sample was taken. |
| numTransactions | u64 | Number of transactions processed during the sample period. |
| numSlots | u64 | Number of slots completed during the sample period. |
| samplePeriodSecs | u16 | Length of the sample window in seconds (always 60). |
| numNonVoteTransactions | u64 | null | Number of non-vote transactions processed during the sample period. null for older samples that did not record this field. |