Skip to content

Commit 0f29241

Browse files
authored
Bandwidth experiment at tag leios-2025w25 (#418)
* Designed bandwidth experiment * Fixed bug in message size retrieval * Analysis template for bandwidth experiment * 100 TPS experiment * Analysis of 300 tps case * Updated logbook
1 parent 37f7c35 commit 0f29241

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6045
-2
lines changed

Logbook.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Leios logbook
22

3+
## 2025-06-24
4+
5+
### Bandwidth experiment
6+
7+
Experiments exploring the effect of bandwidth limits at 100 TPS and 300 TPS were completed in [analysis/sims/2025w25/analysis.ipynb](analysis/sims/2025w25/analysis.ipynb). Key findings follow:
8+
9+
1. The following protocol parameters are sufficient for Leios high performance at 100 tx/s (or 300 tx/s): 1 IB/s (or 2 IB/s), 10 slot/stage, 328 kB/IB maximum, 1.5 EB/stage, and multiple shards.
10+
2. Spatial efficiency is 80%.
11+
3. All transactions reach the ledger, typically within two minutes.
12+
4. A 30 Mbps network interface card (NIC) is sufficient for the Leios node.
13+
5. A 4-core vCPU is also sufficient.
14+
315
## 2025-06-20
416

517
### CDDL Specification Draft

analysis/sims/2025w25/analysis.ipynb

Lines changed: 4713 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# yaml-language-server: $schema=./config.schema.json
2+
3+
################################################################################
4+
# Simulation Configuration File
5+
################################################################################
6+
#
7+
# This file contains the default configuration for running Leios simulations in
8+
# the Haskell simulation (`simulation/`) and the Rust simulation (`sim-rs/`).
9+
#
10+
################################################################################
11+
# Simulation Configuration
12+
################################################################################
13+
14+
relay-strategy: "request-from-first"
15+
tcp-congestion-control: true
16+
multiplex-mini-protocols: true
17+
simulate-transactions: true
18+
treat-blocks-as-full: false
19+
cleanup-policies: ["cleanup-expired-vote"]
20+
21+
################################################################################
22+
# Leios Protocol Configuration
23+
################################################################################
24+
25+
leios-variant: full
26+
leios-stage-length-slots: 10
27+
leios-stage-active-voting-slots: 1
28+
leios-vote-send-recv-stages: false
29+
leios-late-ib-inclusion: true
30+
leios-header-diffusion-time-ms: 1000.0
31+
# TODO: revise default
32+
praos-chain-quality: 100
33+
praos-fallback-enabled: false
34+
35+
################################################################################
36+
# Transaction Configuration
37+
################################################################################
38+
39+
tx-generation-distribution:
40+
distribution: exp
41+
lambda: 0.85
42+
scale: 8.891
43+
tx-size-bytes-distribution:
44+
distribution: log-normal
45+
mu: 6.833
46+
sigma: 1.127
47+
tx-sharded-percentage: 1.0
48+
tx-validation-cpu-time-ms: 1.5
49+
tx-max-size-bytes: 16384
50+
tx-start-time: 60
51+
tx-stop-time: 660
52+
53+
################################################################################
54+
# Ranking Block Configuration
55+
################################################################################
56+
57+
# 1/leios-stage-length-slots, targeting one RB per pipeline.
58+
# Also 20s is current rate of praos blocks.
59+
rb-generation-probability: 5.0e-2
60+
# Eng. team targets 1kB as worst case upper bound.
61+
# Actual size fairly close.
62+
rb-head-size-bytes: 1024
63+
rb-body-max-size-bytes: 90112
64+
# Note: certificate generation/validation is not included in the
65+
# timings here, see cert-* fields.
66+
rb-generation-cpu-time-ms: 1.0
67+
rb-head-validation-cpu-time-ms: 1.0
68+
69+
# On average, no Txs directly embedded in blocks.
70+
rb-body-legacy-praos-payload-avg-size-bytes: 0
71+
rb-body-legacy-praos-payload-validation-cpu-time-ms-constant: 50.0
72+
# the -per-byte component is meant to be using size as a (bad)
73+
# proxy for the complexity of the Txs included.
74+
rb-body-legacy-praos-payload-validation-cpu-time-ms-per-byte: 0.0005
75+
76+
################################################################################
77+
# Input Block Configuration
78+
################################################################################
79+
80+
ib-generation-probability: 1.00
81+
ib-shards: 60
82+
ib-shard-period-length-slots: 1
83+
ib-shard-group-count: 6
84+
85+
# ProducerId 32
86+
# SlotNo 64
87+
# VRF proof 80
88+
# Body hash 32
89+
# RB Ref 32
90+
# Signature 64
91+
# Total 304
92+
#
93+
# NOTE: using a KES Signature (like for Praos headers)
94+
# would instead more than double the total to 668.
95+
# And even 828 including Op Cert.
96+
ib-head-size-bytes: 304
97+
# 98KB to optimize for 3 TCP round trips
98+
ib-body-avg-size-bytes: 98304
99+
ib-body-max-size-bytes: 327680
100+
# Here we also use praos blocks as ballpark estimate.
101+
# Sec 2.3 Forging, of the benchmark cluster report, lists
102+
# * Slot start to announced: 0.12975s
103+
ib-generation-cpu-time-ms: 130.0
104+
ib-head-validation-cpu-time-ms: 1.0
105+
ib-body-validation-cpu-time-ms-constant: 50.0
106+
ib-body-validation-cpu-time-ms-per-byte: 0.0005
107+
ib-diffusion-strategy: "freshest-first"
108+
109+
# Haskell prototype relay mini-protocol parameters.
110+
ib-diffusion-max-bodies-to-request: 1
111+
ib-diffusion-max-headers-to-request: 100
112+
ib-diffusion-max-window-size: 100
113+
114+
################################################################################
115+
# Endorsement Block Configuration
116+
################################################################################
117+
118+
# We want one per pipeline, but not too many.
119+
eb-generation-probability: 1.5
120+
# ProducerId 32
121+
# SlotNo 64
122+
# VRF proof 80
123+
# Signature 64
124+
# Total 240
125+
#
126+
# See Note about signatures on ib-head-size-bytes.
127+
eb-size-bytes-constant: 240
128+
# IB hash
129+
eb-size-bytes-per-ib: 32
130+
# Collecting the IBs to reference and cryptography are the main tasks.
131+
# A comparable task is maybe mempool snapshotting.
132+
# Sec 2.3 Forging, of the benchmark cluster report, lists
133+
# * Mempool snapshotting: 0.07252s
134+
# 75ms then seems a generous estimate for eb generation.
135+
eb-generation-cpu-time-ms: 75.0
136+
# Validating signature and vrf proof, as in other headers.
137+
eb-validation-cpu-time-ms: 1.0
138+
139+
eb-diffusion-strategy: "peer-order"
140+
141+
# Haskell prototype relay mini-protocol parameters.
142+
eb-diffusion-max-bodies-to-request: 1
143+
eb-diffusion-max-headers-to-request: 100
144+
eb-diffusion-max-window-size: 100
145+
146+
# The maximum age of EBs included in RBs.
147+
# A an EB from slot `s` can only be included in RBs
148+
# up to slot `s+eb-max-age-slots`.
149+
# In short leios we expect votes to diffuse within 3 stages lengths of
150+
# EB generation, we allow for 2 more stage lengths to account for
151+
# variance in the interval within RBs.
152+
eb-max-age-slots: 240
153+
154+
# The maximum age of EBs to be relayed.
155+
# An EB from slot `s` will only be relayed
156+
# up to slot `s+eb-max-age-for-relay-slots`.
157+
eb-max-age-for-relay-slots: 40
158+
159+
# The maximum size of transactions (in bytes) which an EB can reference.
160+
# Only relevant when running with the "full-without-ibs" variant.
161+
eb-referenced-txs-max-size-bytes: 16384000
162+
163+
################################################################################
164+
# Vote Configuration
165+
################################################################################
166+
167+
# Cryptography related values taken from [vote-spec](crypto-benchmarks.rs/Specification.md)
168+
# using weighted averages of 80% persistent and 20% non-persistent.
169+
170+
# vote-spec#Committe and quorum size
171+
#
172+
# Note: this is used as the expected amount of total weight of
173+
# generated votes in the sims.
174+
vote-generation-probability: 500.0
175+
# vote-spec#"Committe and quorum size"
176+
# 60% of `vote-generation-probability`
177+
vote-threshold: 300
178+
# vote-spec#"Generate vote" 0.8*135e-3 + 0.2*280e-3
179+
vote-generation-cpu-time-ms-constant: 164.0e-3
180+
# No benchmark yet.
181+
vote-generation-cpu-time-ms-per-ib: 0
182+
# vote-spec#"Verify vote" 0.8*670e-3 + 0.2*1.4
183+
vote-validation-cpu-time-ms: 816.0e-3
184+
# The `Vote` structure counted in the -per-eb already identifies slot
185+
# (in Eid) and voter. We can assume a vote bundle is all for the same
186+
# voter and slot, so for non-persistent voters we could factor their
187+
# PoolKeyHash (28bytes) here, but that is for 20% of cases.
188+
# More relevant if EB generation is very high.
189+
vote-bundle-size-bytes-constant: 0
190+
# vote-spec#Votes 0.8*90 + 0.2*164
191+
vote-bundle-size-bytes-per-eb: 105
192+
193+
vote-diffusion-strategy: "peer-order"
194+
195+
# Haskell prototype relay mini-protocol parameters.
196+
vote-diffusion-max-bodies-to-request: 1
197+
vote-diffusion-max-headers-to-request: 100
198+
vote-diffusion-max-window-size: 100
199+
200+
################################################################################
201+
# Certificate Configuration
202+
################################################################################
203+
204+
# vote-spec - certificate size plot.
205+
# Realistic stake distributions need about 7 kilobytes for the certificate.
206+
cert-size-bytes-constant: 7168
207+
cert-size-bytes-per-node: 0
208+
209+
# For certificate timings we have bulk figures for realistic scenarios,
210+
# so we do not attempt to give -per-node (i.e. per-voter) timings.
211+
#
212+
# vote-spec#"Generate certificate"
213+
cert-generation-cpu-time-ms-constant: 90.0
214+
cert-generation-cpu-time-ms-per-node: 0
215+
# vote-spec#"Verify certificate"
216+
cert-validation-cpu-time-ms-constant: 130.0
217+
cert-validation-cpu-time-ms-per-node: 0
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
cd "$(dirname "${BASH_SOURCE[0]}")"
6+
7+
BW=$(basename $PWD)
8+
9+
ulimit -S -m 24000000 -v 24000000
10+
11+
mkfifo sim.log
12+
13+
sed -e 's/"bandwidth-bytes-per-second":125000000/"bandwidth-bytes-per-second":'"$((125000 * BW))"'/g' \
14+
../../../../../data/simulation/pseudo-mainnet/topology-v2.yaml \
15+
> network.yaml
16+
17+
function cleanup() {
18+
rm sim.log
19+
rm network.yaml
20+
}
21+
trap cleanup EXIT
22+
23+
grep -E -v '(Slot|No.*Generated|CpuTask|Lottery)' sim.log | pigz -p 3 -9c > sim.log.gz &
24+
25+
../../sim-cli --parameters config.yaml network.yaml --slots 1200 --conformance-events sim.log > stdout 2> stderr
26+
27+
wait
28+
29+
cat << EOI > case.csv
30+
Simulator,Bandwidth [Mb/s]
31+
Rust,$(basename $PWD)
32+
EOI
33+
34+
zcat sim.log.gz \
35+
| ../../leios-trace-processor \
36+
+RTS -N5 -RTS \
37+
--trace-file /dev/stdin \
38+
--lifecycle-file lifecycle.csv \
39+
--cpu-file cpus.csv \
40+
--resource-file resources.csv \
41+
--receipt-file receipts.csv
42+
43+
pigz -p 3 -9vf {lifecycle,cpus,resources,receipts}.csv
44+
45+
cat case.csv
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Simulator,Bandwidth [Mb/s]
2+
Rust,12
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../1000/config.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../1000/run.sh
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
praos: 59958 transactions(s) were generated in total.
2+
praos: 53 naive praos block(s) were published.
3+
praos: 1147 slot(s) had no naive praos blocks.
4+
praos: 59067 transaction(s) (100.36 MB) finalized in a naive praos block.
5+
praos: 891 transaction(s) (1.63 MB) did not reach a naive praos block.
6+
praos: Pool 1 published 0 naive praos block(s)
7+
praos: Pool 1 failed to publish 1 naive praos block(s) due to slot battles.
8+
praos: Pool 3 published 1 naive praos block(s)
9+
praos: Pool 43 published 1 naive praos block(s)
10+
praos: Pool 48 published 1 naive praos block(s)
11+
praos: Pool 57 published 1 naive praos block(s)
12+
praos: Pool 58 published 1 naive praos block(s)
13+
praos: Pool 63 published 1 naive praos block(s)
14+
praos: Pool 74 published 2 naive praos block(s)
15+
praos: Pool 89 published 1 naive praos block(s)
16+
praos: Pool 94 published 1 naive praos block(s)
17+
praos: Pool 95 published 1 naive praos block(s)
18+
praos: Pool 98 published 1 naive praos block(s)
19+
praos: Pool 103 published 1 naive praos block(s)
20+
praos: Pool 105 published 1 naive praos block(s)
21+
praos: Pool 119 published 1 naive praos block(s)
22+
praos: Pool 130 published 1 naive praos block(s)
23+
praos: Pool 131 published 1 naive praos block(s)
24+
praos: Pool 138 published 1 naive praos block(s)
25+
praos: Pool 361 published 1 naive praos block(s)
26+
praos: Pool 362 published 1 naive praos block(s)
27+
praos: Pool 371 published 2 naive praos block(s)
28+
praos: Pool 372 published 1 naive praos block(s)
29+
praos: Pool 377 published 1 naive praos block(s)
30+
praos: Pool 430 published 1 naive praos block(s)
31+
praos: Pool 434 published 1 naive praos block(s)
32+
praos: Pool 444 published 1 naive praos block(s)
33+
praos: Pool 447 published 1 naive praos block(s)
34+
praos: Pool 467 published 2 naive praos block(s)
35+
praos: Pool 474 published 2 naive praos block(s)
36+
praos: Pool 477 published 1 naive praos block(s)
37+
praos: Pool 478 published 2 naive praos block(s)
38+
praos: Pool 509 published 1 naive praos block(s)
39+
praos: Pool 518 published 1 naive praos block(s)
40+
praos: Pool 519 published 1 naive praos block(s)
41+
praos: Pool 536 published 1 naive praos block(s)
42+
praos: Pool 537 published 1 naive praos block(s)
43+
praos: Pool 546 published 1 naive praos block(s)
44+
praos: Pool 548 published 1 naive praos block(s)
45+
praos: Pool 552 published 2 naive praos block(s)
46+
praos: Pool 560 published 1 naive praos block(s)
47+
praos: Pool 561 published 1 naive praos block(s)
48+
praos: Pool 562 published 2 naive praos block(s)
49+
praos: Pool 565 published 1 naive praos block(s)
50+
praos: Pool 566 published 1 naive praos block(s)
51+
praos: Pool 742 published 1 naive praos block(s)
52+
praos: Pool 744 published 1 naive praos block(s)
53+
praos: Pool 746 published 1 naive praos block(s)
54+
leios: 1196 IB(s) were generated, on average 0.997 IB(s) per slot.
55+
leios: 59958 out of 59958 transaction(s) were included in at least one IB.
56+
leios: The average age of the pending transactions is 745.579s (stddev 65.828).
57+
leios: Each transaction was included in an average of 1.043 IB(s) (stddev 0.204).
58+
leios: Each IB contained an average of 52.309 transaction(s) (stddev 67.937) and an average of 89.31 kB (stddev 115). 522 IB(s) were empty.
59+
leios: Each node received an average of 1195.915 IB(s) (stddev 0.279).
60+
leios: 176 EB(s) were generated; on average there were 0.147 EB(s) per slot.
61+
leios: Each EB contained an average of 39.068 IB(s) (stddev 7.713). 0 EB(s) were empty.
62+
leios: Each IB was included in an average of 5.984 EB(s) (stddev 2.105).
63+
leios: 1149 out of 1196 IBs were included in at least one EB.
64+
leios: 12 out of 1196 IBs expired before they reached an EB.
65+
leios: 21 out of 176 EBs expired before an EB from their stage reached an RB.
66+
leios: 59067 out of 59958 transaction(s) were included in at least one EB.
67+
leios: 209633 total votes were generated.
68+
leios: Each stake pool produced an average of 970.523 vote(s) (stddev 200.568).
69+
leios: Each EB received an average of 1211.751 vote(s) (stddev 561.845).
70+
leios: There were 17303 bundle(s) of votes. Each bundle contained 12.115 vote(s) (stddev 16.319).
71+
leios: 51 L1 block(s) had a Leios endorsement.
72+
leios: 59067 tx(s) (100.36 MB) were referenced by a Leios endorsement.
73+
leios: 0 tx(s) (0 B) were included directly in a Praos block.
74+
leios: Spatial efficiency: 100.36 MB/107.54 MB (93.326%) of Leios bytes were unique transactions.
75+
leios: 232676 tx(s) (79.754%) referenced by a Leios endorsement were redundant.
76+
leios: Each transaction took an average of 66.141s (stddev 57.213) to be included in an IB.
77+
leios: Each transaction took an average of 95.637s (stddev 57.793) to be included in an EB.
78+
leios: Each transaction took an average of 133.181s (stddev 62.836) to be included in a block.
79+
network: 44908542 TX message(s) were sent. 44908542 of them were received (100.000%).
80+
network: 895759 IB message(s) were sent. 895740 of them were received (99.998%).
81+
network: 131824 EB message(s) were sent. 131824 of them were received (100.000%).
82+
network: 12959947 Vote message(s) were sent. 12959947 of them were received (100.000%).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Simulator,Bandwidth [Mb/s]
2+
Rust,16
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../1000/config.yaml

0 commit comments

Comments
 (0)