diff --git a/scripts/bench.sh b/scripts/bench.sh new file mode 100644 index 000000000..ae89987d9 --- /dev/null +++ b/scripts/bench.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# This script runs benchmarks and posts them to Slack's #nightly channel. +# The caller of the script should `git pull` on the pilosa repo before executing. +# +# Environment variables: +# - PILOSA_SRC: Path to pilosa src directory. +# - SLACK_OAUTH_TOKEN: Token used to post to Slack. + +# Require environment variables. +: "${PILOSA_SRC:?Must set PILOSA_SRC environment variable}" +: "${SLACK_OAUTH_TOKEN:?Must set SLACK_OAUTH_TOKEN environment variable}" + +# Build pilosa into GOBIN. +make -C $PILOSA_SRC install + +# Retrieve current SHA. +SHA=$(git -C $PILOSA_SRC rev-parse HEAD) + +# Format current date. +DATE=$(date '+%Y%m%d') + +WORKFLOW_PATH="${BASH_SOURCE%/*}/etc/gloat/gh.1d.yml" +WORKFLOW_NAME="$(gloat workflow name $WORKFLOW_PATH)" +TITLE="RBF vs Roaring, $WORKFLOW_NAME, $DATE ($SHA)" + +# Execute RBF/Roaring benchmark. +RBF_PATH=gloat/data/1d/rbf/${DATE}.tar.gz +TXSRC=rbf gloat run -v -o $RBF_PATH $WORKFLOW_PATH + +ROARING_PATH=gloat/data/1d/roaring/${DATE}.tar.gz +TXSRC=roaring gloat run -v -o $ROARING_PATH $WORKFLOW_PATH + +# Generate graph from results. +gloat graph -layout 5,2 -size 2048,2048 -title "$TITLE" -name utime,stime,heap_alloc,heap_inuse,heap_objects,num_gc,rchar,wchar,syscr,syscw -series rbf,roaring -o /tmp/output.png $RBF_PATH $ROARING_PATH + +# Post graph to Slack with SHA. +curl -F file=@/tmp/output.png -F channels=C01HBFKRLGH -F "initial_comment=$TITLE" -H "Authorization: Bearer $SLACK_OAUTH_TOKEN" https://slack.com/api/files.upload diff --git a/scripts/etc/gloat/gh.1d.yml b/scripts/etc/gloat/gh.1d.yml new file mode 100644 index 000000000..93658c44a --- /dev/null +++ b/scripts/etc/gloat/gh.1d.yml @@ -0,0 +1,7 @@ +name: "GitHub Import Load Testing (1 day)" + +main: "pilosa server --data-dir ${TMPDIR} --txsrc ${TXSRC}" +load: "molecula-consumer-github -i events -d id --record-type event --batch-size=100000 --start-time 2020-01-01T00:00:00Z --end-time 2020-01-01T23:00:00Z --cache-dir .githubarchive" + +health_url: "http://localhost:10101/status" +debug_url: "http://localhost:10101/debug"