sysbench的安裝與使用 分享
2024-07-24 13:05:01
供稿:網(wǎng)友
安裝過程(rhel5.8+mysql5.5)
安裝過程中不斷報(bào)錯(cuò),參考了眾多網(wǎng)上資料,一上午時(shí)間才搞定
1, 環(huán)境準(zhǔn)備,安裝相關(guān)軟件包,掛載光驅(qū),配置yum
mount -o loop /data/rhel-server-5.9-x86_64-dvd.iso /mnt/cdrom
配置yum
vi /etc/yum.repos.d/rhel58.repo
[Server]
name=rhel58server
baseurl=file:///mnt/cdrom/Server/
enable=1
gpcheck=1
gpgkey=file:///mnt/cdrom/Server/RPM-GPG-KEY-redhat-release
2, 安裝相關(guān)軟件包,要不可能會(huì)報(bào)錯(cuò)(注意要安裝mysql-devel)
yum install automake
yum install libtool
yum install zlib
yum install gcc
yum install gcc glibc-devel glibc-headers glibc-kernheaders
3, 正式安裝
A,解壓縮
tar zxvf sysbench-0.4.8.tar.gz
b,修改配置文件
vi configure.ac
# Checks for programs.
AC_PROG_CC
#AC_PROG_LIBTOOL
AC_PROG_RANLIB
AX_CHECK_DOCBOOK
C,分別執(zhí)行如下命令,
./autogen.sh
./configure --with-mysql-includes=/usr/include/mysql /
--with-mysql-libs=/usr/lib64/mysql /
LDFLAGS='-ldl'
make
makeinstall
安裝中的相關(guān)問題
1,copy config.guess and config.sub from /usr/share/libtool to current directory, then ./configure
2,報(bào)錯(cuò):報(bào)錯(cuò)client_plugin.c:178: undefined reference to `dlclose' sysbench的問題
./config 命令添加LDFLAGS='-ldl'參數(shù)
具體測試方法
1、cpu性能測試
sysbench --test=cpu --cpu-max-prime=20000 run
cpu測試主要是進(jìn)行素?cái)?shù)的加法運(yùn)算,在上面的例子中,指定了最大的素?cái)?shù)為 20000,自己可以根據(jù)機(jī)器cpu的性能來適當(dāng)調(diào)整數(shù)值。
2、線程測試
sysbench --test=threads --num-threads=64 --thread-yields=100 --thread-locks=2 run
3、磁盤IO性能測試
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw prepare
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw run
sysbench --test=fileio --num-threads=16 --file-total-size=3G --file-test-mode=rndrw cleanup
上述參數(shù)指定了最大創(chuàng)建16個(gè)線程,創(chuàng)建的文件總大小為3G,文件讀寫模式為隨機(jī)讀。
4、內(nèi)存測試
sysbench --test=memory --memory-block-size=8k --memory-total-size=4G run
上述參數(shù)指定了本次測試整個(gè)過程是在內(nèi)存中傳輸 4G 的數(shù)據(jù)量,每個(gè) block 大小為 8K。
5、OLTP測試
sysbench --test=oltp --mysql-table-engine=innodb --mysql-user=root --db-driver=mysql --mysql-db=sbtest --oltp-table-size=30000000 --oltp-table-name=t2 --oltp-nontrx-mode=insert --mysql-socket=/var/lib/mysql/mysql.sock prepare
sysbench --test=oltp --mysql-table-engine=innodb --mysql-user=root --db-driver=mysql --mysql-db=sbtest --oltp-table-size=30000000 --oltp-table-name=t1 --mysql-socket=/var/lib/mysql/mysql.sock run