Skip to content
Permalink
Browse files

Merge pull request #531 from input-output-hk/rvl/nightly-db-bench

Buildkite: Run DB bench in the nightly pipeline
  • Loading branch information...
KtorZ committed Jul 12, 2019
2 parents 8cf6a52 + 19be65c commit 6479a6eaab1256e7034c68230fc4f2f77c6a0e88
Showing with 83 additions and 21 deletions.
  1. +29 −0 .buildkite/bench-db.sh
  2. +35 −0 .buildkite/bench-restore.sh
  3. +0 −19 .buildkite/benchmark.sh
  4. +8 −2 .buildkite/nightly.yml
  5. +11 −0 nix/default.nix
@@ -0,0 +1,29 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix coreutils buildkite-agent

set -euo pipefail

bench_name=bench-db

rm -rf $bench_name

echo "--- Build"
nix-build -A benchmarks.cardano-wallet-core.db -o $bench_name

echo "+++ Run benchmark"

./$bench_name/cardano-wallet-core*/db --json $bench_name.json -o $bench_name.html | tee $bench_name.txt

printf 'Link to \033]1339;url=artifact://'$bench_name.html';content='"Benchmark Report"'\a\n'

echo "--- Upload report"

if [ -n "${BUILDKITE:-}" ]; then
buildkite-agent artifact upload "$bench_name.html"
buildkite-agent artifact upload "$bench_name.json"

# Requires buildkite-agent 3.x
# cat << EOF | buildkite-agent annotate --style "info"
# Read the <a href="artifact://$bench_name.html">benchmark results</a>
# EOF
fi
@@ -0,0 +1,35 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix coreutils gnugrep gawk time haskellPackages.hp2pretty buildkite-agent

set -euo pipefail

target=http-bridge
artifact_name=restore-$target-$NETWORK
log=restore.log
results=restore-$target-$NETWORK.txt
total_time=restore-time.txt

echo "--- Build"
nix-build -A benchmarks.cardano-wallet-$target.restore -o bench-$target-restore
bench=./bench-$target-restore/bin/restore

echo "--- Run benchmarks - $target - $NETWORK"
command time -o $total_time -v $bench "$NETWORK" +RTS -N2 -qg -A1m -I0 -T -M8G -h -RTS 2>&1 | tee $log

grep -v INFO $log | awk '/All results/,EOF { print $0 }' > $results

echo "+++ Results - $target - $NETWORK"

cat $results

mv restore.hp $artifact_name.hp
hp2pretty $artifact_name.hp

if [ -n "${BUILDKITE:-}" ]; then
echo "--- Upload"
buildkite-agent artifact upload $artifact_name.svg
buildkite-agent artifact upload $results

echo "+++ Heap profile"
printf '\033]1338;url='"artifact://$artifact_name.svg"';alt='"Heap profile"'\a\n'
fi

This file was deleted.

@@ -2,16 +2,22 @@ env:
NIX_PATH: "channel:nixos-19.03"
steps:
- label: 'Restore benchmark - testnet'
command: "./.buildkite/benchmark.sh"
command: "./.buildkite/bench-restore.sh"
timeout_in_minutes: 60
agents:
system: x86_64-linux
env:
NETWORK: testnet
- label: 'Restore benchmark - mainnet'
command: "./.buildkite/benchmark.sh"
command: "./.buildkite/bench-restore.sh"
timeout_in_minutes: 90
agents:
system: x86_64-linux
env:
NETWORK: mainnet

- label: 'Database benchmark'
command: "./.buildkite/bench-db.sh"
timeout_in_minutes: 60
agents:
system: x86_64-linux
@@ -53,6 +53,17 @@ let
integration.build-tools = [ jormungandr ];
unit.build-tools = [ jormungandr ];
};

packages.cardano-wallet-http-bridge.components.benchmarks.restore = {
build-tools = [ pkgs.makeWrapper ];
postInstall = ''
makeWrapper \
$out/cardano-wallet-*/restore \
$out/bin/restore \
--prefix PATH : ${cardano-http-bridge}/bin
'';
};
packages.cardano-wallet-http-bridge.components.all.postInstall = pkgs.lib.mkForce "";
}

# Misc. build fixes for dependencies

0 comments on commit 6479a6e

Please sign in to comment.
You can’t perform that action at this time.