Skip to content

Commit b750cdf

Browse files
committed
WIP estimating validation bit rate
1 parent 0dc2699 commit b750cdf

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
- `db-analyser --benchmark-ledger-ops` lists the fixed stats, and then for Byron and Shelley it currently also lists the number of txs and the total size of the txs.
2+
3+
- `db-analyser --show-block-header-size` lists the size of the block's header.
4+
I ran a patched version that also simply includes the block size.
5+
6+
- `MsgBlock` has an overhead of 2 bytes (ie the list length and the word tag, since both are <24).
7+
8+
- I _think_ `network-mux`'s SDU overhead is 8 bytes, from https://github.com/IntersectMBO/ouroboros-network/blob/db61131c2f375842f0930a8a9cf7f83b0cb80992/network-mux/src/Network/Mux/Codec.hs#L28-L40.
9+
However, I don't know how many SDUs each byte requires.
10+
So I'll omit this.
11+
12+
Thus the number of bytes in each block that are carried by the `network-mux` is: 2 + 1 + hdrSize + txSize.
13+
14+
-----
15+
16+
The basic idea of this simple script is to divide real-world time up into non-overlapping 10 second chunks.
17+
We use only mutator time, essentially assuming that GC is instantaneous; this conservatively _over_-estimates the effective bit rate.
18+
Map each chunk to the set of blocks whose validation began during that chunk.
19+
Then divide the sum of the validation mutator duration for each block by the sum of the on-the-wire size of each.
20+
21+
First, a sanity check.
22+
23+
```
24+
$ cat show-block-header-size.txt | awk '($4 != "SlotNo") {print $0} ($6 != "header") {print $0}'
25+
[0.834136s] Started ShowBlockHeaderSize
26+
[0.834136s] Started ShowBlockHeaderSize
27+
[1926.666379s] Maximum encountered header size = 1012
28+
[1926.666379s] Maximum encountered header size = 1012
29+
[1926.666504s] Done
30+
[1926.666504s] Done
31+
ImmutableDB tip: At (Block {blockPointSlot = SlotNo 133220620, blockPointHash = 8b0597e7cf5c65b9d00af8a162d30eaae6647f868224004b02d7bd30e1d3f93f})
32+
ImmutableDB tip: At (Block {blockPointSlot = SlotNo 133220620, blockPointHash = 8b0597e7cf5c65b9d00af8a162d30eaae6647f868224004b02d7bd30e1d3f93f})
33+
```
34+
35+
Then, the real plot as well as another sanity check of the number of blocks mapped to each 10 second chunk of mutator time.
36+
37+
The assumed inputs are benchmark-ledger-ops.csv and patched-show-block-header-sizes.txt, where the latter used a patched `db-analyser` to include an additional column for `GetBlockSize`.
38+
(The sum of the `txSizes` in the `..era-specific stats` is a slight underestimate.)
39+
40+
```
41+
$ cat benchmark-ledger-ops.csv | cut -d' ' -f1,12,13 | tail -n+2 >SlotNo-BodyTickDur-BodyAppDur.txt
42+
$ paste SlotNo-BodyTickDur-BodyAppDur.txt <(tail -n+2 patched-show-block-header-sizes.txt) | gawk 'BEGIN {CONVFMT="%.18g" } ($1 != $8) { exit} {x = x + $2 + $3; y = y + 2 + $14; print $1, x, y}' > SlotNo-CumuDur-CumuSize.txt
43+
$ cat SlotNo-CumuDur-CumuSize.txt | gawk 'BEGIN {w = 10; CONVFMT="%.18g"; prevX = -1; prevY = 0; prevZ = 0} {x = int($2 / (1000 * 1000 * w)); y = $3} (x != prevX) {print $1, (y - prevY) / w * 8 / (1000*1000), NR - prevZ; prevY = y; prevZ = NR} {prevX = x}' >catch
44+
$ tail -n1 SlotNo-CumuDur-CumuSize.txt
45+
133075481 140291882237 190610147733
46+
$ head -n1000 gp.scr*
47+
==> gp.scr <==
48+
set multiplot layout 2,1
49+
50+
set title 'Validation Bit Rate (on an AMD EPYC 7702P)'
51+
52+
set xlabel 'slot number of the last block in each 10 second chunk (millions of slots)'
53+
set ylabel 'bytes validated per 10 second chunk of mutator time (megabits per second)'
54+
55+
plot 'catch' using 1:2 notitle
56+
57+
set yrange [0:25]
58+
59+
unset title
60+
set xlabel 'same'
61+
set ylabel 'same, clamped to 25'
62+
63+
plot 'catch' using 1:($2 > 25 ? 25 : $2) notitle
64+
65+
==> gp.scr2 <==
66+
set xlabel 'slot number of the last block in each 10 second chunk (millions of slots)'
67+
set ylabel 'blocks per 10 second chunk of mutator time, clamped to 1000'
68+
69+
plot 'catch' using 1:(1000 < $3 ? 1000 : $3) notitle
70+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
set multiplot layout 2,1
2+
3+
set title 'Validation Bit Rate'
4+
5+
set xlabel 'slot number of the last block in each 10 second chunk (millions of slots)'
6+
set ylabel 'bytes validated per 10 second chunk of mutator time (megabits per second)'
7+
8+
plot 'catch' using ($1 / 1000000):2 notitle
9+
10+
set yrange [0:25]
11+
12+
unset title
13+
set xlabel 'same'
14+
set ylabel 'same, clamped to 25'
15+
16+
plot 'catch' using ($1 / 1000000):($2 > 25 ? 25 : $2) notitle
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set xlabel 'slot number (at end of each 10 second chunk)'
2+
set ylabel 'blocks per 10 second chunk of mutator time, clamped to 1000'
3+
4+
plot 'catch' using 1:(1000 < $3 ? 1000 : $3) notitle

0 commit comments

Comments
 (0)