安装:
wget https://github.com/akopytov/sysbench/archive/master.zip
unzip master.zip
yum -y install make automake libtool pkgconfig libaio-devel vim-common mysql-devel
./autogen.sh
./configure
make -j
make install
使用:
prepare:准备数据
run:运行测试
测cpu
sysbench --threads=3 cpu run
测memory
sysbench --threads=1 --memory-block-size=8k --memory-total-size=128G --memory-oper=read memory run
--memory-oper=read(默认是write)
测disk
sysbench fileio --threads=48 --file-total-size=100G --file-num=64 --file-fsync-all=on --file-test-mode=rndrw prepare
sysbench fileio --threads=1 --file-total-size=100G --file-num=64 --file-fsync-all=on --file-test-mode=rndrw run
测mysql:prepare的时候会对表进行写数据,要提前造库
sysbench oltp_read_write.lua --mysql-user=root --mysql-password=xxxx --mysql-host=xxxx --mysql-port=3306 --mysql-db=sbtest --tables=20 --table_size=1000000 --threads=1 --time=30 --report-interval=3 prepare
sysbench oltp_read_write.lua --mysql-user=root --mysql-password=xxxx --mysql-host=xxxx --mysql-port=3306 --mysql-db=sbtest --tables=20 --table_size=1000000 --threads=1 --time=30 --report-interval=3 run