Skip to content

Commit

Permalink
GEODE-6135 - Add benchmark job to CI. (apache#3041)
Browse files Browse the repository at this point in the history
* Add a job to concourse for executing benchmarks
* Benchmarks run in AWS, results are stored in GCP.

Authored-by: Sean Goller <[email protected]>
Authored-by: Helena Bales <[email protected]>
  • Loading branch information
nabarunnag authored and jake-at-work committed Jan 10, 2019
1 parent 3737d4c commit 65db24c
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ci/images/alpine-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM alpine:latest
FROM openjdk:8-jdk-alpine

COPY --from=google/cloud-sdk:alpine /google-cloud-sdk /google-cloud-sdk
COPY --from=hashicorp/packer:latest /bin/packer /usr/local/bin/packer
Expand Down Expand Up @@ -41,4 +41,5 @@ RUN apk --no-cache add \
&& rm -rf winrm-cli \
&& gcloud components install -q beta \
&& printf "Host *\n ServerAliveInterval 60 \n ServerAliveCountMax 2\n" >> /etc/ssh/ssh_config \
&& pip2 install awscli \
&& apk --no-cache del go make
61 changes: 60 additions & 1 deletion ci/pipelines/geode-build/jinja.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ groups:
{%- if repository.upstream_fork != "apache" or repository.branch == "develop" %}
- PublishArtifacts
{%- endif %}
- Benchmark
- name: linux
jobs:
- {{ build_test.name }}
Expand All @@ -120,6 +121,7 @@ groups:
- {{test.name}}Test{{java_test_version.name}}
{%- endfor -%}
{%- endfor %}
- Benchmark
- name: windows
jobs:
- {{ build_test.name }}
Expand All @@ -145,7 +147,6 @@ resources:
type: git
source:
branch: ((geode-build-branch))
depth: 1
ignore_paths:
- ci/*
{{ github_access() | indent(4) }}
Expand All @@ -158,6 +159,12 @@ resources:
- ci/pipelines/geode-build/*
- ci/scripts/*
{{ github_access() | indent(4) }}
- name: geode-benchmarks
type: git
source:
branch: develop
depth: 1
uri: https://github.com/apache/geode-benchmarks.git
- name: geode-build-version
type: semver
source:
Expand Down Expand Up @@ -314,6 +321,58 @@ jobs:
outputs:
- name: results
{% endif %}
- name: Benchmark
public: true
plan:
- get: geode-ci
- aggregate:
- get: geode
passed:
{{ all_gating_jobs() | indent(6) }}
trigger: true
- get: geode-benchmarks
- get: geode-build-version
params:
pre: build
- put: concourse-metadata-resource
- task: run_benchmarks
{{- alpine_tools_config()|indent(4) }}
params:
AWS_ACCESS_KEY_ID: ((benchmarks-access-key-id))
AWS_SECRET_ACCESS_KEY: ((benchmarks-secret-access-key))
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
ARTIFACT_BUCKET: ((artifact-bucket))
BASELINE_BRANCH: {{benchmarks.baseline_branch}}
run:
path: geode-ci/ci/scripts/run_benchmarks.sh
inputs:
- name: geode
- name: geode-ci
- name: geode-benchmarks
- name: concourse-metadata-resource
outputs:
- name: results
timeout: 1h
ensure:
do:
- task: cleanup_benchmarks
{{- alpine_tools_config()|indent(8) }}
params:
AWS_ACCESS_KEY_ID: ((benchmarks-access-key-id))
AWS_SECRET_ACCESS_KEY: ((benchmarks-secret-access-key))
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
ARTIFACT_BUCKET: ((artifact-bucket))
BASELINE_BRANCH: {{benchmarks.baseline_branch}}
run:
path: geode-ci/ci/scripts/cleanup_benchmarks.sh
inputs:
- name: geode
- name: geode-ci
- name: geode-benchmarks
- name: concourse-metadata-resource
- name: results
{% if repository.upstream_fork != "apache" or repository.branch == "develop" %}
- name: PublishArtifacts
public: true
Expand Down
3 changes: 3 additions & 0 deletions ci/pipelines/shared/jinja.variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ java_test_versions:
- name: OpenJDK11
version: 11

benchmarks:
baseline_branch: "rel/v1.8.0"

java_build_version:
name: OpenJDK8
version: 8
Expand Down
77 changes: 77 additions & 0 deletions ci/scripts/cleanup_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
BASE_DIR=$(pwd)

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

RESULTS_DIR=$(pwd)/results
export PAGER=
pushd geode
GEODE_SHA=$(git rev-parse --verify HEAD)
GEODE_SHA_COMMIT_MESSAGE=$(git log -n 1 ${GEODE_SHA})
popd

source concourse-metadata-resource/concourse_metadata
CLUSTER_TAG="${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}-${BUILD_ID}"
RESULTS_BASE_DIR=$(pwd)/results
BENCHMARKS_DIR=benchmarks-${CLUSTER_TAG}
RESULTS_DIR=${RESULTS_BASE_DIR}/benchmarks-${CLUSTER_TAG}
BENCHMARKS_ARCHIVE_FILENAME=${BENCHMARKS_DIR}.tgz
BENCHMARKS_ARCHIVE_FILE=${RESULTS_BASE_DIR}/${BENCHMARKS_ARCHIVE_FILENAME}
BENCHMARKS_ARTIFACTS_DESTINATION="${ARTIFACT_BUCKET}/benchmarks/${BUILD_PIPELINE_NAME}/${GEODE_SHA}"

if [[ "${ARTIFACT_BUCKET}" =~ \. ]]; then
ARTIFACT_SCHEME="http"
else
ARTIFACT_SCHEME="gs"
fi

pushd geode-benchmarks/infrastructure/scripts/aws/
./destroy_cluster.sh ${CLUSTER_TAG}
popd

pushd ${RESULTS_BASE_DIR}
if [[ -d ${BENCHMARKS_DIR} ]]; then
echo "***** Creating benchmarks archive"
tar zcf ${BENCHMARKS_ARCHIVE_FILE} ${BENCHMARKS_DIR}
echo "***** Copying benchmarks archive to storage"
gsutil cp ${BENCHMARKS_ARCHIVE_FILE} gs://${BENCHMARKS_ARTIFACTS_DESTINATION}/${BENCHMARKS_ARCHIVE_FILENAME}
printf "\n"
printf "\033[92m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\033[0m\n"
printf "\033[92mThis benchmark run is the result of comparing ${GEODE_SHA} with baseline ${BASELINE_BRANCH}\033[0m\n"
printf "\033[92m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Commit Message =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\033[0m\n"
echo "${GEODE_SHA_COMMIT_MESSAGE}"
printf "\033[92m=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Benchmark Results URI =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\033[0m\n"
printf "\033[92m${ARTIFACT_SCHEME}://${BENCHMARKS_ARTIFACTS_DESTINATION}/${BENCHMARKS_ARCHIVE_FILENAME}\033[0m\n"
printf "\033[92m=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\033[0m\n"
printf "\n"
else
echo "***************************"
echo "No benchmark results found!"
echo "***************************"
fi
popd
47 changes: 47 additions & 0 deletions ci/scripts/run_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

BASE_DIR=$(pwd)

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

source concourse-metadata-resource/concourse_metadata
CLUSTER_TAG="${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}-${BUILD_ID}"
RESULTS_DIR=$(pwd)/results/benchmarks-${CLUSTER_TAG}

CLUSTER_COUNT=4
BENCHMARKS_BRANCH=develop

pushd geode
GEODE_SHA=$(git rev-parse --verify HEAD)
popd

pushd geode-benchmarks/infrastructure/scripts/aws/
./launch_cluster.sh ${CLUSTER_TAG} ${CLUSTER_COUNT}
./run_against_baseline.sh ${CLUSTER_TAG} ${GEODE_SHA} ${BASELINE_BRANCH} ${BENCHMARKS_BRANCH} ${RESULTS_DIR}

popd

0 comments on commit 65db24c

Please sign in to comment.