You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.5 KiB
65 lines
1.5 KiB
#!/bin/bash
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
function usage {
|
|
local ME=$(basename $0)
|
|
|
|
cat<<EOU
|
|
USAGE: $ME config_file_name
|
|
|
|
This script will build all the binaries and start benchmark and txgen based on the configuration file.
|
|
|
|
EXAMPLES:
|
|
|
|
$ME local_config.txt
|
|
|
|
|
|
EOU
|
|
exit 0
|
|
}
|
|
|
|
config=$1
|
|
if [ -z "$config" ]; then
|
|
usage
|
|
fi
|
|
|
|
db_supported=$2
|
|
|
|
# Kill nodes if any
|
|
./kill_node.sh
|
|
|
|
# Since `go run` will generate a temporary exe every time,
|
|
# On windows, your system will pop up a network security dialog for each instance
|
|
# and you won't be able to turn it off. With `go build` generating one
|
|
# exe, the dialog will only pop up once at the very first time.
|
|
# Also it's recommended to use `go build` for testing the whole exe.
|
|
go build -o bin/benchmark
|
|
go build -o bin/txgen client/txgen/main.go
|
|
go build -o bin/profiler profiler/main.go
|
|
|
|
# Create a tmp folder for logs
|
|
t=`date +"%Y%m%d-%H%M%S"`
|
|
log_folder="tmp_log/log-$t"
|
|
|
|
mkdir -p $log_folder
|
|
|
|
# Start nodes
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
IFS=' ' read ip port mode shardId <<< $line
|
|
#echo $ip $port $mode
|
|
if [ "$mode" != "client" ]; then
|
|
if [ -z "$db_supported" ]; then
|
|
./bin/benchmark -ip $ip -port $port -config_file $config -log_folder $log_folder&
|
|
else
|
|
./bin/benchmark -ip $ip -port $port -config_file $config -log_folder $log_folder -db_supported&
|
|
fi
|
|
fi
|
|
done < $config
|
|
|
|
txgen_enabled=$3
|
|
# Generate transactions
|
|
if [ -z "$txgen_enabled" ]; then
|
|
./bin/txgen -config_file $config -log_folder $log_folder
|
|
fi
|
|
|