getRecentPerformanceSamples – Solana
The getRecentPerformanceSamples JSON-RPC method retrieves a list of recent performance samples, ordered in reverse slot order.
The getRecentPerformanceSamples RPC Solana method enables developers to access recent performance data related to block and transaction processing.
The getRecentPerformanceSamples method retrieves recent performance metrics of the Solana network, including transaction processing rates and slot progression. It helps developers analyze network performance trends, monitor congestion, and optimize application behavior based on real-time blockchain activity.
Supported Networks
This method is available on the following API endpoints:
Mainnet
Devnet
Parameters
Optional Parameters
limit (usize, optional): The number of recent performance samples to return.
Maximum: 720
Result
The response returns an array of RpcPerfSample objects, each containing:
slot (u64): The slot in which the sample was taken.
numTransactions (u64): The number of transactions processed during the sample period.
numSlots (u64): The number of slots completed during the sample period.
samplePeriodSecs (u16): The duration of the sample window in seconds (typically 60 seconds).
numNonVoteTransactions (u64): The number of non-vote transactions processed during the sample period. (Available in Solana v1.15 and later.)
To calculate the number of vote transactions, use the formula:
numTransactions - numNonVoteTransactions
Request Example
API Endpoints
cURL Example
Response
A successful request returns an array of performance samples.
Example Response
Error Handling
Common getRecentPerformanceSamples error scenarios:
Invalid parameters: If an incorrect or out-of-range value is provided for limit.
Network errors: Connectivity issues with the Solana JSON-RPC API endpoints.
Malformed request: Incorrectly structured JSON requests.
Example Error Response
Use Cases
The Solana getRecentPerformanceSamples method is useful for:
Validators and node operators: Monitoring transaction and slot processing performance.
Blockchain explorers: Displaying real-time network statistics.
dApp developers: Tracking performance trends to optimize transaction handling.
Web3 analytics tools: Analyzing historical network efficiency and congestion.
Code getRecentPerformanceSamples Example – Web3 Integration
Integration with Web3
By integrating Web3 getRecentPerformanceSamples into Solana’s Core API, developers can track block processing rates, monitor network congestion, and optimize transaction execution strategies. The JSON-RPC request provides real-time insights into Solana’s performance, making it a valuable tool for dApps, validators, and analytics platforms.
Last updated