-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmarking additions to oasis-test-runner and oasis-node
- Loading branch information
Showing
52 changed files
with
2,019 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
# Copied from pipeline.yml. | ||
docker_plugin_default_config: &docker_plugin_default_config | ||
image: "oasislabs/testing:0.3.0" | ||
always_pull: true | ||
workdir: /workdir | ||
volumes: | ||
- /var/lib/buildkite-agent/.coveralls:/root/.coveralls | ||
- /var/lib/buildkite-agent/.codecov:/root/.codecov | ||
# Shared Rust incremental compile caches. | ||
- /var/tmp/cargo_ic/debug:/var/tmp/artifacts/debug/incremental | ||
- /var/tmp/cargo_ic/debug_sgx:/var/tmp/artifacts/x86_64-unknown-linux-sgx/debug/incremental | ||
# Shared Rust package checkouts directory. | ||
- /var/tmp/cargo_pkg/git:/root/.cargo/git | ||
- /var/tmp/cargo_pkg/registry:/root/.cargo/registry | ||
# Shared Rust SGX standard library artifacts cache. | ||
- /var/tmp/xargo_cache:/root/.xargo | ||
# Shared Go package checkouts directory. | ||
- /var/tmp/go_pkg:/root/go/pkg | ||
# Intel SGX Application Enclave Services Manager (AESM) daemon running on | ||
# the Buildkite host. | ||
- /var/run/aesmd/aesm.socket:/var/run/aesmd/aesm.socket | ||
- /var/tmp/benchmarks:/var/tmp/benchmarks | ||
environment: | ||
- "LC_ALL=C.UTF-8" | ||
- "LANG=C.UTF-8" | ||
- "CARGO_TARGET_DIR=/var/tmp/artifacts" | ||
- "CARGO_INSTALL_ROOT=/root/.cargo" | ||
- "GOPROXY=https://proxy.golang.org/" | ||
- "SLACK_WEBHOOK_URL" | ||
- "METRICS_PUSH_ADDR" | ||
- "METRICS_QUERY_ADDR" | ||
- "METRICS_SOURCE_GIT_BRANCH" | ||
- "METRICS_TARGET_GIT_BRANCH" | ||
- "TESTS" | ||
propagate-environment: true | ||
unconfined: true | ||
|
||
docker_plugin: &docker_plugin | ||
oasislabs/docker#v3.0.1-oasis1: | ||
<<: *docker_plugin_default_config | ||
|
||
steps: | ||
############################################################### | ||
# The following three steps are copied from code.pipeline.yml # | ||
############################################################### | ||
############ | ||
# Build jobs | ||
############ | ||
# This label needs to be synced with runtime-ethereum's | ||
# .buildkite/scripts/download_utils.sh. | ||
- label: Build Go node | ||
command: | ||
- .buildkite/go/build.sh | ||
|
||
# Upload the built artifacts. | ||
- cd /workdir/go/oasis-node | ||
- buildkite-agent artifact upload oasis-node | ||
- cd /workdir/go/oasis-node/integrationrunner | ||
- buildkite-agent artifact upload integrationrunner.test | ||
- cd /workdir/go/oasis-test-runner | ||
- buildkite-agent artifact upload oasis-test-runner | ||
- cd /workdir/go/oasis-net-runner | ||
- buildkite-agent artifact upload oasis-net-runner | ||
- cd /workdir/go/oasis-remote-signer | ||
- buildkite-agent artifact upload oasis-remote-signer | ||
plugins: | ||
<<: *docker_plugin | ||
|
||
# This label needs to be synced with runtime-ethereum's | ||
# .buildkite/scripts/download_utils.sh. | ||
- label: Build Rust runtime loader | ||
command: | ||
- .buildkite/rust/build_generic.sh /workdir -p oasis-core-runtime-loader | ||
- .buildkite/rust/build_generic.sh /workdir -p test-long-term-client | ||
- .buildkite/rust/build_generic.sh /workdir -p simple-keyvalue-client | ||
- .buildkite/rust/build_generic.sh /workdir -p simple-keyvalue-enc-client | ||
- .buildkite/rust/build_generic.sh /workdir -p simple-keyvalue-ops-client | ||
|
||
# Upload the built artifacts. | ||
- cd /var/tmp/artifacts/default/debug | ||
- buildkite-agent artifact upload oasis-core-runtime-loader | ||
# Clients for E2E tests. | ||
- buildkite-agent artifact upload test-long-term-client | ||
- buildkite-agent artifact upload simple-keyvalue-client | ||
- buildkite-agent artifact upload simple-keyvalue-enc-client | ||
- buildkite-agent artifact upload simple-keyvalue-ops-client | ||
agents: | ||
buildkite_agent_size: large | ||
plugins: | ||
<<: *docker_plugin | ||
|
||
#################### | ||
# Runtime build jobs | ||
#################### | ||
# This label needs to be synced with runtime-ethereum's | ||
# .buildkite/rust/test_runtime_and_gateway.sh and .buildkite/scripts/download_utils.sh. | ||
- label: Build key manager runtime | ||
command: | ||
- .buildkite/rust/build_runtime.sh keymanager-runtime | ||
- .buildkite/rust/build_runtime.sh tests/runtimes/simple-keyvalue | ||
|
||
# Upload the built artifacts. | ||
- cd /var/tmp/artifacts/sgx/x86_64-fortanix-unknown-sgx/debug | ||
- buildkite-agent artifact upload oasis-core-keymanager-runtime.sgxs | ||
- buildkite-agent artifact upload simple-keyvalue.sgxs | ||
- cd /var/tmp/artifacts/default/debug | ||
- buildkite-agent artifact upload oasis-core-keymanager-runtime | ||
- buildkite-agent artifact upload simple-keyvalue | ||
agents: | ||
buildkite_agent_size: large | ||
plugins: | ||
<<: *docker_plugin | ||
|
||
########################################################## | ||
# Build benchmark analysis tool, perform tests, evaluate # | ||
########################################################## | ||
- label: Build benchmark analysis tool | ||
command: | ||
- cd /workdir/go/extra/ba | ||
- go build | ||
- buildkite-agent artifact upload ba | ||
plugins: | ||
<<: *docker_plugin | ||
|
||
# Wait for all jobs defined before this point | ||
# to finish running in parallel before continuing. | ||
- wait | ||
|
||
- label: E2E tests | ||
parallelism: 1 | ||
timeout_in_minutes: 90 | ||
command: | ||
- .buildkite/scripts/download_e2e_test_artifacts.sh | ||
- rm -rf /var/tmp/benchmarks/* | ||
- .buildkite/scripts/test_e2e.sh --metrics.address $METRICS_PUSH_ADDR --metrics.push.interval 5s --num_runs 3 -t $TESTS | ||
env: | ||
TEST_BASE_DIR: /var/tmp/benchmarks | ||
agents: | ||
buildkite_agent_size: large | ||
buildkite_agent_class: stable | ||
plugins: | ||
<<: *docker_plugin | ||
|
||
# Wait for all jobs defined before this point | ||
# to finish running in parallel before continuing. | ||
- wait | ||
|
||
- label: Benchmark analysis | ||
command: | ||
- .buildkite/scripts/download_benchmark_artifacts.sh | ||
- .buildkite/scripts/daily_benchmark_analysis.sh | ||
plugins: | ||
<<: *docker_plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /bin/bash | ||
|
||
set -ux | ||
|
||
# Script invoked from .buildkite/benchmarks.pipeline.yml | ||
|
||
./go/extra/ba/ba cmp --metrics.address $METRICS_QUERY_ADDR --metrics.target.git_branch $METRICS_TARGET_GIT_BRANCH --metrics.source.git_branch $METRICS_SOURCE_GIT_BRANCH -t $TESTS 2>error.txt 1>out.txt | ||
BA_RETURN_CODE=$? | ||
|
||
# Escape double quotes for JSON. | ||
BA_STDOUT=`cat out.txt | sed "s/\"/\\\\\\\\\"/g"` | ||
BA_STDERR=`cat error.txt | sed "s/\"/\\\\\\\\\"/g"` | ||
|
||
if [ $BA_RETURN_CODE != 0 ]; then | ||
# Post error to slack channel. | ||
curl -H "Content-Type: application/json" \ | ||
-X POST \ | ||
--data "{\"text\": \"Daily oasis-core benchmarks failed.\", \"attachments\":[{\"title\":\"stdout\",\"text\":\"$BA_STDOUT\"}, {\"title\":\"stderr\",\"text\":\"$BA_STDERR\"}]}" \ | ||
"$SLACK_WEBHOOK_URL" | ||
|
||
# Exit with non-zero exit code, so that the buildkite build will be | ||
# marked as failed. | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /bin/bash | ||
|
||
#################################################### | ||
# Download artifacts needed to perform benchmarks. # | ||
#################################################### | ||
|
||
# Helpful tips on writing build scripts: | ||
# https://buildkite.com/docs/pipelines/writing-build-scripts | ||
set -euxo pipefail | ||
|
||
source .buildkite/scripts/common.sh | ||
|
||
# Extra tools | ||
download_artifact ba go/extra/ba 755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#/bin/bash | ||
|
||
# bench.sh and parse_bench.py are used to benchmark specific e2e test using | ||
# various execution parameters and parse the results. | ||
# Accepted environmental variables are: | ||
# - GS: executor group size, | ||
# - RT: number of runtimes used, | ||
# - W: number of compute workers used. | ||
# | ||
# Because of syncing and flushing caches, you need to run this script as root. | ||
# For example: | ||
# sudo GS=2 RT=4 W=2 ./bench.sh multiple-runtimes | ||
# | ||
# If no environmental variables are set, this script benchmarks all GS and RT | ||
# combinations from 1..128 in power of 2. W will equal GS for each run. | ||
|
||
set -x | ||
|
||
if [ "$#" -ne 1 ] | ||
then | ||
echo "Usage: $0 <TEST NAME>" | ||
exit 1 | ||
fi | ||
|
||
if [ "$USER" != "root" ] | ||
then | ||
echo "This script should be run as root." | ||
exit 2 | ||
fi | ||
|
||
BENCH_RESULTS_DIR=bench-results | ||
TEST="$1" | ||
|
||
cleanup() { | ||
killall -q mpstat | ||
killall -q iostat | ||
killall -q sar | ||
} | ||
|
||
trap cleanup EXIT | ||
trap "exit" INT | ||
|
||
mkdir -p bench-results | ||
|
||
# Environmental variables GS and RT. | ||
GROUP_SIZES=$GS | ||
RUNTIMES=$RT | ||
if [ -z "$GROUP_SIZES" ] | ||
then | ||
GROUP_SIZES="1 2 3 4 6 8" | ||
fi | ||
if [ -z "$RUNTIMES" ] | ||
then | ||
RUNTIMES="1 2 3 4 5 6" | ||
fi | ||
|
||
for G in $GROUP_SIZES; do | ||
for R in $RUNTIMES; do | ||
if [ -z "$W" ] | ||
then | ||
WORKERS=$G | ||
else | ||
WORKERS=$W | ||
fi | ||
|
||
echo "BENCHMARK: Executing test $TEST with executor group size $G, runtime count $R, and compute workers $WORKERS..." | ||
BENCH_INFO=GS_$G.RT_$R.W_$WORKERS | ||
|
||
# Flush all to disk, clear any caches. | ||
sync; echo 3 > /proc/sys/vm/drop_caches | ||
|
||
mpstat -P ALL 1 >$BENCH_RESULTS_DIR/$TEST.$BENCH_INFO.mpstat & | ||
iostat -d /dev/sda -x 1 >$BENCH_RESULTS_DIR/$TEST.$BENCH_INFO.iostat & | ||
sar -r 1 >$BENCH_RESULTS_DIR/$TEST.$BENCH_INFO.sar & | ||
|
||
|
||
EXECUTOR_GROUP_SIZE=$G \ | ||
COMPUTE_RUNTIMES=$R \ | ||
COMPUTE_WORKERS=$WORKERS \ | ||
/usr/bin/time -o $BENCH_RESULTS_DIR/$TEST.$BENCH_INFO.time \ | ||
.buildkite/scripts/test_e2e.sh -t $TEST | ||
|
||
cleanup | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Benchmark analysis | ||
|
||
Connects to prometheus and compares results of benchmark results. | ||
|
||
## Basic usage | ||
|
||
```bash | ||
$ ba/ba cmp \ | ||
--metrics.address http://localhost:9090 | ||
``` |
Oops, something went wrong.