亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1719 | 回復: 0
打印 上一主題 下一主題

mysql性能測試工具--sysbench的安裝與使用 [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-12-23 01:45 |只看該作者 |倒序瀏覽

sysbench是一個開源的、模塊化的、跨平臺的多線程性能測試工具,可以用來進行CPU、內(nèi)存、磁盤I/O、線程、數(shù)據(jù)庫的性能測試。目前支持的數(shù)據(jù)庫有MySQL、OraclePostgreSQL。以下操作都將以支持MySQL數(shù)據(jù)庫為例進行。

下載源碼包

http://sourceforge.net/projects/sysbench/網(wǎng)站上下載,我下載到的源碼包是sysbench-0.4.12.tar.gz。

環(huán)境準備

我的系統(tǒng)是CentOS 5.5,在進行編譯安裝前需要先進性相關(guān)軟件的安裝和更新。

首先,安裝和更新gcc,否則在編譯安裝時會報錯誤:configure: error: no acceptable C compiler found in $PATH,安裝命令為:yum install gcc

其次,安裝和更新libtool,否則在編譯安裝時會報類似錯誤:

../libtool: line 838: X--tag=CC: command not found

../libtool: line 871: libtool: ignoring unknown tag : command not found

../libtool: line 838: X--mode=link: command not found

../libtool: line 1004: *** Warning: inferring the mode of operation is deprecated.: command not found

../libtool: line 1005: *** Future versions of Libtool will require --mode=MODE be specified.: command not found

../libtool: line 2231: X-g: command not found

../libtool: line 2231: X-O2: command not found

../libtool: line 2231: X-rdynamic: command not found

../libtool: line 1951: X-L/usr/lib/mysql: No such file or directory

../libtool: line 2400: Xsysbench: command not found

 

Fatal server error:

Server is already active for display 0

        If this server is no longer running, remove /tmp/.X0-lock

        and start again.

 

../libtool: line 2412: Xsysbench: command not found

../libtool: line 2547: X-lmysqlclient_r: command not found

../libtool: line 2547: X-lz: command not found

../libtool: line 2547: X-lcrypt: command not found

../libtool: line 2547: X-lnsl: command not found

../libtool: line 2547: X-lm: command not found

../libtool: line 2547: X-lmygcc: command not found

../libtool: line 2547: X-lrt: command not found

../libtool: line 2547: X-lm: command not found

../libtool: line 2629: X-L/root/tool/sysbench-0.4.12/sysbench: No such file or directory

../libtool: line 2547: X-lmysqlclient_r: command not found

../libtool: line 2547: X-lz: command not found

../libtool: line 2547: X-lcrypt: command not found

../libtool: line 2547: X-lnsl: command not found

../libtool: line 2547: X-lmygcc: command not found

../libtool: line 2547: X-lrt: command not found

../libtool: line 2547: X-lm: command not found

../libtool: line 2629: X-L/root/tool/sysbench-0.4.12/sysbench: No such file or directory

../libtool: line 2547: X-lmysqlclient_r: command not found

../libtool: line 2547: X-lz: command not found

../libtool: line 2547: X-lcrypt: command not found

../libtool: line 2547: X-lnsl: command not found

../libtool: line 2547: X-lmygcc: command not found

../libtool: line 2547: X-lrt: command not found

../libtool: line 2547: X-lm: command not found

../libtool: line 5162: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o ""  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/root/tool/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lmygcc -lrt -lm: No such file or directory

../libtool: line 5163: Xgcc -pthread "" "" -o @OUTPUT@ sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o ""  tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/root/tool/sysbench-0.4.12/sysbench -lmysqlclient_r -lz -lcrypt -lnsl -lmygcc -lrt -lm: No such file or directory

安裝命令為:yum install libtool

編譯安裝

準備好環(huán)境之后就可以開始進行編譯安裝了。

首先對壓縮包進行解壓:tar zxf sysbench-0.4.12.tar.gz。

其次,在解壓好的目錄下運行命令:./autogen.sh,對環(huán)境進行清理。該操作是sysbench0.4.12獨有的,不進行的話也會出現(xiàn)類似如上第2個錯誤。

然后,進行編譯安裝。如果MySQL是默認安裝的,則直接運行如下命令進行編譯安裝:

./configure --build=i686-pc-linux-gnu && make && make install

其中,--build指定操作系統(tǒng)的類型,否則可能會出現(xiàn)如下錯誤:

checking build system type... Invalid configuration `i686-pc-linux-': machine `i686-pc-linux' not recognized

configure: error: /bin/sh config/config.sub i686-pc-linux- failed

如果MySQL不是安裝在標準默認目錄下,那么就還需要指定MySQL的路徑。如MySQL安裝在/var/mysql下,則運行如下命令進行編譯安裝:

./configure --build=i686-pc-linux-gnu –with-mysql-includes=/var/mysql/include –with-mysql-libs=/var/mysql/lib && make && make install

如果需要sysbench支持Oracle或者PostgreSQL的話,還需要在編譯時加上--with-pgsql或者--with-oracle

進行測試

編譯安裝成功后就可以開始進行性能測試了。測試的方法和選項很多,這里大致介紹一下相關(guān)的命令和選項。

CPU性能測試

sysbench --test=cpu --cpu-max-prime=5000 run

CPU的性能測試主要通過素數(shù)的運算來進行,--cpu-max-prime用來選項指定最大的素數(shù),具體參數(shù)可以根據(jù)CPU的性能來設置。

內(nèi)存性能測試

sysbench --test=memory --memory-block-size=8k --memory-total-size=4G run

--memory-block-size指定每個block的大小,--memory-total-size指定總的傳輸量,另外還有其他選項,可通過命令sysbench –test=memory help進行查看。

磁盤I/O性能測試

         首先生成需要測試的文件

sysbench --test=fileio --num-threads=16 --file-num=2 --file-total-size=2G --file-test-mode=rndrw --file-rw-ratio=2 prepare

然后執(zhí)行測試

sysbench --test=fileio --num-threads=16 --file-num=2 --file-total-size=2G --file-test-mode=rndrw --file-rw-ratio=2 run

最后清理測試文件

sysbench --test=fileio --num-threads=16 --file-num=2 --file-total-size=2G --file-test-mode=rndrw --file-rw-ratio=2 cleanup

--num-threads指定最大創(chuàng)建的線程數(shù),--file-num指定文件數(shù)目,--file-taotal-size指定創(chuàng)建的文件總大小,--file-test-mode指定文件讀寫模式,rndrw為隨機讀,--file-rw-ratio指定讀寫比率。另外還有更多的選項可以通過命令sysbench –test=fileio help進行查看。

線程測試

sysbench --test=threads --num-threads=32 --thread-yields=100 --thread-locks=2 run

--num-threads指定線程數(shù),--thread-yield指定每個請求的壓力,--thread-locks指定每個線程的鎖數(shù)量。

數(shù)據(jù)庫性能測試

首先,準備測試數(shù)據(jù)

sysbench --test=oltp --mysql-host=server1 --mysql-user=root --mysql-password=MySQLPASSWORD --mysql-db=test --oltp-table-name=sbtest --mysql-table-engine=MyISAM --oltp-table-size=1000000 prepare

然后執(zhí)行測試

sysbench --test=oltp --mysql-host=server1 --mysql-port=3306 --mysql-user=root --mysql-password=MySQLPASSWORD --mysql-db=test --oltp-table-name=sbtest --mysql-table-engine=MyISAM --mysql-engine-trx=no --oltp-skip-trx=on --oltp-table-size=1000000 --max-requests=1000 --num-threads=100 run

最后清理測試數(shù)據(jù)

sysbench --test=oltp --mysql-host=server1 --mysql-user=root --mysql-password=MySQLPASSWORD --mysql-db=test --oltp-table-name=sbtest cleanup

--mysql-host指定使用的MySQL服務器的地址,--mysql-user指定連接MySQL的用戶名,--mysql-password指定密碼,--mysql-db指定使用的數(shù)據(jù)庫,--oltp-table-name指定使用的表,--mysql-table-engine指定表所使用的數(shù)據(jù)庫引擎,--mysql-engine-trx說明使用的數(shù)據(jù)庫引擎是否是事務的,--oltp-skip-trx指定是否忽略事務語句(BEGIN/COMMIT),--oltp-table-size指定數(shù)據(jù)表中的記錄數(shù),--max-requests指定最大請求數(shù),--num-threads指定線程數(shù),其他更多的選項可以使用命令sysbench –test=oltp help查看。

 

您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP