Skip to content

Benchmarks: T5 and T6

bench_sweep runs loadtest once per submission window and repetition, and bench_analysis.py turns the cells into the T5 and T6 figures that compare the two- and three-phase bridge protocols.

You will learn / You need

You will learn: what T5 and T6 measure, how a window becomes a request rate, how to run a sweep and how to analyse it. You need: a stack in bridge mode (Deploying the stack), a bridge set up (Track C setup) and the load generator from Running a load test.

What T5 and T6 measure

These reproduce two experiment types from the Cosmos IBC/Hermes reference paper. Both send the same number of cross-chain transfers (bridge_request.json) and differ in how they are spread in time.

Experiment Question Paper figure Sweep
T5 Where does the time of one transfer go? A per-transfer latency breakdown for transfers submitted in a single window. Fig. 12 --windows 1
T6 How does completion latency grow as the same transfers are spread over more blocks? Fig. 13 --windows 1,2,4,8,16,32,64

"Completion" means the whole path: the source request, the relayer picking it up, the destination execution and, in a three-phase run, the acknowledgement. The measurements come from joining the source CSV (merged_results.csv) and the relayer CSV (bridge_results.csv) on the transaction digest; see Reading the results.

How a window becomes a rate

A window is a number of blocks. IOTA has no fixed block interval, so bench_sweep maps blocks to seconds with --block-secs (default 5.0), then spreads --total-transfers over --agents agents (stealth_name_service/backend/testing_backend/src/bin/bench_sweep.rs):

window_seconds     = window_blocks * block_secs
requests_per_agent = ceil(total_transfers / agents)
interval           = window_seconds / requests_per_agent

Every cell runs loadtest with --arrival-type staircase and --max-requests-per-interval 1, which makes the rate flat and starts all agents together: a synchronised burst per interval, like a batch submitted at each block. With the defaults (5,000 transfers, 1,000 agents, so 5 requests per agent):

--windows entry Window Interval between an agent's requests Offered rate
1 5 s 1 s 1,000 per second
2 10 s 2 s 500 per second
8 40 s 8 s 125 per second
64 320 s 64 s about 15.6 per second

Rate mode (--rates) is the other mode: it holds each offered rate for --cell-secs with poisson arrivals instead of bursts, so a throughput-against-rate curve has no burstiness mixed in. It conflicts with --windows. Flags: Binaries and scripts.

Run a sweep

  1. Pick the protocol. BRIDGE_PROTOCOL_PHASES=2 (request and execute) or 3 (adds bridge_source::acknowledge; .env_sample lists the extra variables), then redeploy. The sweep cannot change the relayer's settings. It prints a reminder, and with --bridge-results-path it checks each cell against --phase and aborts if the relayer disagrees. See Three phases and the AA acknowledgement.

  2. Sweep. bench_sweep runs loadtest once per submission window and repetition, one cell after another, writing each cell to <out-dir>/phase<N>/<window or rate>/<offered rate>/rep<NN>/:

    cd stealth_name_service/backend/testing_backend
    # T5: 5,000 transfers in one window, 20 repetitions
    cargo run --release --bin bench_sweep -- --windows 1 --reps 20 --phase 2 \
      --json ../agent/payloads/bridge_request.json \
      --bridge-results-path ../events_data/bridge_results.csv --out-dir ../agent/output/t5_phase2
    # T6: the same transfers spread over 1 to 64 blocks
    cargo run --release --bin bench_sweep -- --windows 1,2,4,8,16,32,64 --reps 5 --phase 2 \
      --json ../agent/payloads/bridge_request.json \
      --bridge-results-path ../events_data/bridge_results.csv --out-dir ../agent/output/t6_phase2
    

    Repeat with --phase 3 after switching the relayer. A cell whose achieved rate misses its target is a load-generator limit, not a protocol result. bench_sweep writes a bench_sweep_discarded.txt note into that cell's directory, and run.json carries rate_achieved: false. Exclude such cells from your own plots; bench_analysis.py gates only rate-mode cells itself (see below).

    Each cell directory holds merged_results.csv and run.json and, with --bridge-results-path, a bridge_results.csv snapshot. The snapshot is the relayer's whole file at that moment, so it also holds rows of earlier cells; the analysis keeps only the rows whose digest the cell itself submitted.

  3. Analyse. bench_analysis.py joins source and destination CSVs on the digest and draws the T5 chart, the T6 curve and a 2-phase vs 3-phase table:

    pip install -r ../agent/requirements.txt
    python3 ../agent/plotting_results/bench_analysis.py \
      --sweep-dir ../agent/output/t6_phase2 --out ../agent/output/t6_phase2_analysis
    

    To compare phases, point --sweep-dir at one directory that holds both phase2/ and phase3/ (use the same --out-dir for both sweeps), because phase_delta.csv pairs cells of the same rate and repetition across the two phases.

What the analysis writes

Output Content
t5_breakdown_phase<N>.png For the highest-rate (smallest-window) cell of each phase: the share of transfers that have reached each stage, against time since the first request.
t6_completion_latency.png Median over repetitions, one dot per repetition: the time from the first submission to the last completion against the window, the submission span, the tail after the last submission, and the slowest single transfer.
phase_delta.csv For each rate and repetition present in both phases: the median completion time of each phase and the difference, the cost of the third phase.
ack_signer_split.csv For phase 3: acknowledgement latency split by ack_signer (eoa or aa), the price of authenticating the acknowledgement through an account.
completion_taxonomy.csv, .png Every request in exactly one of four outcomes: completed, partial, initiated, not_committed. In a two-phase run nothing can be completed, because there is no acknowledgement to record.
throughput_curve.csv, .png Completed transfers per second inside a bounded window (--throughput-window-secs, default 120.0).
submission_rate.csv, .png Offered against achieved rate and the submission funnel.

The eleven time buckets

T5 splits a transfer's time into up to eleven consecutive buckets (BUCKET_COLUMNS in stealth_name_service/backend/agent/plotting_results/bench_analysis.py). The last two exist only in a three-phase run.

Bucket Step
http_queue Client to backend over HTTP, plus the backend's queue: http_latency_seconds minus off_chain_time minus network_latency of the source row
source_build Building the source PTB
source_sign Source gas coin lookup and signing
source_submit Source submit and execute
commit_to_event Source commit until the event is visible
detection_lag Event detection lag
queue_residency Time in the relayer queue
dest_build Destination build and gas fetch
dest_submit Destination submit and execute
ack_build Acknowledgement build and gas fetch (phase 3)
ack_submit Acknowledgement submit and execute (phase 3)

The first four come from the source row's timing columns (see Reading the results); the rest from the relayer's row. A bucket the data cannot supply, such as an acknowledgement bucket in a two-phase run, is left empty rather than zero.

Check it worked

  • Each cell directory holds merged_results.csv, run.json and, with --bridge-results-path, bridge_results.csv.
  • run.json shows rate_achieved: true for the cells you plot, and no cell directory holds bench_sweep_discarded.txt. bench_analysis.py does not drop window-mode cells; it drops rate-mode cells below --rate-tolerance and says how many.
  • The --out directory holds t5_breakdown_phase<N>.png and t6_completion_latency.png.

Next