中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

怎樣進(jìn)行mysqlsysbench1.0.3安裝以及系統(tǒng)壓力測試-創(chuàng)新互聯(lián)

今天就跟大家聊聊有關(guān)怎樣進(jìn)行mysql  sysbench1.0.3 安裝以及系統(tǒng)壓力測試,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

成都創(chuàng)新互聯(lián)長期為千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為汾陽企業(yè)提供專業(yè)的網(wǎng)站設(shè)計制作、網(wǎng)站設(shè)計,汾陽網(wǎng)站改版等技術(shù)服務(wù)。擁有10多年豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。

針對系統(tǒng)和數(shù)據(jù)庫壓測是項目上線前必做的一項,這里使用的是最新版本的sysbench做的壓測使用詳解。sysbench可以做系統(tǒng)層面的壓力測試(CPU、內(nèi)存、硬盤IO、互斥鎖、Thead),也可以做數(shù)據(jù)庫(MySQL/Oracle/PG)層面的壓力測試。安裝容易,操作便捷,是壓測使用的重要工具之一。
一、sysbench下載
項目地址:https://launchpad.net/sysbench    
下載地址:https://github.com/akopytov/sysbench/archive/1.0.3.tar.gz
二、sysbench安裝
[root@DB_TEST tools]# tar -xzvf sysbench-1.0.3.tar.gz
[root@DB_TEST tools]# cd sysbench-1.0.3
[root@DB_TEST sysbench-1.0.3]# ./autogen.sh
[root@DB_TEST sysbench-1.0.3]#./configure  --prefix=/usr/local/sysbench --with-mysql
[root@DB_TEST sysbench-1.0.3]# make
[root@DB_TEST sysbench-1.0.3]# make install
[root@DB_TEST sysbench-1.0.3]#  cp -rp /usr/local/sysbench/bin/sysbench  /usr/bin/
[root@DB_TEST sysbench-1.0.3]# /usr/local/sysbench/bin/sysbench --help   
點擊(此處)折疊或打開

  1. [root@BJ-133-22 sysbench-1.0.3]# /usr/local/sysbench/bin/sysbench --help

  2. Usage:

  3. sysbench [options]... [testname] [command]

  4. Commands implemented by most tests: prepare run cleanup help

  5. General options:

  6. --threads=N number of threads to use [1]

  7. --events=N limit for total number of events [0]

  8. --time=N limit for total execution time in seconds [10]

  9. --forced-shutdown=STRING number of seconds to wait after the --time limit before forcing shutdown, or 'off' to disable [off]

  10. --thread-stack-size=SIZE size of stack per thread [64K]

  11. --rate=N average transactions rate. 0 for unlimited rate [0]

  12. --report-interval=N periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0]

  13. --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. []

  14. --debug[=on|off] print more debugging info [off]

  15. --validate[=on|off] perform validation checks where possible [off]

  16. --help[=on|off] print help and exit [off]

  17. --version[=on|off] print version and exit [off]

  18. --config-file=FILENAME File containing command line options

  19. --tx-rate=N deprecated alias for --rate [0]

  20. --max-requests=N deprecated alias for --events [0]

  21. --max-time=N deprecated alias for --time [0]

  22. --num-threads=N deprecated alias for --threads [1]

  23. Pseudo-Random Numbers Generator options:

  24. --rand-type=STRING random numbers distribution {uniform,gaussian,special,pareto} [special]

  25. --rand-spec-iter=N number of iterations used for numbers generation [12]

  26. --rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1]

  27. --rand-spec-res=N percentage of 'special' values to use (for special distribution) [75]

  28. --rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0]

  29. --rand-pareto-h=N parameter h for pareto distibution [0.2]

  30. Log options:

  31. --verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]

  32. --percentile=N percentile to calculate in latency statistics (1-100). Use the special value of 0 to disable percentile calculations [95]

  33. --histogram[=on|off] print latency histogram in report [off]

  34. General database options:

  35. --db-driver=STRING specifies database driver to use ('help' to get list of available drivers)

  36. --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]

  37. --db-debug[=on|off] print database-specific debug information [off]

  38. Compiled-in database drivers:

  39. mysql - MySQL driver

  40. mysql options:

  41. --mysql-host=[LIST,...] MySQL server host [localhost]

  42. --mysql-port=[LIST,...] MySQL server port [3306]

  43. --mysql-socket=[LIST,...] MySQL socket

  44. --mysql-user=STRING MySQL user [sbtest]

  45. --mysql-password=STRING MySQL password []

  46. --mysql-db=STRING MySQL database name [sbtest]

  47. --mysql-ssl[=on|off] use SSL connections, if available in the client library [off]

  48. --mysql-ssl-cipher=STRING use specific cipher for SSL connections []

  49. --mysql-compression[=on|off] use compression, if available in the client library [off]

  50. --mysql-debug[=on|off] trace all client library calls [off]

  51. --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205]

  52. --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off]

  53. Compiled-in tests:

  54. fileio - File I/O test

  55. cpu - CPU performance test

  56. memory - Memory functions speed test

  57. threads - Threads subsystem performance test

  58. mutex - Mutex performance test

  59. See 'sysbench help' for a list of options for each test.

三、sysbench使用
1、CPU性能測試

cpu性能測試:找范圍內(nèi)大素數(shù){時間越短越好}

cpu性能測試主要是根據(jù)素數(shù)的加法運(yùn)算,這里指定大素數(shù)(質(zhì)數(shù))為80000,--num-threads=`grep "processor" /proc/cpuinfo | wc -l`指定線程數(shù),默認(rèn)是1

/usr/local/sysbench/bin/sysbench --test=cpu --cpu-max-prime=80000 run

點擊(此處)折疊或打開

  1. [root@db_test ~]# /usr/local/sysbench/bin/sysbench --test=cpu --cpu-max-prime=80000 run

  2. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.

  3. sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

  4. Running the test with following options:

  5. Number of threads: 1

  6. Initializing random number generator from current time

  7. Prime numbers limit: 80000

  8. Initializing worker threads...

  9. Threads started!

  10. General statistics:

  11. total time: 10.0057s

  12. total number of events: 520

  13. Latency (ms):

  14. min: 18.74

  15. avg: 19.24

  16. max: 19.39

  17. 95th percentile: 19.29

  18. sum: 10005.32

  19. Threads fairness:

  20. events (avg/stddev): 520.0000/0.00

  21. execution time (avg/stddev): 10.0053/0.00

實際環(huán)境CPU拷機(jī)壓測腳本如下:

echo -e "進(jìn)行CPU壓力測試: 尋找小于1千萬的大質(zhì)數(shù),并發(fā)線程數(shù)10,大請求數(shù)100 "

/usr/local/bin/sysbench --num-threads=10 --max-requests=100 --test=cpu --debug --cpu-max-prime=10000000 run


2、內(nèi)存性能測試

sysbench 測試memory的時候是順序讀或?qū)憙?nèi)存的。根據(jù)選項的不同,每次操作過程中,每個線程可以獲取global或本地的數(shù)據(jù)塊

內(nèi)存:以不同塊大小傳輸一定數(shù)量的數(shù)據(jù)吞吐量大小{越大越好}

點擊(此處)折疊或打開

  1. [root@db_test fileio]# /usr/local/sysbench/bin/sysbench --test=memory help

  2. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.

  3. sysbench 1..3 (using bundled LuaJIT 2.1.-beta2)

  4. memory options:

  5.   --memory-block-size=SIZE size of memory block for test [1K]  測試時內(nèi)存塊大小

  6.   --memory-total-size=SIZE total size of data to transfer [100G] 傳輸數(shù)據(jù)總大小

  7.   --memory-scope=STRING memory access scope {global,local} [global]  內(nèi)存訪問范圍

  8.   --memory-hugetlb[=on|off] allocate memory from HugeTLB pool [off] 從<span "="" style="color: rgb(0, 0, 0); font-size: 10.5pt;"> HugeTLB pool內(nèi)存分配

  9.   --memory-oper=STRING type of memory operations {read, write, none} [write] 內(nèi)存操作類型

  10.   --memory-access-mode=STRING memory access mode {seq,rnd} [seq] 存儲器存取方式

示例:測試傳輸數(shù)據(jù)總量為5G,每個塊大小是1K(一般設(shè)置是8K),連續(xù)讀寫的情況下,吞吐量3435.87 MiB/sec
[root@db_test fileio]# /usr/local/sysbench/bin/sysbench --test=memory --memory-block-size=1K --memory-total-size=5G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current timeInitializing worker threads...

Threads started!

Operations performed: 5242880 (3518332.06 ops/sec)

5120.00 MiB transferred (3435.87 MiB/sec)General statistics:
    total time:                          1.4883s
    total number of events:              5242880

Latency (ms):
         min:                                  0.00
         avg:                                  0.00
         max:                                  0.03
         95th percentile:                      0.00
         sum:                                631.01

Threads fairness:
    events (avg/stddev):           5242880.0000/0.00
    execution time (avg/stddev):   0.6310/0.00

實際內(nèi)存壓力測試腳本:

echo -e "進(jìn)行內(nèi)存壓力測試: 測試范圍32G,并發(fā)線程數(shù)10,大請求數(shù)100, 讀 "

/usr/local/bin/sysbench --num-threads=10 --max-requests=100 --test=memory --memory-block-size=8K --memory-total-size=${MEM}G --memory-oper=read run

echo -e "進(jìn)行內(nèi)存壓力測試: 測試范圍32G,并發(fā)線程數(shù)10,大請求數(shù)100, 寫 "

/usr/local/bin/sysbench --num-threads=10 --max-requests=100 --test=memory --memory-block-size=8K --memory-total-size=${MEM}G --memory-oper=write run


3、磁盤IO性能測試

IO性能測試:不同場景下IOPS{越大越好}

點擊(此處)折疊或打開

  1. [root@db_test sysbench-1.0.3]# /usr/local/sysbench/bin/sysbench --test=fileio help

  2. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.

  3. sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

  4. fileio options:

  5. --file-num=N number of files to create [128]

  6. --file-block-size=N block size to use in all IO operations [16384]

  7. --file-total-size=SIZE total size of files to create [2G]

  8. --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}

  9. --file-io-mode=STRING file operations mode {sync,async,mmap} [sync]

  10. --file-async-backlog=N number of asynchronous operatons to queue per thread [128]

  11. --file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []

  12. --file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]

  13. --file-fsync-all[=on|off] do fsync() after each write operation [off]

  14. --file-fsync-end[=on|off] do fsync() at the end of test [on]

  15. --file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]

  16. --file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0]

  17. --file-rw-ratio=N reads/writes ratio for combined test [1.5]

--file-num=N                       創(chuàng)建測試文件數(shù)量,默認(rèn)是 [128]
--file-block-size=N                測試時文件塊大小,默認(rèn)是[16384],即16K
--file-total-size=SIZE             測試文件的總大小,默認(rèn)是 [2G]
--file-test-mode=STRING            測試模式 {seqwr(順序?qū)懀? seqrewr(順序讀寫), seqrd(順序讀), rndrd(隨機(jī)讀), rndwr(隨機(jī)寫), rndrw(隨機(jī)讀寫)}
--file-io-mode=STRING              文件操作模式{sync,async,mmap} [sync]
--file-extra-flags=STRING          使用額外的標(biāo)志打開文件 {sync,dsync,direct} []
--file-fsync-freq=N                執(zhí)行fsync()頻率,0表示不使用,默認(rèn)100
--file-fsync-all=[on|off]          每執(zhí)行一次寫操作執(zhí)行一次fsync(),默認(rèn) [off]
--file-fsync-end=[on|off]          測試結(jié)束執(zhí)行fsync(),默認(rèn) [on]
--file-fsync-mode=STRING           同步方法 {fsync, fdatasync} [fsync]
--file-merged-requests=N           如果可以,則合并IO請求數(shù),默認(rèn)0表示不合并
--file-rw-ratio=N                  測試讀寫比例,默認(rèn)[1.5]

seqwr 順序?qū)懭?br/>seqrewr 順序重寫
seqrd 順序讀取
rndrd 隨機(jī)讀取
rndwr 隨機(jī)寫入
rndrw 混合隨機(jī)讀/寫

FileIO示例01:prepare 命令創(chuàng)建了128個文件總共大小為10G ,文件讀寫模式為隨機(jī)讀寫混合方式。run 命令則進(jìn)行測試,并返回結(jié)果,cleanup 刪除測試產(chǎn)生的文件!
##Fileio準(zhǔn)備工作,生成測試數(shù)據(jù)(最好比內(nèi)存的2倍大)
[root@db_test fileio]# /usr/local/sysbench/bin/sysbench  --num-threads=16 --test=fileio --file-total-size=10G --file-test-mode=rndrw prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

128 files, 81920Kb each, 10240Mb total
Creating files for the test...
Extra file open flags: 0
Creating file test_file.0
...
Creating file test_file.127
10737418240 bytes written in 9.96 seconds (1027.97 MiB/sec).
##正式執(zhí)行FileIO測試
[root@db_test fileio]# /usr/local/sysbench/bin/sysbench  --num-threads=16 --test=fileio --file-total-size=10G --file-test-mode=rndrw run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 16
Initializing random number generator from current timeExtra file open flags: 0
128 files, 80MiB each
10GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!File operations:
    reads/s:                      1449.16
    writes/s:                     965.91
    fsyncs/s:                     3083.55

Throughput:
    read, MiB/s:                  22.64
    written, MiB/s:               15.09

General statistics:
    total time:                          10.4176s
    total number of events:              57291

Latency (ms):
         min:                                  0.00
         avg:                                  2.87
         max:                                825.08
         95th percentile:                      0.17
         sum:                             164312.66

Threads fairness:
    events (avg/stddev):           3580.6875/469.53
    execution time (avg/stddev):   10.2695/0.08

IO密切相關(guān)的包括每秒請求數(shù)和總吞吐量,其中請求數(shù)是(1449.16+965.91+3083.55)/s,吞吐量是(22.64+15.09)MB/s

##清理創(chuàng)建的文件
[root@db_test fileio]# /usr/local/sysbench/bin/sysbench  --num-threads=16 --test=fileio --file-total-size=10G --file-test-mode=rndrw cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

Removing test files...

實際環(huán)境FILEIO壓力測試腳本:

echo -e "進(jìn)行IO壓力測試: 20個文件,每個10GB,隨機(jī)讀寫 "

/usr/local/bin/sysbench --file-num=20 --num-threads=20 --test=fileio --file-total-size=${HDD}G --max-requests=1000000 --file-test-mode=rndrw prepare

/usr/local/bin/sysbench --file-num=20 --num-threads=20 --test=fileio --file-total-size=${HDD}G --max-requests=1000000 --file-test-mode=rndrw run

/usr/local/bin/sysbench --file-num=20 --num-threads=20 --test=fileio --file-total-size=${HDD}G --max-requests=1000000 --file-test-mode=rndrw cleanup

4、thread測試

線程調(diào)度:線程并發(fā)執(zhí)行,循環(huán)響應(yīng)信號量花費的時間{越少越好}
測試線程調(diào)度器的性能。對于高負(fù)載情況下測試線程調(diào)度器的行為非常有用

點擊(此處)折疊或打開

  1. [root@db_test fileio]# /usr/local/sysbench/bin/sysbench --test=threads help

  2. WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.

  3. sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

  4. threads options:

  5. --thread-yields=N number of yields to do per request [1000] 每個請求產(chǎn)生多少個線程,默認(rèn)[4096]

  6.   --mutex-locks=N number of mutex locks to do per thread [50000] 每個線程互斥鎖的數(shù)量,默認(rèn) [50000]

  7.   --mutex-loops=N number of empty loops to do inside mutex lock [10000] 內(nèi)部互斥鎖的空循環(huán)數(shù)量,默認(rèn) [10000]

所有線程同時執(zhí)行,獲取短時間的mutex lock,以便測試mutex的實現(xiàn)!

示例:
[root@db_test fileio]# /usr/local/sysbench/bin/sysbench --test=mutex --mutex-num=4096 --mutex-locks=50000 --mutex-loops=20000 run 
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.3 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current timeInitializing worker threads...

Threads started!General statistics:
    total time:                          0.0021s
    total number of events:              1

Latency (ms):
         min:                                  2.05
         avg:                                  2.05
         max:                                  2.05
         95th percentile:                      2.03
         sum:                                  2.05

Threads fairness:
    events (avg/stddev):           1.0000/0.00
    execution time (avg/stddev):   0.0020/0.00

看完上述內(nèi)容,你們對怎樣進(jìn)行mysql  sysbench1.0.3 安裝以及系統(tǒng)壓力測試有進(jìn)一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝大家的支持。

分享標(biāo)題:怎樣進(jìn)行mysqlsysbench1.0.3安裝以及系統(tǒng)壓力測試-創(chuàng)新互聯(lián)
URL鏈接:http://www.rwnh.cn/article26/cecscg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、定制開發(fā)、品牌網(wǎng)站建設(shè)、App設(shè)計網(wǎng)站內(nèi)鏈、品牌網(wǎng)站設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)
贡嘎县| 莆田市| 石渠县| 睢宁县| 徐州市| 怀集县| 仁寿县| 凤山市| 东丽区| 凯里市| 达州市| 开鲁县| 沅陵县| 怀集县| 昌吉市| 鄂伦春自治旗| 晋江市| 湟源县| 昌宁县| 巴中市| 临颍县| 马龙县| 花莲市| 铁岭县| 广昌县| 黄陵县| 古交市| 徐闻县| 平遥县| 静安区| 富阳市| 张家口市| 双江| 南宫市| 漯河市| 安丘市| 监利县| 洪江市| 西城区| 广丰县| 苍山县|