sysbench测试脚本

#!/bin/bash

#mysql info
host=10.211.55.97
port=3306
user=****
passwd=***
db=d2

#sysbench variables
run_mode=run
tables_count=10
table_size=5000000
thread_num=10
tables_count=10
sysbench_mode=./oltp_legacy/oltp.lua
max_time=10
report_interval=1


#
test_mode="disk"
type="disk-m-noop"
res_dir=./res/
mkdir -p $res_dir
res_file="$res_dir/$test_mode-$type.plot.data"
:>$res_file


for threads in {1,2,4,8,16,32}
do
sysbench  $sysbench_mode --oltp-table-size=$table_size --oltp-tables-count=$tables_count --mysql-db=$db --mysql-host=$host --mysql-user=$user --mysql-password=$passwd --mysql-port=$port --threads=$threads --time=$max_time  --mysql-table-engine=INNODB --db-driver=mysql --report-interval=$report_interval  $run_mode |tee -a $res_dir/sysbench-$mode-$threads 2>&1
file_name="$res_dir/sysbench-$mode-$threads"
tps=`cat $file_name |grep 'transactions:'|grep -o '(.*)'|cut -d '(' -f2|cut -d ' ' -f1|awk -F "." '{print $1}'`
rm $file_name

echo "$threads   $tps" >> $res_file
done

你可能感兴趣的:(工作效率)