Skip to content

Commit

Permalink
fix(ci): stabilize microbenchmark (#12900)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel authored Oct 17, 2023
1 parent 57b4641 commit e66e3ad
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
17 changes: 17 additions & 0 deletions ci/scripts/run-micro-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ set -euo pipefail
# Make sure the added benchmark has a unique name.
BENCHMARKS="stream_hash_agg json_parser bench_block_iter bench_compactor bench_lru_cache bench_merge_iter"

# Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
get_instance_type() {
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-type
}

# cargo criterion --bench stream_hash_agg --message-format=json
bench() {
BENCHMARK_NAME=$1
Expand All @@ -34,6 +40,17 @@ bench() {
}

main() {
# FIXME(kwannoel): This is a workaround
# Microbenchmarks need to be namespaced by instance types,
# the result upload endpoint needs to be parameterized by instance type as well to support this.
echo "--- Getting aws instance type"
local instance_type=$(get_instance_type)
echo "instance_type: $instance_type"
if [[ $instance_type != "m6i.4xlarge" ]]; then
echo "Only m6i.4xlarge is supported, skipping microbenchmark"
exit 0
fi

# We need cargo criterion to generate machine-readable benchmark results from
# microbench.
echo "--- Installing cargo criterion"
Expand Down
33 changes: 32 additions & 1 deletion ci/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,35 @@ steps:
if: build.pull_request.labels includes "ci/skip-ci" && !build.pull_request.draft
commands:
- echo "ci/skip-ci is only usable for draft Pull Requests"
- exit 1
- exit 1

- label: "micro benchmark"
command: "ci/scripts/run-micro-benchmarks.sh"
key: "run-micro-benchmarks"
if: build.pull_request.labels includes "ci/run-micro-benchmarks"
plugins:
- docker-compose#v4.9.0:
run: rw-build-env
config: ci/docker-compose.yml
mount-buildkite-agent: true
timeout_in_minutes: 60
retry: *auto-retry

- label: "upload micro-benchmark"
if: build.pull_request.labels includes "ci/run-upload-micro-benchmark"
command:
- "BUILDKITE_BUILD_NUMBER=$BUILDKITE_BUILD_NUMBER ci/scripts/upload-micro-bench-results.sh"
depends_on: "run-micro-benchmarks"
plugins:
- seek-oss/aws-sm#v2.3.1:
env:
BUILDKITE_TOKEN: buildkite_token
GITHUB_TOKEN: github-token
- docker-compose#v4.9.0:
run: rw-build-env
config: ci/docker-compose.yml
mount-buildkite-agent: true
environment:
- BUILDKITE_TOKEN
- GITHUB_TOKEN
timeout_in_minutes: 5

0 comments on commit e66e3ad

Please sign in to comment.