getRecentPerformanceSamples
Returns a list of recent performance samples, taken every 60 seconds. Each sample includes the number of transactions and slots in that period. This data is invaluable for network performance monitoring, TPS (transactions per second) calculations, slot time analysis, and building dashboards that show real-time network throughput and health metrics.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | usize | No | Number of samples to return (maximum 720, default 720) |
Response
Returns an array of performance sample objects:
| Field | Type | Description |
|---|---|---|
[].slot | u64 | Slot in which the sample was taken |
[].numTransactions | u64 | Number of transactions processed in the sample period |
[].numSlots | u64 | Number of slots completed in the sample period |
[].samplePeriodSecs | u16 | Duration of the sample window in seconds |
[].numNonVoteTransactions | u64 | Number of non-vote transactions in the sample period |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getRecentPerformanceSamples",
5 "params": [
6 5
7 ]
8}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getRecentPerformanceSamples",
8 params: [
9 5
10 ]
11 }),
12});
13const { result } = await response.json();
14result.forEach(s => console.log(`Slot ${s.slot}: ${s.numTransactions} txs in ${s.samplePeriodSecs}s`));Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getRecentPerformanceSamples",
7 "params": [
8 5
9 ]
10})
11result = response.json()["result"]
12for s in result: print(f"Slot {s['slot']}: {s['numTransactions']} txs")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getRecentPerformanceSamples",
12 "params": [
13 5
14 ]
15 }))
16 .send().await?
17 .text().await?;
18 println!("{}", res);
19 Ok(())
20}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": [
4 {
5 "slot": 166974442,
6 "numTransactions": 5432,
7 "numSlots": 150,
8 "samplePeriodSecs": 60,
9 "numNonVoteTransactions": 1234
10 }
11 ],
12 "id": 1
13}