Skip to content

TPS Benchmark

Seulgi Kim edited this page Apr 25, 2019 · 1 revision

How to measure TPS

There are two ways to measure.

  1. Using devel_testTPS RPC Call (Implemented only on solo chain)
  2. Using the test code with the SDK (Not implemented yet)

Using devel_testTPS

There are four options: PaymentOnly, TransferSingle, TransferMultiple, PaymentOrTransfer.

PaymentOnly

PaymentOnly will send a 1 CCC from the faucet address to a random address by payment actions for count times.

Request Example

  curl \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "method": "devel_testTPS", "params": [{"option":"payOnly", "count":10000, "seed": 1 }], "id": null}' \
    localhost:8080

TransferSingle

TransferSingle will mint an asset, and send the asset from one to another for count times. This uses 0x30, 0x01 lock script, which always return Unlocked.

Request Example

  curl \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "method": "devel_testTPS", "params": [{"option":"transferSingle", "count":10000, "seed": 1 }], "id": null}' \
    localhost:8080

TransferMultiple

TransferMultiple will mint an asset, and split it into 10 assets, and send the split assets from one to another for count times. This uses 0x30, 0x01 lock script, which always return Unlocked.

Request Example

  curl \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "method": "devel_testTPS", "params": [{"option":"transferMultiple", "count":10000, "seed": 1 }], "id": null}' \
    localhost:8080

PaymentOrTransfer Request Example

PaymentOrTransfer will randomly choose and do an action from PaymentOnly and TransferSingle, for count times. When choosing an action, this will use SmallRng PRNG with the given seed. Check the request example below.

Request Example

  curl \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc": "2.0", "method": "devel_testTPS", "params": [{"option":"payOrTransfer", "count":10000, "seed": 1 }], "id": null}' \
    localhost:8080
  • Only PaymentOrTransfer has a seed value.

Using the test code with the SDK

Not implemented yet.

Making FlameGraph

Install perf

  • linux-tools-common to install perf

Enable debug symbol for release build.

Set perf_event_paranoid.

sudo sysctl -w kernel.perf_event_paranoid=-1

Run

perf record --call-graph dwarf,16384 -e cpu-clock -F 997 target/release/codechain -c solo --enable-devel-api

See this document for more information.