37 lines
1.4 KiB
Bash
Executable File
37 lines
1.4 KiB
Bash
Executable File
#!/bin/bash -e
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
PROFDIR=${0%/*}
|
|
|
|
cd "$PROFDIR"
|
|
|
|
source profiling-util.sh
|
|
|
|
status 'Starting' "Benchmark ${RUN_NAME}"
|
|
|
|
# Cleanup background processes when script is canceled
|
|
trap '{ teardown; }' EXIT
|
|
|
|
# Summary table header
|
|
echo 'Test, target req/s, req len, branch, p999 latency (ms), GBit/s' > "$OUT_DIR/summary.txt"
|
|
|
|
if [ "$TCP" -eq 1 ]; then
|
|
MODE=TCP DIRECTION=outbound NAME=tcpoutbound_bench PROXY_PORT=$PROXY_PORT_OUTBOUND SERVER_PORT=5001 single_benchmark_run
|
|
MODE=TCP DIRECTION=inbound NAME=tcpinbound_bench PROXY_PORT=$PROXY_PORT_INBOUND SERVER_PORT=5001 single_benchmark_run
|
|
fi
|
|
if [ "$HTTP" -eq 1 ]; then
|
|
MODE=HTTP DIRECTION=outbound NAME=http1outbound_bench PROXY_PORT=$PROXY_PORT_OUTBOUND SERVER_PORT=8080 single_benchmark_run
|
|
MODE=HTTP DIRECTION=inbound NAME=http1inbound_bench PROXY_PORT=$PROXY_PORT_INBOUND SERVER_PORT=8080 single_benchmark_run
|
|
fi
|
|
if [ "$GRPC" -eq 1 ]; then
|
|
MODE=gRPC DIRECTION=outbound NAME=grpcoutbound_bench PROXY_PORT=$PROXY_PORT_OUTBOUND SERVER_PORT=8079 single_benchmark_run
|
|
MODE=gRPC DIRECTION=inbound NAME=grpcinbound_bench PROXY_PORT=$PROXY_PORT_INBOUND SERVER_PORT=8079 single_benchmark_run
|
|
fi
|
|
status 'Completed' "Benchmark results (display with 'head -vn-0 *$ID.txt *$ID.json | less' or compare them with ./plot.py):"
|
|
ls "$OUT_DIR"
|
|
echo SUMMARY:
|
|
cat "$OUT_DIR/summary.txt"
|
|
echo "Run 'fortio report' and open http://localhost:8080/ to display the HTTP/gRPC graphs"
|
|
teardown
|