Sysbench多線程性能測試工具
2024-07-09 22:47:53
供稿:網友
最近用sysbench進行了較多的性能測試,也總結一下它的特點和用法和需要注意的事項。sysbench是一個多線程性能測試工具,可以進行CPU/內存/IO/數據庫等性能測試。不過我絕大多數的時候都是用它來對數據庫(MySQL)進行oltp測試。它能測哪些東西,怎么測讓我從它的命令幫助來回答。
~/zbs$ sysbench --help
Missing required command argument.
Usage:
sysbench [general-options]... --test=<test-name> [test-options]... command
上面就大概的用法,--test=指定我們需要測什么類型,那么--test有哪幾種類型呢?fileio/cpu/memory/threads/mutex,不好意思前面這幾個我都沒測過,我主要是用它來測數據庫的性能,但為什么沒有數據庫這個選項呢,這是我是用了最新的版本0.5,它與0.4的版本最大區別在于支持多表測試,執行實時打印統計信息,支持自定義lua腳本來設置測試行為。
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大概會看到如下,請注意oltp這個選項就是測數據庫用的。
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
看完了測試模式之后,那么它有一些什么主要的其他控制參數呢?首先說這個每個測試模式自己特有的參數怎么擦看 sysbench --test=<test-mode> help,比如我這里(請注意,由于sysbench0.5的--test選項對數據庫的測試不再使用oltp這個選項而是通過指定lua腳本,因此利用前面這個命令查看不到下面的結果,所以如果要查看還是通過0.4的吧,如果誰找到了方式在0.5版本里查看oltp的參數也請告訴一下。另外雖然0.5與0.4版本不同但是參數還是基本上保持兼容的):
~$ 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]