下载地址:
http://pan.baidu.com/s/16KhJ4
解包
tar -zxvf sysbench-0.4.12.tar.gz
进入源码文件夹
cd sysbench-0.4.12
执行autogen脚本
./autogen.sh 如果autogen.sh报错: 运行以下两行命令 echo "export LC_ALL=C" >> /root/.bashrc source /root/.bashrc ./configure --prefix=/usr/sysbench/ --with-mysql-includes=/server/mysql/include/ --with-mysql-libs=/server/mysql/lib --with-mysql cp /usr/bin/libtool /root/sysbench-0.4.12/libtool make && make install
看一下,如果生成了文件 /usr/sysbench/bin/sysbench
就ok了,尽情享用它...
测试:
1)测试CPU:
sysbench --test=cpu --cpu-max-prime=2000 run
2)测试线程:
sysbench--test=threads --num-threads=20 --thread-yields=10 --thread-locks=4 run
3)测试IO:--num-threads 开启的线程 --file-total-size 总的文件大小
1,prepare阶段,生成需要的测试文件,完成后会在当前目录下生成很多小文件。
sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare
2,run阶段
sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run
3,清理测试时生成的文件
sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup
4)测试内存:
sysbench --test=memory --memory-block-size=8k --memory-total-size=1G run
5)测试mutex:
sysbench –test=mutex –num-threads=100 –mutex-num=1000 –mutex-locks=100000 –mutex-loops=10000 run
6)测试OLTP:
1,prepare阶段,生成需要的测试表
sysbench --test=oltp --mysql-table-engine=innodb --mysql-host=127.0.0.1 --mysql-db=test --oltp-table-size=500000 --mysql-user=usert --mysql-password=passt prepare
2,run阶段
sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=127.0.0.1 --mysql-db=test --oltp-table-size=500000 --mysql-user=usert --mysql-password=passt run
3,清理测试时生成的测试表
sysbench --num-threads=16 --test=oltp --mysql-table-engine=innodb --mysql-host=127.0.0.1 --mysql-db=test --oltp-table-size=500000 --mysql-user=usert --mysql-password=passt cleanup
以上为几种比较典型的测试...