From 90f6eb1ecfb25919dc152bf402a289a2173f237f Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Wed, 9 May 2018 12:23:44 +0300 Subject: [PATCH] Scripts for benchmarking providers, dbms sim fast exit option. --- scripts/benchmark-provider.sh | 28 ++++++++++++++++++++++++++++ scripts/benchmark-report.sh | 25 +++++++++++++++++++++++++ src/dbms_simulator.cpp | 12 +++++++++--- 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100755 scripts/benchmark-provider.sh create mode 100755 scripts/benchmark-report.sh diff --git a/scripts/benchmark-provider.sh b/scripts/benchmark-provider.sh new file mode 100755 index 0000000..3b96e95 --- /dev/null +++ b/scripts/benchmark-provider.sh @@ -0,0 +1,28 @@ +#!/bin/bash -eu + +set -x +PROVIDER=${PROVIDER:?"Provider library is required"} + +total_transactions=$((1 << 17)) + +function run_benchmark() +{ + servers=$1 + clients=$2 + transactions=$(($total_transactions/($servers*$clients))) + result_file=dbms-bench-$(basename $PROVIDER)-$servers-$clients + echo "Running benchmark for servers: $servers clients $clients" + rm -r *_data/ || : + command time -v ./src/dbms_simulator --servers=$servers --clients=$clients --transactions=$transactions --wsrep-provider="$PROVIDER" --fast-exit=1 >& $result_file +} + + +# for servers in 1 2 4 8 16 +for servers in 16 +do +# for clients in 1 2 4 8 16 32 + for clients in 4 8 16 32 + do + run_benchmark $servers $clients + done +done diff --git a/scripts/benchmark-report.sh b/scripts/benchmark-report.sh new file mode 100755 index 0000000..00b0cf0 --- /dev/null +++ b/scripts/benchmark-report.sh @@ -0,0 +1,25 @@ +#!/bin/bash -eu + +PROVIDER=${PROVIDER:?"Provider library is required"} + +function report() +{ + servers=$1 + clients=$2 + result_file=dbms-bench-$(basename $PROVIDER)-$servers-$clients + trx_per_sec=$(grep -a "Transactions per second" "$result_file" | cut -d ':' -f 2) + cpu=$(grep -a "Percent of CPU this job got" "$result_file" | cut -d ':' -f 2) + vol_ctx_switches=$(grep -a "Voluntary context switches" "$result_file" | cut -d ':' -f 2) + invol_ctx_switches=$(grep -a "Involuntary context switches" "$result_file" | cut -d ':' -f 2) + echo "$clients $cpu $trx_per_sec $vol_ctx_switches $invol_ctx_switches" +} + +for servers in 1 2 4 8 16 +do + echo "Servers: $servers" + for clients in 1 2 4 8 16 32 + do + report $servers $clients + done +done + diff --git a/src/dbms_simulator.cpp b/src/dbms_simulator.cpp index 5a10dc7..edb28ed 100644 --- a/src/dbms_simulator.cpp +++ b/src/dbms_simulator.cpp @@ -41,6 +41,7 @@ struct dbms_simulator_params std::string wsrep_provider; std::string wsrep_provider_options; int debug_log_level; + int fast_exit; dbms_simulator_params() : n_servers(0) , n_clients(0) @@ -48,6 +49,7 @@ struct dbms_simulator_params , wsrep_provider() , wsrep_provider_options() , debug_log_level(0) + , fast_exit(0) { } }; @@ -599,8 +601,10 @@ void dbms_simulator::stop() trrep::log() << "######## Stats ############"; trrep::log() << stats(); trrep::log() << "######## Stats ############"; - // REMOVEME: Temporary shortcut - // exit(0); + if (params_.fast_exit) + { + exit(0); + } for (auto& i : servers_) { dbms_server& server(*i.second); @@ -711,7 +715,9 @@ int main(int argc, char** argv) ("transactions", po::value(¶ms.n_transactions), "number of transactions run by a client") ("debug-log-level", po::value(¶ms.debug_log_level), - "debug logging level: 0 - none, 1 - verbose"); + "debug logging level: 0 - none, 1 - verbose") + ("fast-exit", po::value(¶ms.fast_exit), + "exit from simulation without graceful shutdown"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm);