Skip to content

Commit

Permalink
Merge pull request #16511 from MinaProtocol/dkijania/build_performanc…
Browse files Browse the repository at this point in the history
…e_tooling_in_ci_dev

[Dev] Run benchmarks in CI
  • Loading branch information
dkijania authored Jan 23, 2025
2 parents 3f777b6 + 02f46e6 commit 9bfe8ca
Show file tree
Hide file tree
Showing 22 changed files with 289 additions and 175 deletions.
34 changes: 34 additions & 0 deletions buildkite/scripts/bench/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -eox pipefail

# Don't prompt for answers during apt-get install

YELLOW_THRESHOLD="0.1"
RED_THRESHOLD="0.3"
EXTRA_ARGS=""

source buildkite/scripts/bench/install.sh

MAINLINE_BRANCHES="-m develop -m compatile -m master -m dkijania/build_performance_tooling_in_ci"
while [[ "$#" -gt 0 ]]; do case $1 in
heap-usage) BENCHMARK="heap-usage"; ;;
mina-base) BENCHMARK="mina-base"; ;;
ledger-export)
BENCHMARK="ledger-export"
EXTRA_ARGS="--genesis-ledger-path ./genesis_ledgers/devnet.json"
;;
snark)
BENCHMARK="snark";
K=1
MAX_NUM_UPDATES=4
MIN_NUM_UPDATES=2
EXTRA_ARGS="--k ${K} --max-num-updates ${MAX_NUM_UPDATES} --min-num-updates ${MIN_NUM_UPDATES}"
;;
zkapp) BENCHMARK="zkapp"; ;;
--yellow-threshold) YELLOW_THRESHOLD="$2"; shift;;
--red-threshold) RED_THRESHOLD="$2"; shift;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done

python3 ./scripts/benchmarks test --benchmark ${BENCHMARK} --branch ${BUILDKITE_BRANCH} --tmpfile ${BENCHMARK}.csv --yellow-threshold $YELLOW_THRESHOLD --red-threshold $RED_THRESHOLD $MAINLINE_BRANCHES $EXTRA_ARGS
12 changes: 0 additions & 12 deletions buildkite/scripts/bench/snark_transaction_profiler.sh

This file was deleted.

9 changes: 0 additions & 9 deletions buildkite/scripts/bench/zkapp_metrics.sh

This file was deleted.

15 changes: 10 additions & 5 deletions buildkite/src/Command/Bench/Base.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ let command
, commands =
RunInToolchain.runInToolchain
(Benchmarks.toEnvList Benchmarks.Type::{=})
"./buildkite/scripts/benchmarks.sh ${spec.bench} --red-threshold ${Double/show
spec.redThreshold} --yellow-threshold ${Double/show
spec.yellowThreshold}"
, label = "Perf: ${spec.label}"
"./buildkite/scripts/bench/run.sh ${spec.bench} --red-threshold ${Double/show
spec.redThreshold} --yellow-threshold ${Double/show
spec.yellowThreshold}"
, label =
"Perf: ${spec.label} ${PipelineMode.capitalName spec.mode}"
, key = spec.key
, target = spec.size
, docker = None Docker.Type
Expand All @@ -80,8 +81,12 @@ let pipeline
, SelectFiles.exactly
"buildkite/src/Command/Bench/Base"
"dhall"
, SelectFiles.exactly "buildkite/scripts/bench/install" "sh"
, SelectFiles.exactly "buildkite/scripts/bench/run" "sh"
, SelectFiles.contains "scripts/benchmark"
, SelectFiles.contains "buildkite/scripts/benchmark"
, SelectFiles.exactly
"buildkite/src/Jobs/Bench/${spec.name}"
"dhall"
]
# spec.additionalDirtyWhen
, path = spec.path
Expand Down
8 changes: 4 additions & 4 deletions buildkite/src/Constants/Benchmarks.dhall
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
let Spec =
{ Type = { tokenEnvName : Text, bucket : Text, org : Text, host : Text }
, default =
{ tokenEnvName = "\\\${INFLUX_TOKEN}"
, bucket = "\\\${INFLUX_BUCKET_NAME}"
, org = "\\\${INFLUX_ORG}"
, host = "\\\${INFLUX_HOST}"
{ tokenEnvName = "\\\${INFLUXDB_TOKEN}"
, bucket = "\\\${INFLUXDB_BUCKET}"
, org = "\\\${INFLUXDB_ORG}"
, host = "\\\${INFLUXDB_HOST}"
}
}

Expand Down
2 changes: 0 additions & 2 deletions buildkite/src/Constants/DebianVersions.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ let minimalDirtyWhen =
, S.exactly "buildkite/scripts/build-artifact" "sh"
, S.exactly "buildkite/scripts/build-hardfork-package" "sh"
, S.exactly "buildkite/scripts/check-compatibility" "sh"
, S.exactly "buildkite/src/Jobs/Test/RunSnarkProfiler" "dhall"
, S.exactly "buildkite/scripts/bench/snark_transaction_profiler" "sh"
, S.exactly "buildkite/scripts/version-linter" "sh"
, S.exactly "scripts/version-linter" "py"
]
Expand Down
21 changes: 21 additions & 0 deletions buildkite/src/Jobs/Bench/HeapUsageStable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let name = "HeapUsageStable"

let bench = "heap-usage"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, mode = PipelineMode.Type.Stable
, path = "Bench"
, name = name
, label = "Heap Usage"
, key = bench
, bench = bench
}
)
20 changes: 20 additions & 0 deletions buildkite/src/Jobs/Bench/HeapUsageUnstable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let name = "HeapUsageUnstable"

let bench = "heap-usage"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, path = "Bench"
, name = name
, label = "Heap Usage"
, key = bench
, bench = bench
, yellowThreshold = 0.1
, redThreshold = 0.3
}
)
21 changes: 21 additions & 0 deletions buildkite/src/Jobs/Bench/LedgerExportStable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let name = "LedgerExportStable"

let bench = "ledger-export"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, mode = PipelineMode.Type.Stable
, path = "Bench"
, name = name
, label = "Ledger Export"
, key = bench
, bench = bench
}
)
23 changes: 23 additions & 0 deletions buildkite/src/Jobs/Bench/LedgerExportUnstable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let Size = ../../Command/Size.dhall

let name = "LedgerExportUnstable"

let bench = "ledger-export"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, path = "Bench"
, name = name
, label = "Ledger Export"
, size = Size.Small
, bench = bench
, key = bench
, yellowThreshold = 0.1
, redThreshold = 0.3
}
)
21 changes: 21 additions & 0 deletions buildkite/src/Jobs/Bench/MinaBaseStable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let name = "MinaBaseStable"

let bench = "mina-base"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, mode = PipelineMode.Type.Stable
, path = "Bench"
, name = name
, label = "Mina Base"
, key = bench
, bench = bench
}
)
23 changes: 23 additions & 0 deletions buildkite/src/Jobs/Bench/MinaBaseUnstable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let Size = ../../Command/Size.dhall

let name = "MinaBaseUnstable"

let bench = "mina-base"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, path = "Bench"
, name = name
, label = "Mina Base"
, size = Size.Small
, bench = bench
, key = bench
, yellowThreshold = 0.1
, redThreshold = 0.3
}
)
21 changes: 21 additions & 0 deletions buildkite/src/Jobs/Bench/SnarkProfilerStable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let name = "SnarkProfilerStable"

let bench = "snark"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, mode = PipelineMode.Type.Stable
, path = "Bench"
, name = name
, label = "Snark Profiler"
, key = bench
, bench = bench
}
)
23 changes: 23 additions & 0 deletions buildkite/src/Jobs/Bench/SnarkProfilerUnstable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let Size = ../../Command/Size.dhall

let name = "SnarkProfilerUnstable"

let bench = "snark"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, path = "Bench"
, name = name
, label = "Snark Profiler"
, size = Size.Small
, bench = bench
, key = bench
, yellowThreshold = 0.1
, redThreshold = 0.3
}
)
21 changes: 21 additions & 0 deletions buildkite/src/Jobs/Bench/ZkappLimitsStable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let name = "ZkappLimitsStable"

let bench = "zkapp"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, mode = PipelineMode.Type.Stable
, path = "Bench"
, name = name
, label = "Zkapp Limits"
, key = bench
, bench = bench
}
)
23 changes: 23 additions & 0 deletions buildkite/src/Jobs/Bench/ZkappLimitsUnstable.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
let BenchBase = ../../Command/Bench/Base.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let Size = ../../Command/Size.dhall

let name = "ZkappLimitsUnstable"

let bench = "zkapp"

in Pipeline.build
( BenchBase.pipeline
BenchBase.Spec::{
, path = "Bench"
, name = name
, label = "Zkapp Limits"
, size = Size.Small
, key = bench
, bench = bench
, yellowThreshold = 0.1
, redThreshold = 0.3
}
)
Loading

0 comments on commit 9bfe8ca

Please sign in to comment.