Measure CometBFT mempool pressure in bytes as well as transactions

A small queue of large transactions can occupy more space than a much longer queue of small ones. The local mempool counters expose both dimensions.

Sample the same backend repeatedly

Set RPC to an individual CometBFT endpoint. Record total and total_bytes with observation time. Convert string values into integers before calculating rates or averages.

curl -fsS "$RPC/num_unconfirmed_txs"

If total is 25 and total_bytes is 100000, the mean queued transaction size is 4,000 bytes. When total is zero, leave the mean undefined. Sample over several block intervals to distinguish a brief burst from a growing backlog.

Avoid interpreting a local queue as a chain-wide total

Different nodes see different peers and apply local admission rules. A falling count can result from inclusion, eviction or rechecking. Compare recent block contents and sizes before attributing the entire decrease to throughput. github.com CometBFT RPC