MySQL sysbench压测的脚本

 

硬件环境:


软件安装:
压测的线程为:8 16 32 64 128 256 512 1024
压测的单表量级:50万 500万 5000万 5亿条 4个等级
压测的类型:

 

#!/bin/bash

THREAD="16 64 128 300 512 1024"
LUAFILE="/usr/share/sysbench/oltp_read_write.lua /usr/share/sysbench/oltp_read_only.lua /usr/share/sysbench/oltp_write_only.lua /usr/share/sysbench/oltp_point_select.lua /usr/share/sysbench/select_random_ranges.lua /usr/share/sysbench/select_random_points.lua"
TIME=600
reportinterval=60
TABLES=10
TABLESIZE=10000000
HOST=
PORT=3312
USER=backup
PASSWORD=
LOGDIR=/data/sysbench/log/10tab_1kw_`date +%Y%m%d%H%M%S`
mkdir -p ${LOGDIR}

 #/usr/bin/sysbench $LUAFILE --mysql-host=$HOST --mysql-port=$PORT --mysql-user=$USER --mysql-password=$PASSWORD --mysql-db=sbtest --table_size=$TABLESIZE --tables=$TABLES --threads=16 --time=$TIME --report-interval=$reportinterval --db-driver=mysql prepare >> $LOGDIR/sysbench_prepare_`date +%Y%m%d%H%M%S`.log
for j in $LUAFILE
do
  lua=`ls ${j} |awk -F '/' '{print $5}' |awk -F '.' '{print $1}'`
  for x in $THREAD
  do
    #/usr/bin/sysbench ${j} --mysql-host=$HOST --mysql-port=$PORT --mysql-user=$USER --mysql-password=$PASSWORD --mysql-db=sbtest --table_size=$TABLESIZE --tables=$TABLES --threads=${x} --time=$TIME --report-interval=$reportinterval --db-driver=mysql prepare >> $LOGDIR/sysbench_${lua}_${x}_`date +%Y%m%d%H%M%S`.log
    /usr/bin/sysbench ${j} --mysql-host=$HOST --mysql-port=$PORT --mysql-user=$USER --mysql-password=$PASSWORD --mysql-db=sbtest --table_size=$TABLESIZE --tables=$TABLES --threads=${x} --time=$TIME --report-interval=$reportinterval --db-driver=mysql run >> $LOGDIR/sysbench_${lua}_${x}_`date +%Y%m%d%H%M%S`.log
    #/usr/bin/sysbench ${j} --mysql-host=$HOST --mysql-port=$PORT --mysql-user=$USER --mysql-password=$PASSWORD --mysql-db=sbtest --table_size=$TABLESIZE --tables=$TABLES --threads=${x} --time=$TIME --report-interval=$reportinterval --db-driver=mysql cleanup >> $LOGDIR/sysbench_${lua}_${x}_`date +%Y%m%d%H%M%S`.log
  done
done

报告图标:

 

你可能感兴趣的:(MySQL)