歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> RHEL6 Sysbench性能測試

RHEL6 Sysbench性能測試

日期:2017/2/28 15:50:45   编辑:Linux教程
sysbench是一款開源的多線程性能測試工具,可以執行CPU/內存/線程/IO/數據庫等方面的性能測試。數據庫目前支持MySQL/Oracle/PostgreSQL。本文只是簡單演示一下幾種測試的用法,具體的一些參數設置,需要根據不同的測試要求來進行調整。

測試環境

Ø DELL r310 PC Server MEM:16G RAID0:500G Ø RHEL6.1 X86_64 Ø sysbench-0.4.12

編譯安裝

# wget http://sourceforge.net/projects/sysbench/files/latest/download # tar zxvf sysbench-0.4.12.tar.gz # cd sysbench-0.4.12 # ./configure \ --with-mysql-includes=/usr/local/mysql/include/ \ --with-mysql-libs=/usr/local/mysql/lib/ # make && make install 如果需要測試Oracle/PostgreSQL,則在configure時需要加上--with-oracle或者--with-pgsql參數

參數

# sysbench 測試用例: sysbench [general-options]… –test=<test-name> [test-options]… command 通用選項: --num-threads=N 創建測試線程的數目。默認為1. --max-requests=N 請求的最大數目。默認為10000,0代表不限制。 --max-time=N 最大執行時間,單位是s。默認是0,不限制。 --forced-shutdown=STRING 超過max-time強制中斷。默認是off。 --thread-stack-size=SIZE 每個線程的堆棧大小。默認是32K。 --init-rng=[on|off] 在測試開始時是否初始化隨機數發生器。默認是off。 --test=STRING 指定測試項目名稱。 --debug=[on|off] 是否顯示更多的調試信息。默認是off。 --validate=[on|off] 在可能情況下執行驗證檢查。默認是off。 測試項目: 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 (聯機事務處理系統) 指令: prepare(測試前准備工作) run(正式測試) cleanup(測試後刪掉測試數據) help version See ‘sysbench –test=<name> help’ for a list of options for each test. 查看每個測試項目的更多選項列表。 # ./sysbench –test=fileio help --file-num=N 創建測試文件的數量。默認是128 --file-block-size=N 測試時文件塊的大小。默認是16384(16K) --file-total-size=SIZE 測試文件的總大小。默認是2G --file-test-mode=STRING 文件測試模式{seqwr(順序寫), seqrewr(順序讀寫), seqrd(順序讀), rndrd(隨機讀), rndwr(隨機寫), rndrw(隨機讀寫)} --file-io-mode=STRING 文件操作模式{sync(同步),async(異步),fastmmap(快速map映射),slowmmap(慢map映射)}。默認是sync --file-extra-flags=STRING 使用額外的標志來打開文件{sync,dsync,direct} 。默認為空 --file-fsync-freq=N 執行fsync()的頻率。(0–不使用fsync())。默認是100 --file-fsync-all=[on|off] 每執行完一次寫操作就執行一次fsync。默認是off --file-fsync-end=[on|off] 在測試結束時才執行fsync。默認是on --file-fsync-mode=STRING 使用哪種方法進行同步{fsync, fdatasync}。默認是fsync --file-merged-requests=N 如果可以,合並最多的IO請求數(0–表示不合並)。默認是0 --file-rw-ratio=N 測試時的讀寫比例。默認是1.5 # sysbench --test=cpu help --cpu-max-prime=N 最大質數發生器數量。默認是10000 # sysbench --test=memory help --memory-block-size=SIZE 測試時內存塊大小。默認是1K --memory-total-size=SIZE 傳輸數據的總大小。默認是100G --memory-scope=STRING 內存訪問范圍{global,local}。默認是global --memory-hugetlb=[on|off] 從HugeTLB池內存分配。默認是off --memory-oper=STRING 內存操作類型。{read, write, none} 默認是write --memory-access-mode=STRING存儲器存取方式{seq,rnd} 默認是seq # sysbench --test=threads help --thread-yields=N 每個請求產生多少個線程。默認是1000 --thread-locks=N 每個線程的鎖的數量。默認是8 # sysbench --test=mutex help --mutex-num=N 數組互斥的總大小。默認是4096 --mutex-locks=N 每個線程互斥鎖的數量。默認是50000 --mutex-loops=N 內部互斥鎖的空循環數量。默認是10000 # sysbench --test=oltp help oltp options: --oltp-test-mode=STRING 執行模式{simple,complex(advanced transactional),nontrx(non-transactional),sp}。默認是complex --oltp-reconnect-mode=STRING 重新連接模式{session(不使用重新連接。每個線程斷開只在測試結束),transaction(在每次事務結束後重新連接),query(在每個 SQL語句執行完重新連接),random(對於每個事務隨機選擇以上重新連接模式)}。默認是session --oltp-sp-name=STRING 存儲過程的名稱。默認為空 --oltp-read-only=[on|off] 只讀模式。Update,delete,insert語句不可執行。默認是off --oltp-skip-trx=[on|off] 省略begin/commit語句。默認是off --oltp-range-size=N 查詢范圍。默認是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] --oltp-nontrx-mode=STRING 查詢類型對於非事務執行模式{select, update_key, update_nokey, insert, delete} [select] --oltp-auto-inc=[on|off] AUTO_INCREMENT是否開啟。默認是on --oltp-connect-delay=N 在多少微秒後連接數據庫。默認是10000 --oltp-user-delay-min=N 每個請求最短等待時間。單位是ms。默認是0 --oltp-user-delay-max=N 每個請求最長等待時間。單位是ms。默認是0 --oltp-table-name=STRING 測試時使用到的表名。默認是sbtest --oltp-table-size=N 測試表的記錄數。默認是10000 --oltp-dist-type=STRING 分布的隨機數{uniform(均勻分布),Gaussian(高斯分布),special(空間分布)}。默認是special --oltp-dist-iter=N 產生數的迭代次數。默認是12 --oltp-dist-pct=N 值的百分比被視為’special’ (for special distribution)。默認是1 --oltp-dist-res=N ‘special’的百分比值。默認是75 General database options: --db-driver=STRING 指定數據庫驅動程序(‘help’ to get list of available drivers) --db-ps-mode=STRING編制報表使用模式{auto, disable} [auto] Compiled-in database drivers: --mysql – MySQL driver mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] --mysql-port=N MySQL server port [3306] --mysql-socket=STRING MySQL socket --mysql-user=STRING MySQL user [sbtest] --mysql-password=STRING MySQL password [] --mysql-db=STRING MySQL database name [sbtest] --mysql-table-engine=STRING storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb] --mysql-engine-trx=STRING whether storage engine used is transactional or not {yes,no,auto} [auto] --mysql-ssl=[on|off] use SSL connections, if available in the client library [off] --myisam-max-rows=N max-rows parameter for MyISAM tables [1000000] --mysql-create-options=STRING additional options passed to CREATE TABLE []
Copyright © Linux教程網 All Rights Reserved