Skip to content

Commit 0b4d447

Browse files
authored
Merge pull request #383 from input-output-hk/bench/alonzo-hardfork
bench: support for alonzo hardfork benchmarking
2 parents 8110cea + daf71a0 commit 0b4d447

14 files changed

+97
-86
lines changed

bench/bench.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ main() {
172172

173173
case "${op}" in
174174
init-params | init ) params_init "$@"
175-
rparmjq 'del(.meta) | keys';;
175+
list_profiles;;
176176
reinit-params | reinit )
177177
local node_count era topology
178178
node_count=$(parmetajq '.node_names | length')
@@ -183,7 +183,7 @@ main() {
183183
if test -z "$era"
184184
then fail "reinit: cannot get era from params file -- use init instead."; fi
185185
params_init "$node_count" "$era" "$topology" "$@"
186-
rparmjq 'del(.meta) | keys';;
186+
list_profiles;;
187187

188188
deploy ) profile_deploy "$@";;
189189
update-deployfiles | update )
@@ -245,7 +245,7 @@ EOF
245245
export tagroot resultroot
246246
package_tag "$@";;
247247

248-
list-profiles | ps ) rparmjq 'del(.meta) | keys';;
248+
list-profiles | ps ) list_profiles;;
249249
query-profiles | query | qps | q )
250250
params query-profiles "${@:-.}" |
251251
words_to_lines | jq --raw-input |
@@ -259,7 +259,7 @@ EOF
259259
op_bench "$@";;
260260
profiles-jq | pjq ) local batch=$1 query=$2; shift 2
261261
op_bench "$batch" "jq($query)" "$@";;
262-
smoke-test | smoke ) op_bench 'smoke' '100';;
262+
smoke-test | smoke ) op_bench 'smoke' 'smoke-100';;
263263

264264
list-runs | runs | ls )
265265
ls -1 runs/*/meta.json | cut -d/ -f2;;
@@ -364,13 +364,13 @@ op_bench_start() {
364364
oprint "stopping generator.."
365365
nixops ssh explorer "systemctl stop tx-generator || true"
366366

367-
oprint "stopping nodes & explorer.."
367+
oprint "stopping nodes & journald.."
368368
op_stop
369369

370370
oprint "resetting node states: node DBs & logs.."
371-
nixops ssh-for-each --parallel "rm -rf /var/log/journal/* /var/lib/cardano-node/db* /var/lib/cardano-node/logs/*"
371+
nixops ssh-for-each --parallel "rm -rf /var/log/journal/* /var/lib/cardano-node/{db*,logs,logs-*,*.log,utxo}"
372372

373-
oprint "$(date), restarting nodes.."
373+
oprint "$(date), restarting journald & nodes.."
374374
nixops ssh-for-each --parallel "systemctl start systemd-journald"
375375
sleep 3s
376376
nixops ssh-for-each --parallel "systemctl start cardano-node"

bench/lib-analyses.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ analysis_derived() {
223223
<<<0
224224
}
225225

226-
analysis_list+=(analysis_sanity)
226+
analysis_list+=()
227227
analysis_sanity() {
228228
local dir=${1:-.} tag errors
229229
tag=$(run_tag "$dir")

bench/lib-analysis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ analyse_run() {
7070
do echo -n " $a" | sed 's/analysis_//'
7171
$a "$dir" "${machines[@]}"; done
7272

73-
patch_run "$dir"
73+
# patch_run "$dir"
7474

7575
# rm -rf "$dir"/analysis/{analysis,logs-node-*,logs-explorer,startup}
7676

bench/lib-deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ nixopsfile_producers() {
247247
}
248248

249249
op_stop() {
250-
nixops ssh-for-each --parallel "systemctl stop cardano-node 2>/dev/null || true"
251-
nixops ssh-for-each --parallel "systemctl stop systemd-journald 2>/dev/null || true"
250+
nixops ssh-for-each --parallel "systemctl stop cardano-node 2>/dev/null || true" &
251+
nixops ssh-for-each --parallel "systemctl stop systemd-journald 2>/dev/null || true" &
252+
wait
252253
}
253254

254255
op_on() {

bench/lib-fetch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fetch_effective_service_node_config() {
1818
test -n "$execstart" || \
1919
fail "Couldn't determine ExecStart for '$svc' on '$mach'"
2020
configfilename=$(nixops ssh "$mach" -- \
21-
grep -e '-config-.*\.json' "$execstart" |
21+
grep -e '-config.*\.json' "$execstart" |
2222
sed 's_^.*\(/nix/store/.*\.json\).*_\1_' |
2323
head -n1 ||
2424
fail "Failed to fetch & parse ExecStart of '$svc' on '$mach'")

bench/lib-genesis-byron.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ profile_genesis_byron() {
6767

6868
cardano-cli byron genesis genesis "${genesis_cli_args[@]}"
6969
rm -f "$byron_params_tmpfile"
70-
71-
oprint "generated genesis for $prof in: $target_dir"
7270
}
7371

7472
genesis_update_starttime_byron() {

bench/lib-genesis.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ genesis_cache_id() {
3838
genesis_cache_params_cache_id "$(genesis_params_cache_params "$1")"
3939
}
4040

41+
ensure_genesis() {
42+
local prof=$1
43+
44+
oprint "ensuring proper genesis.."
45+
local genesislog
46+
genesislog=runs/$(timestamp).genesis.$prof.log
47+
profile_genesis "$prof" 2>&1 || {
48+
fprint "genesis generation failed:"
49+
cat "$genesislog" >&2
50+
exit 1
51+
} | tee "$genesislog";
52+
}
53+
4154
profile_genesis() {
4255
local profile=$1 genesis_dir=${2:-./keys}
4356
local genesis_params genesis_cache_params cache_id cache_path genesis_future_offset

bench/lib-params.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ include "profile-definitions" { search: "bench" };
100100
| ($generator_defaults * .generator) as $gtor
101101
| ($node_defaults * .node) as $node
102102
| era_tolerances($era; $gsis) as $tolr
103-
| { genesis:
103+
| { description:
104+
(.desc // .description // "")
105+
, genesis:
104106
($gsis * derived_genesis_params($era; $compo; $gtor; $gsis; $node))
105107
, generator:
106108
($gtor * derived_generator_params($era; $compo; $gtor; $gsis; $node))
@@ -168,6 +170,15 @@ get_era() {
168170
parmetajq '.era'
169171
}
170172

173+
list_profiles() {
174+
rparmjq 'del(.meta)
175+
| to_entries
176+
| sort_by(.value.description)
177+
| map("\(.key
178+
| " " * (40 - length))\(.key): \(.value.description)")
179+
| .[]'
180+
}
181+
171182
query_profiles() {
172183
params profiles | words_to_lines |
173184
jq . --raw-input |

bench/lib-profile.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,18 @@ profile_deploy() {
3232
then { sleep 0.3; tail -f "$deploylog"; } &
3333
watcher_pid=$!; fi
3434

35+
if test -n "$watcher_pid"
36+
then kill "$watcher_pid" >/dev/null 2>&1 || true; fi
37+
38+
local genesis_timestamp=$(timestamp)
39+
3540
if test -z "$no_prebuild"
3641
then oprint "prebuilding:"
3742
## 0. Prebuild:
43+
ensure_genesis "$prof" "$genesis_timestamp"
3844
time deploy_build_only "$prof" "$deploylog" "$watcher_pid"; fi
3945

40-
if test -n "$watcher_pid"
41-
then kill "$watcher_pid" >/dev/null 2>&1 || true; fi
42-
43-
oprint "regenerating genesis.."
44-
local genesislog
45-
genesislog=runs/$(timestamp).genesis.$prof.log
46-
profile_genesis "$prof" 2>&1 || {
47-
fprint "genesis generation failed:"
48-
cat "$genesislog" >&2
49-
exit 1
50-
} | tee "$genesislog";
46+
ensure_genesis "$prof" "$genesis_timestamp"
5147

5248
include="explorer $(params producers)"
5349

bench/lib-sanity.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ sanity_check_last_log_spread() {
4242
} + .)
4343
| .[]'
4444
}
45-
sanity_check_list+=(sanity_check_not_even_started)
45+
sanity_check_list+=()
4646
sanity_check_not_even_started() {
4747
local dir=$1 t=${2:-$(jq .meta.profile_content.tolerances $dir/meta.json)}
4848
sanity_check "$t" "$dir" '
@@ -52,7 +52,7 @@ sanity_check_not_even_started() {
5252
| { kind: "blockchain-not-even-started"
5353
}' --slurpfile blocks "$dir"/analysis/explorer.MsgBlock.json
5454
}
55-
sanity_check_list+=(sanity_check_silence_since_last_block)
55+
sanity_check_list+=()
5656
sanity_check_silence_since_last_block() {
5757
local dir=$1 t=${2:-$(jq .meta.profile_content.tolerances $dir/meta.json)}
5858
sanity_check "$t" "$dir" '
@@ -109,7 +109,7 @@ sanity_check_tx_loss_over_threshold() {
109109
, received: $txstats.tx_seen_in_blocks
110110
}'
111111
}
112-
sanity_check_list+=(sanity_check_chain_density)
112+
sanity_check_list+=()
113113
sanity_check_chain_density() {
114114
local dir=$1 t=${2:-$(jq .meta.profile_content.tolerances $dir/meta.json)}
115115
sanity_check "$t" "$dir" '

0 commit comments

Comments
 (0)