3

What are the ways to measure the current Transactions Per Second (TPS) of the network?

I studied and experimented with the solana CLI, but was unsure of a clean way to get a reliable measure at a given moment what the current TPS is. This can be helpful for a crude kind of "health check" before performing operations. (It is noted that detecting the advancement of the root slot might be more useful for this.)

2 Answers 2

5

There's an RPC function: https://docs.solana.com/developing/clients/jsonrpc-api#getrecentperformancesamples

It returns an array of objects like:

{
  "numSlots": 126,
  "numTransactions": 126,
  "samplePeriodSecs": 60,
  "slot": 348125
}

So you can do numTransactions / samplePeriodSecs to get TPS.

I don't think it's exposed on the CLI, but you could use the RPC function or write a script using @solana/web3.js which has it on Connection: https://solana-labs.github.io/solana-web3.js/classes/Connection.html#getRecentPerformanceSamples

2

TPS is no measure of the "health" of the network. there is no single or even small number of metrics that can indicate "health" of a distributed system as complex as Solana in any useful way.

2
  • 1
    so long as the root (finalized) slot is advancing, the cluster isn't down. that doesn't mean the user experience is great, just that consensus is able to deal with whatever else is going on
    – trent.sol
    Aug 2, 2022 at 22:30
  • 1
    I'll ask another question about how to detect if the root slot is advancing. Thanks!
    – OCDev
    Aug 2, 2022 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.