Skip to content

Commit

Permalink
cleanup, harden analysis, bump ruby, disable dart
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs committed May 18, 2021
1 parent 57a895b commit afd1dfa
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 47 deletions.
1 change: 1 addition & 0 deletions analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ docker run --name analyzer --rm \

cat > ${RESULTS_DIR}/bench.params << EOF
Benchmark Execution Parameters:
$(git log -1 --pretty="%h %cD %cn %s")
- GRPC_BENCHMARK_DURATION=${GRPC_BENCHMARK_DURATION}
- GRPC_BENCHMARK_WARMUP=${GRPC_BENCHMARK_WARMUP}
- GRPC_SERVER_CPUS=${GRPC_SERVER_CPUS}
Expand Down
29 changes: 17 additions & 12 deletions analyze/results_analyze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@

results = Hash.new { |hash, key| hash[key] = {} }
Dir.glob("#{report_directory}/*.report").each do |file|
name = File.basename(file).split(/_bench.report/).first
results[name][:total_time] = File.read(file).scan(/Total:\s*((?:\d|\.)+)/)[0][0].to_f
results[name][:ok_responses] = begin
File.read(file).scan(/\[OK\]\s*(\d+)/)[0][0].to_f
rescue StandardError
0
end
results[name][:avg_resp_time] = File.read(file).scan(/\s*Average:\s*(.*\w)/)[0][0]
results[name][:_90pct] = File.read(file).scan(/\s*90 % in \s*(.*\w)/)[0][0]
results[name][:_95pct] = File.read(file).scan(/\s*95 % in \s*(.*\w)/)[0][0]
results[name][:_99pct] = File.read(file).scan(/\s*99 % in \s*(.*\w)/)[0][0]
results[name][:req_per_s] = results[name][:ok_responses] / results[name][:total_time]
begin
name = File.basename(file).split(/_bench.report/).first
results[name][:total_time] = File.read(file).scan(/Total:\s*((?:\d|\.)+)/)[0][0].to_f
results[name][:ok_responses] = begin
File.read(file).scan(/\[OK\]\s*(\d+)/)[0][0].to_f
rescue StandardError
0
end
results[name][:avg_resp_time] = File.read(file).scan(/\s*Average:\s*(.*\w)/)[0][0]
results[name][:_90pct] = File.read(file).scan(/\s*90 % in \s*(.*\w)/)[0][0]
results[name][:_95pct] = File.read(file).scan(/\s*95 % in \s*(.*\w)/)[0][0]
results[name][:_99pct] = File.read(file).scan(/\s*99 % in \s*(.*\w)/)[0][0]
results[name][:req_per_s] = results[name][:ok_responses] / results[name][:total_time]
rescue StandardError
puts "Failed miserably analysing #{name}."
raise
end
end

Dir.glob("#{report_directory}/*.stats").each do |file|
Expand Down
59 changes: 25 additions & 34 deletions bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ BENCHMARKS_TO_RUN="${@}"
BENCHMARKS_TO_RUN="${BENCHMARKS_TO_RUN:-$(find . -maxdepth 1 -name '*_bench' -type d | sort)}"

RESULTS_DIR="results/$(date '+%y%d%mT%H%M%S')"
GRPC_BENCHMARK_DURATION=${GRPC_BENCHMARK_DURATION:-"20s"}
GRPC_BENCHMARK_WARMUP=${GRPC_BENCHMARK_WARMUP:-"5s"}
GRPC_SERVER_CPUS=${GRPC_SERVER_CPUS:-"1"}
GRPC_SERVER_RAM=${GRPC_SERVER_RAM:-"512m"}
GRPC_CLIENT_CONNECTIONS=${GRPC_CLIENT_CONNECTIONS:-"50"}
GRPC_CLIENT_CONCURRENCY=${GRPC_CLIENT_CONCURRENCY:-"1000"}
GRPC_CLIENT_QPS=${GRPC_CLIENT_QPS:-"0"}
GRPC_CLIENT_QPS=$(( GRPC_CLIENT_QPS / GRPC_CLIENT_CONCURRENCY ))
GRPC_CLIENT_CPUS=${GRPC_CLIENT_CPUS:-"1"}
GRPC_REQUEST_PAYLOAD=${GRPC_REQUEST_PAYLOAD:-"100B"}
export GRPC_BENCHMARK_DURATION=${GRPC_BENCHMARK_DURATION:-"20s"}
export GRPC_BENCHMARK_WARMUP=${GRPC_BENCHMARK_WARMUP:-"5s"}
export GRPC_SERVER_CPUS=${GRPC_SERVER_CPUS:-"1"}
export GRPC_SERVER_RAM=${GRPC_SERVER_RAM:-"512m"}
export GRPC_CLIENT_CONNECTIONS=${GRPC_CLIENT_CONNECTIONS:-"50"}
export GRPC_CLIENT_CONCURRENCY=${GRPC_CLIENT_CONCURRENCY:-"1000"}
export GRPC_CLIENT_QPS=${GRPC_CLIENT_QPS:-"0"}
export GRPC_CLIENT_QPS=$(( GRPC_CLIENT_QPS / GRPC_CLIENT_CONCURRENCY ))
export GRPC_CLIENT_CPUS=${GRPC_CLIENT_CPUS:-"1"}
export GRPC_REQUEST_PAYLOAD=${GRPC_REQUEST_PAYLOAD:-"100B"}

# Let containers know how many CPUs they will be running on
export GRPC_SERVER_CPUS
export GRPC_CLIENT_CPUS
# Additionally export other vars for further analysis script.
# export GRPC_SERVER_CPUS
# export GRPC_CLIENT_CPUS
# export GRPC_BENCHMARK_DURATION
# export GRPC_BENCHMARK_WARMUP
# export GRPC_CLIENT_CONNECTIONS
# export GRPC_CLIENT_CONCURRENCY
# export GRPC_CLIENT_QPS

docker pull infoblox/ghz:0.0.1

Expand Down Expand Up @@ -96,25 +102,10 @@ EOF
docker container stop "${NAME}" >/dev/null
done

tee $RESULTS_DIR/bench.info <<EOF
Benchmark info:
$(git log -1 --pretty="%h %cD %cn %s")
Benchmarks run: $BENCHMARKS_TO_RUN
GRPC_BENCHMARK_DURATION=$GRPC_BENCHMARK_DURATION
GRPC_BENCHMARK_WARMUP=$GRPC_BENCHMARK_WARMUP
GRPC_SERVER_CPUS=$GRPC_SERVER_CPUS
GRPC_SERVER_RAM=$GRPC_SERVER_RAM
GRPC_CLIENT_CONNECTIONS=$GRPC_CLIENT_CONNECTIONS
GRPC_CLIENT_CONCURRENCY=$GRPC_CLIENT_CONCURRENCY
GRPC_CLIENT_QPS=$GRPC_CLIENT_QPS
GRPC_CLIENT_CPUS=$GRPC_CLIENT_CPUS
GRPC_REQUEST_PAYLOAD=$GRPC_REQUEST_PAYLOAD
EOF

sh analyze.sh $RESULTS_DIR

cat << EOF
$(cat ${RESULTS_DIR}/bench.params)
All done.
EOF
if sh analyze.sh $RESULTS_DIR; then
cat ${RESULTS_DIR}/bench.params
echo "All done."
else
echo "Analysis fiascoed."
exit 1
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ruby_grpc_bench/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7-buster
FROM ruby:3

WORKDIR /app
COPY ruby_grpc_bench /app
Expand Down

0 comments on commit afd1dfa

Please sign in to comment.