> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# 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.

<Info>
  **Source**

  [`get_recent_performance_samples`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L3710)
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getRecentPerformanceSamples",
      "params": [
        2
      ]
    }
  '
  ```

  ```ts Kit
  import { createSolanaRpc } from "@solana/kit";

  const rpc_url = "https://api.devnet.solana.com";
  const rpc = createSolanaRpc(rpc_url);

  let limit = 2;

  let performanceSamples = await rpc.getRecentPerformanceSamples(limit).send();

  console.log(performanceSamples);
  ```

  ```ts web3.js
  import { Connection, clusterApiUrl } from "@solana/web3.js";

  const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

  let limit = 2;

  let performanceSamples = await connection.getRecentPerformanceSamples(limit);

  console.log(performanceSamples);
  ```

  ```rs Rust
  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://api.devnet.solana.com"),
          CommitmentConfig::confirmed(),
      );

      let limit = 2;
      let performance_samples = client.get_recent_performance_samples(limit.into()).await?;

      println!("{:#?}", performance_samples);

      Ok(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "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
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="number of samples" type="usize" default="720">
  Number of samples to return (maximum 720)
</ParamField>

## Result

<ResponseField name="result" type="array">
  An array of performance sample objects containing:

  <Expandable title="properties" defaultOpen>
    <ResponseField name="slot" type="u64">
      Slot at which the sample was taken.
    </ResponseField>

    <ResponseField name="numTransactions" type="u64">
      Number of transactions processed during the sample period
    </ResponseField>

    <ResponseField name="numSlots" type="u64">
      Number of slots completed during the sample period
    </ResponseField>

    <ResponseField name="samplePeriodSecs" type="u16">
      Number of seconds in a sample window
    </ResponseField>

    <ResponseField name="numNonVoteTransactions" type="u64 | null">
      Number of non-vote transactions processed during the sample period

      <Info>
        `numNonVoteTransactions` is `null` for older performance samples that do not
        record it. To get a number of voting transactions, compute `numTransactions -
        numNonVoteTransactions` when this field is present.
      </Info>
    </ResponseField>
  </Expandable>
</ResponseField>
