Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark filter run script #3271

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ data-plane/**/build/
/eventing-kafka-source-bundle.yaml

/eventing-kafka-tls-networking.yaml

## Ignore benchmark outputs
data-plane/**/*.out.txt
20 changes: 20 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,26 @@ export EVENT=alloc

For more information on the profiler test, see [the profiler test doc](./data-plane/profiler/README.md).

### Run Filter Benchmarks

If you are building a fitler benchmark or want to benchmark the performance delta caused when changing the filters, you can run:

```shell
./hack/run.sh benchmark-filter <filter_class_name>
```

This will run the benchmarks for the class with `<filter_class_name>`. For example, if you want to run all of the Exact Filter Benchmarks, you could run:
Cali0707 marked this conversation as resolved.
Show resolved Hide resolved

```shell
./hack/run.sh benchmark-filter ExactFilterBenchmark
```

Alternatively, if you want to run all of the benchmarks you can run:

```shell
./hack/run.sh benchmark-filters
```

## Code generation

Sometimes, before deploying the services it's required to run our code generators, by running the following command:
Expand Down
25 changes: 25 additions & 0 deletions data-plane/benchmarks/resources/config-logging.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--

Copyright © 2018 Knative Authors ([email protected])

Licensed 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.

-->
<configuration>
<appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
<root level="INFO">
<appender-ref ref="jsonConsoleAppender"/>
</root>
</configuration>
1 change: 1 addition & 0 deletions data-plane/benchmarks/resources/filter-class-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ExactFilterBenchmark
49 changes: 49 additions & 0 deletions data-plane/benchmarks/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# Copyright © 2018 Knative Authors ([email protected])
#
# Licensed 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

run_java_filter_benchmarks_for_class() {
CLASS=$1

echo "Running benchmarks for ${CLASS}"

java -jar "${SCRIPT_DIR}/target/benchmarks.jar" $CLASS 2>&1 | tee "${SCRIPT_DIR}/output/${CLASS}.out.txt"

echo "Successfully ran benchmarks for ${CLASS}!\n\nThe results can be found at ${SCRIPT_DIR}/output/${CLASS}.out.txt"
Cali0707 marked this conversation as resolved.
Show resolved Hide resolved
}

SCRIPT_DIR=$(cd -- "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

DATA_PLANE_DIR="${SCRIPT_DIR}/../"

pushd ${DATA_PLANE_DIR} || return $?

# build only benchmarks and it's dependents - skip aggregating licenses as it will be missing licenses due to only
# building some projects
./mvnw clean package -DskipTests -Dlicense.skipAggregateDownloadLicenses -Dlicense.skipAggregateAddThirdParty -P no-release -pl benchmarks -am

popd || return $?

mkdir -p "${SCRIPT_DIR}/output"

if [[ -z $1 ]]; then
while IFS="" read -r p || [ -n "$p" ]; do
run_java_filter_benchmarks_for_class "$p"
done <"${SCRIPT_DIR}/resources/filter-class-list.txt"
else
run_java_filter_benchmarks_for_class $1
fi
6 changes: 6 additions & 0 deletions hack/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function usage() {
echo " generate Run code generators"
echo " build-from-source Build artifacts from source"
echo " build-for-source-from-source Build artifacts from source for source bundle only"
echo " benchmark-filter <bencmark_class_name> Run the filter benchmarks for <benchmark_class_name>"
echo " benchmark-filters Run all the filter benchmarks"
echo ""
}

Expand Down Expand Up @@ -87,6 +89,10 @@ elif [[ "${action}" == "profiler" ]]; then
elif [[ "${action}" == "generate" ]]; then
"${ROOT_DIR}"/hack/generate-proto.sh
"${ROOT_DIR}"/hack/update-codegen.sh
elif [[ "${action}" == "benchmark-filter" ]]; then
"${ROOT_DIR}/data-plane/benchmarks/run.sh" "$2"
elif [[ "${action}" == "benchmark-filters" ]]; then
"${ROOT_DIR}/data-plane/benchmarks/run.sh"
else
echo "Unrecognized action ${action}"
usage "$0"
Expand Down
Loading