Sysbench多線程性能測(cè)試工具
2024-07-09 22:47:53
供稿:網(wǎng)友
最近用sysbench進(jìn)行了較多的性能測(cè)試,也總結(jié)一下它的特點(diǎn)和用法和需要注意的事項(xiàng)。sysbench是一個(gè)多線程性能測(cè)試工具,可以進(jìn)行CPU/內(nèi)存/IO/數(shù)據(jù)庫(kù)等性能測(cè)試。不過(guò)我絕大多數(shù)的時(shí)候都是用它來(lái)對(duì)數(shù)據(jù)庫(kù)(MySQL)進(jìn)行oltp測(cè)試。它能測(cè)哪些東西,怎么測(cè)讓我從它的命令幫助來(lái)回答。
~/zbs$ sysbench --help
Missing required command argument.
Usage:
sysbench [general-options]... --test=<test-name> [test-options]... command
上面就大概的用法,--test=指定我們需要測(cè)什么類型,那么--test有哪幾種類型呢?fileio/cpu/memory/threads/mutex,不好意思前面這幾個(gè)我都沒(méi)測(cè)過(guò),我主要是用它來(lái)測(cè)數(shù)據(jù)庫(kù)的性能,但為什么沒(méi)有數(shù)據(jù)庫(kù)這個(gè)選項(xiàng)呢,這是我是用了最新的版本0.5,它與0.4的版本最大區(qū)別在于支持多表測(cè)試,執(zhí)行實(shí)時(shí)打印統(tǒng)計(jì)信息,支持自定義lua腳本來(lái)設(shè)置測(cè)試行為。
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
如果你用sysbench0.4大概會(huì)看到如下,請(qǐng)注意oltp這個(gè)選項(xiàng)就是測(cè)數(shù)據(jù)庫(kù)用的。
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
看完了測(cè)試模式之后,那么它有一些什么主要的其他控制參數(shù)呢?首先說(shuō)這個(gè)每個(gè)測(cè)試模式自己特有的參數(shù)怎么擦看 sysbench --test=<test-mode> help,比如我這里(請(qǐng)注意,由于sysbench0.5的--test選項(xiàng)對(duì)數(shù)據(jù)庫(kù)的測(cè)試不再使用oltp這個(gè)選項(xiàng)而是通過(guò)指定lua腳本,因此利用前面這個(gè)命令查看不到下面的結(jié)果,所以如果要查看還是通過(guò)0.4的吧,如果誰(shuí)找到了方式在0.5版本里查看oltp的參數(shù)也請(qǐng)告訴一下。另外雖然0.5與0.4版本不同但是參數(shù)還是基本上保持兼容的):
~$ sysbench --test=oltp help
sysbench 0.4.12: multi-threaded system evaluation benchmark
oltp options:
--oltp-test-mode=STRING test type to use {simple,complex,nontrx,sp} [complex]
--oltp-reconnect-mode=STRING reconnect mode {session,transaction,query,random} [session]
--oltp-sp-name=STRING name of store procedure to call in SP test mode []
--oltp-read-only=[on|off] generate only 'read' queries (do not modify database) [off]
--oltp-skip-trx=[on|off] skip BEGIN/COMMIT statements [off]
--oltp-range-size=N range size for range queries [100]
--oltp-point-selects=N number of point selects [10]
--oltp-simple-ranges=N number of simple ranges [1]
--oltp-sum-ranges=N number of sum ranges [1]
--oltp-order-ranges=N number of ordered ranges [1]
--oltp-distinct-ranges=N number of distinct ranges [1]
--oltp-index-updates=N number of index update [1]
--oltp-non-index-updates=N number of non-index updates [1]