1. 程式人生 > >sysbench 0.5 安裝、配置及試用

sysbench 0.5 安裝、配置及試用

sysbench是一個多執行緒效能測試工具,可以進行CPU、MEM、IO資料庫等效能測試。

作為dba我們使用最多的還是做mysql的基準測試,以前使用sysbench都是0.4版本的。

據說0.5做了一些調整這裡簡單的試用一下並順便做點記錄。


1,下載rpm包
http://www.lefred.be/?q=node/154
安裝sysbench需要的mysql 相關包(因為這裡我使用的是Percona 5.6.15版本的server)

 rpm -ivh Percona-Server-client-56-5.6.15-rel63.0.519.rhel6.x86_64.rpm
 rmp -ivh Percona-Server-shared-56-5.6.15-rel63.0.519.rhel6.x86_64.rpm
 
 否則你會遇到Requires: libmysqlclient.so.18()(64bit) 這樣的錯誤
 
,2,安裝sysbenc包
 sysbench-0.5-3.el6_.x86_64.rpm
 
 注意輸入sysbench命令後:
 [
[email protected]
~]# sysbench 
Missing required command argument.
Usage:
  sysbench [general-options]... --test=<test-name> [test-options]... command

General options:
  --num-threads=N             number of threads to use [1]
  --max-requests=N            limit for total number of requests [10000]
  --max-time=N                limit for total execution time in seconds [0]
  --forced-shutdown=STRING    amount of time to wait after --max-time before forcing shutdown [off]
  --thread-stack-size=SIZE    size of stack per thread [64K]
  --tx-rate=N                 target transaction rate (tps) [0]
  --report-interval=N         periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]
  --report-checkpoints=[LIST,...]dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. []
  --test=STRING               test to run
  --debug=[on|off]            print more debugging info [off]
  --validate=[on|off]         perform validation checks where possible [off]
  --help=[on|off]             print help and exit
  --version=[on|off]          print version and exit [off]
  --rand-init=[on|off]        initialize random number generator [off]
  --rand-type=STRING          random numbers distribution {uniform,gaussian,special} [special]
  --rand-spec-iter=N          number of iterations used for numbers generation [12]
  --rand-spec-pct=N           percentage of values to be treated as 'special' (for special distribution) [1]
  --rand-spec-res=N           percentage of 'special' values to use (for special distribution) [75]
  --rand-seed=N               seed for random number generator, ignored when 0 [0]

Log options:
  --verbosity=N      verbosity level {5 - debug, 0 - only critical messages} [3]
  --percentile=N      percentile rank of query response times to count [95]

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

Commands: prepare run cleanup help version
See 'sysbench --test=<name> help' for a list of options for each test.

[
[email protected]
~]# sysbench --test=oltp help
sysbench 0.5:  multi-threaded system evaluation benchmark

PANIC: unprotected error in call to Lua API (cannot open oltp: No such file or directory)

這裡和0.4版本不同,這裡--test不再有
oltp - OLTP test這個專案,而是換成了對應的lua指令碼路徑(0.5版本rpm包安裝的情況下,預設lua指令碼放在/usr/share/doc/sysbench/tests/db下)

可以檢視:
[
[email protected]
db]# ll /usr/share/doc/sysbench/tests/db
total 44
-rw-r--r-- 1 root root 3585 Sep  7  2012 common.lua
-rw-r--r-- 1 root root  340 Sep  7  2012 delete.lua
-rw-r--r-- 1 root root  830 Sep  7  2012 insert.lua
-rw-r--r-- 1 root root 2925 Sep  7  2012 oltp.lua
-rw-r--r-- 1 root root  342 Sep  7  2012 oltp_simple.lua
-rw-r--r-- 1 root root  425 Sep  7  2012 parallel_prepare.lua
-rw-r--r-- 1 root root  343 Sep  7  2012 select.lua
-rw-r--r-- 1 root root 3964 Sep  7  2012 select_random_points.lua
-rw-r--r-- 1 root root 4066 Sep  7  2012 select_random_ranges.lua
-rw-r--r-- 1 root root  343 Sep  7  2012 update_index.lua
-rw-r--r-- 1 root root  552 Sep  7  2012 update_non_index.lua
如果對lua熟悉也可以自行修改lua指令碼來滿足自己的測試需求。

4,參考測試指令碼:
  
TABLE_SIZE=25000000
HOST="10.10.1.111"
USER_NAME="xxx"
PASS_WORD="xxx"
PORT=3306

TEST_ENGINE="INNODB"
OLTP_TABLES=4   #### the number of tables for testing
MAX_TIME=1200   #### seconds #####
MIN_THREAD=16   ### concurrent threads for testing
MAX_THREAD=64
TEST_GROUP=3
DELAY_TIME=10000   ####ms#####
TEST_DB="test"
SLEEP_TIME=120     ###SECONDS###
REPORT_INTERVAL=10 ###the time interval that print info every time

MIN_ENGINE_THREADS=64
MAX_ENGINE_THREADS=64,

TEST_MODE="/usr/share/doc/sysbench/tests/db/oltp.lua"

#初始化指令碼
 sysbench --test=${TEST_MODE} --oltp_tables_count=${OLTP_TABLES} --report-interval=${REPORT_INTERVAL} 
  --oltp-table-size=${TABLE_SIZE} --num-threads=${${OLTP_TABLES}} --mysql-user=${USER_NAME} 
  --mysql-password=${PASS_WORD}  --mysql-table-engine=${TEST_ENGINE}  --rand-init=on  --mysql-host=${HOST} 
  --mysql-port=${PORT} --mysql-db=${TEST_DB} prepare
 
#壓測指令碼: 
  sysbench --test=${TEST_MODE}  --oltp_tables_count=${OLTP_TABLES} --report-interval=${REPORT_INTERVAL} 
    --oltp-table-size=${TABLE_SIZE} --mysql-user=${USER_NAME}  --mysql-password=${PASS_WORD} --oltp-connect-delay=${DELAY_TIME}  
    --oltp-dist-type=uniform   --rand-init=on  --mysql-table-engine=${TEST_ENGINE} --mysql-host=${HOST} --mysql-port=${PORT} 
    --mysql-db=${TEST_DB} --max-time=${MAX_TIME} --max-requests=0 --num-threads=${num} --thread-stack-size=256   run

#清理指令碼:
 
    sysbench --test=${TEST_MODE}  --oltp_tables_count=${OLTP_TABLES} --report-interval=${REPORT_INTERVAL} --oltp-table-size=${TABLE_SIZE} --mysql-user=${USER_NAME}  --mysql-password=${PASS_WORD}  --mysql-table-engine=${TEST_ENGINE}  --mysql-host=${HOST} --mysql-port=${PORT} --mysql-db=${TEST_DB} cleanup

5,常用引數簡單說明:      
   --report-interval=10:每隔多久列印一次統計資訊,單位秒,0.5版本新增  
   --rand-init=on:是否隨機初始化資料,如果不隨機化那麼初始好的資料每行內容除了主鍵不同外其他完全相同。  
   --rand-type=special:資料分佈模式,special表示存在熱點資料,uniform表示非熱點資料模式

   --mysql-table-engine=xxx:表的儲存引擎型別,innodb、myisam、tokudb這些都可以

6,比較蛋疼的問題:

   sysbench --test='/usr/share/doc/sysbench/tests/db/oltp.lua' help
sysbench 0.5:  multi-threaded system evaluation benchmark

No help available for test '/usr/share/doc/sysbench/tests/db/oltp.lua'.
無法使用幫助資訊來檢視oltp下的引數,只有使用0.4版本才能查,不過還好都相容

注意:
1,oltp的應用存在熱點資料,所以除非測試特殊性否則儘量不用uniform這種非熱點資料模式。
2,初始化資料方式最好隨機--rand-init=on表的數量這個引數最好設定2以上但也不要太多,因為表的結構都一樣。

參考:
https://code.launchpad.net/sysbench
http://www.linuxidc.com/Linux/2012-11/75054p2.htm

相關推薦

sysbench 0.5 安裝配置試用

sysbench是一個多執行緒效能測試工具,可以進行CPU、MEM、IO資料庫等效能測試。作為dba我們使用最多的還是做mysql的基準測試,以前使用sysbench都是0.4版本的。 據說0.5做了一些調整這裡簡單的試用一下並順便做點記錄。 1,下載rpm包 http:

python3.6 + django2.0下的xadmin安裝配置報錯解決

用過django的朋友都知道,django自帶的後臺管理系統是一套智慧的管理系統。 今天給大家介紹下一套基於admin, 比admin更強大的系統。 xadmin 原始碼安裝: clone 或者 下載到本地以後,把xadmin資料夾直接拷貝到專案目錄中,就像

CentOS6.5下 Asterisk 的安裝配置 2個軟電話實現互撥

[general]                              //類似與全域性變數 context  = default                 srvlookup = yes                   //DNS SRV記錄查詢 [111] secret=aaa      

oracle em企業管理器的安裝配置相關問題

密碼 技術分享 分享 control spa alt .com 企業管理 gre 2017-05-10 一、配置ORACLE_UNQNAME環境變量 二、重建EM資料庫:emca -repos recreate 三、配置EM賬號密碼:DBSNMP、SYSMAN 四、配置EM

PHP安裝配置拓展總結

lin 底層 mcr 程序 off bug so庫 處理 why 版權聲明:本文為博主原創文章,未經博主允許不得轉載。 PHP安裝、配置及拓展總結: 本篇文章主要總結的是PHP的安裝、配置、拓展庫的添加及驗證,實現平臺為Unix/Linux/Mac OS X

Nginx安裝配置使用總結

base 搭建 超時 refused splay ssl == 一個 document 版權聲明:本文為博主原創文章,未經博主允許不得轉載。 Nginx的安裝、配置及使用總結: Nginx是一個高性能的HTTP及反向代理服務器,也是IMAP/POP3/

PHP安裝配置拓展

min 軟件 prefix ttl sum director core dev don 主要總結的是PHP的安裝、配置、拓展庫的添加及驗證,實現平臺為Unix/Linux/Mac OS X,這裏也包括日後的技術文章,只將PHP語言作為服務器端腳本和命令式腳本的使用進行總

Cscope安裝配置使用

ron pat str 虛擬機 含義 符號 設置 配置 es2017 安裝及配置 步驟一:設置Cscope: 一、下載 二、安裝 三、建立數據庫 首先在目錄下建立cscope索引文件 find `pwd` -name ‘*.c‘ -o -name ‘*.h‘> csc

maven安裝配置創建工程

lec 不能 前三 變量 lob users 網絡 無法 pla 準備工作 java開發環境(JDK) maven下載地址:http://maven.apache.org/release-notes-all.html 一、安裝 安裝maven

Ansible的安裝配置常用模塊介紹

touch cbc tor ext num using remove face 附加 Ansible的安裝、配置及常用模塊介紹 ansible安裝方式 1、 ansible安裝常用兩種方式,yum安裝和pip程序安裝 這裏提供二種安裝方式,任選一種即可: 1、使用yum

OpenVPN下載安裝配置使用詳解

原文:http://www.cnblogs.com/CakaSWM/p/5582236.html 一、目的: 通過雲伺服器的外網地址,將沒有外網的伺服器的埠地址轉發到外網,使其能夠通過外網進行訪問。 二、原理:   1.虛擬專用網VPN   虛擬專用網VPN(virt ual p

Centos6.10下Open-falcon微信郵件告警安裝配置使用

1 郵件告警 1.1 郵件告警元件安裝 使用官方提供的一個郵件閘道器(https://github.com/open-falcon/mail-provider)配置郵件報警 下載mail-provider並安裝 #下載 cd ~/open-falcon #我的工作目錄 wget h

JDK的下載安裝配置校驗 — 全程圖文詳細教程

JDK的下載、安裝、配置及校驗 — 全程圖文詳細教程 JAVA的學習和開發,必須安裝配置好JDK(java development kit java開發工具包)。Java的開發平臺主要分2類:Java SE是標準版,Java應用程式開發 Application;Java EE是企業版

InfluxDB原始碼編譯安裝配置主從同步實現

先扯點蛋 公司有個專案要求使用InfluxDB時序資料庫儲存點東西。第一次聽說還有這種資料庫,哈哈哈,孤陋寡聞了,先從各位大佬的部落格看起,慢慢學習,逐漸瞭解了之後在伺服器上進行安裝。直接使用官方包進行安裝很簡單,檢視官方說明即可。安裝之後使用才發現,開源的只支援單機版的,但是公司用不能

AndroidStudio2.3.3安裝配置NDKCmake配置遇到的問題彙總

##從入門到放棄系列## ###1、報錯 1.1 CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage    解決方法:在Module:app的build.gradle中新增: ndk{ a

IDEA安裝配置解除安裝

2018-12-04  IDEA 安裝: 此處為最新版2018.3 官網下載地址:http://www.jetbrains.com/idea/download/#section=windows 雙擊下載的exe程式 點選next 選擇安裝地址

ubantu下redis安裝配置使用

ubantu源安裝 安裝/檢視版本資訊 apt install redis-server redis-server -version redis服務啟動/重啟/關閉/檢視狀態 service redis start service redis rstart s

Mac Redis-4.0.11安裝配置

基本知識 1、Redis的資料型別:   字串、列表(lists)、集合(sets)、有序集合(sorts sets)、雜湊表(hashs) 2、Redis和memcache相比的獨特之處:   (1)redis可以用來做儲存(storge)、而memcache是

RabbitMQ3.7.8在win10中的安裝配置使用

1、配套檔案 2、RabbitMQ服務端程式碼是使用併發式語言Erlang編寫的,安裝Rabbit MQ的前提是安裝Erlang,雙擊otp_win64_21.1.exe直接安裝,選擇預設配置即可,如果不安裝Erlang或安裝錯誤而直接安裝RabbitMQ會彈出

sublime安裝配置常用外掛(陸續補全中~)

  一、安裝sublime text3   網址:http://www.sublimetext.com/3 註冊碼:(sublime Text3漢化和啟用註冊碼) ----- BEGIN LICENSE ----- sgbteam Single User License E