Skip to content

Commit d356b5a

Browse files
committed
WIP second attempt
1 parent 352870e commit d356b5a

File tree

8 files changed

+79
-90
lines changed

8 files changed

+79
-90
lines changed

scripts/estimating-validation-bitrate/README

-70
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- `db-analyser --benchmark-ledger-ops` lists the fixed stats, including validation times and the full blockSize.
2+
3+
- `MsgBlock` has an overhead of 2 bytes (ie the list length and the word tag, since both are <24).
4+
5+
- 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.
6+
However, I don't know how many SDUs each byte requires.
7+
So I'll omit this.
8+
9+
Thus the number of bytes on-the-wire is sufficiently dominated by blockSize.
10+
11+
-----
12+
13+
The `nix-shell -p gawk gnuplot --run 'source stream-then-plot.sh'` command renders images that help roughly answer the question: will a full buffer containing B blocks be able to refill before its entire contents is validated?
14+
(As of slot 134028831, it runs for about about 3.5 minutes on my laptop.)
15+
16+
The image width is as great as Cairo would allow.
17+
If you open them in Firefox and then left-click, it will zoom to full height; then you can scroll along the x-axis.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
BEGIN { CONVFMT = "%.18g"; }
2+
3+
{
4+
SlotNo = $1; Microseconds = $12 + $13; Bytes = $14;
5+
6+
CumuBytes = CumuBytes + Bytes ;
7+
CumuMicroseconds = CumuMicroseconds + Microseconds;
8+
9+
print SlotNo, CumuMicroseconds, CumuBytes;
10+
}

scripts/estimating-validation-bitrate/gp.scr

-16
This file was deleted.

scripts/estimating-validation-bitrate/gp.scr2

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if (!exists('prefix')) prefix = 'catch'
2+
if (!exists('suffix')) suffix = ''
3+
4+
set terminal pngcairo transparent enhanced size 32767, 1024
5+
set output 'plot'.suffix.'.png'
6+
7+
set grid ytics
8+
set xtics 500
9+
10+
set xlabel 'total duration of validation (s)'
11+
set ylabel 'megabits per second'
12+
13+
sizes = '10 100 1000'
14+
15+
# FYI: words() gives length and word(,) extracts one word
16+
17+
plot for [i=1:words(sizes)] prefix.'-'.word(sizes, i) using ($1/1000000):($2*8 < 100 ? $2*8 : 100) title word(sizes, i).' block buffer'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Crunch all the data.
2+
for i in 10 100 1000; do B=$i . streaming.sh & done; wait
3+
4+
# Split the x-axis in half, so the plots are more legible.
5+
#
6+
# 125000 seconds is _currently_ the end of the x-axis if I plot the whole data set in one image.
7+
for i in 10 100 1000; do cat catch-$i | awk '($1/1000000 < 125000/2) {print $0}' > catch1-$i & done
8+
for i in 10 100 1000; do cat catch-$i | awk '($1/1000000 >= 125000/2) {print $0}' > catch2-$i & done
9+
wait
10+
11+
# Render plot-1.png and plot-2.png.
12+
for i in 1 2; do gnuplot -e "prefix='catch$i'" -e "suffix='-$i'" plot.gp & done
13+
wait
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### Will a full buffer of size B refill before it empties?
2+
3+
out=catch-$B
4+
5+
# The resulting file has 3 columns: SlotNo, CumuMicroseconds, CumuBytes.
6+
tail -n+2 benchmark-ledger-ops.csv | awk -f cumuboth.awk >$out
7+
8+
# Discard Byron.
9+
# cat $out | awk '($1 >= 4492800) { print $0 }' >$out.tmp; mv $out.tmp $out
10+
11+
# Time and space sizes of windows of B-blocks
12+
#
13+
# ChainSel and BlockFetch clients use a buffer of 10 blocks. On top of that,
14+
# BlockFetch itself is buffered according to the low/high watermark, which are
15+
# at least 192 kibibytes and 384 kibibytes, respectively. This logic here only
16+
# considers the block-counted buffer, not the bytes in-flight.
17+
paste $out <(tail -n+$((B + 1)) $out) | awk '(NF > 3) {print $2, $5 - $2, $6 - $3}' >$out.tmp; mv $out.tmp $out
18+
19+
# The scatter plot of this data informs the question: assuming the buffer is
20+
# currently full, what bit rate would be necessary in order to completely
21+
# refill the buffer before it empties.
22+
paste $out <(tail -n+2 $out) | awk '(NF > 3) {print ($1 + $4) / 2, $6 / $2}' >$out.tmp; mv $out.tmp $out

0 commit comments

Comments
 (0)