久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

mysql sysben0.5的安裝和測(cè)試步驟

共計(jì) 8975 個(gè)字符,預(yù)計(jì)需要花費(fèi) 23 分鐘才能閱讀完成。

這篇文章主要介紹“mysql sysben0.5 的安裝和測(cè)試步驟”,在日常操作中,相信很多人在 mysql sysben0.5 的安裝和測(cè)試步驟問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”mysql sysben0.5 的安裝和測(cè)試步驟”的疑惑有所幫助!接下來,請(qǐng)跟著丸趣 TV 小編一起來學(xué)習(xí)吧!

安裝 sysbench 

OS readhat 6.4

mysql 版本 5.7

mysql 安裝目錄

下載安裝包 https://github.com/akopytov/sysbench

shell wget https://github.com/akopytov/sysbench/archive/1.0.zip -O sysbench-1.0.zip

2. 安裝依賴包  

# yum -y install  make automake libtool pkgconfig libaio-devel vim-common

3、上傳到 linux 系統(tǒng)中(/usr/local/),并且解壓,進(jìn)入 /usr/local/ 執(zhí)行:

p unzip sysbench-0.5.zip -d  /usr/local

4、創(chuàng)建 sysbench 安裝目錄文件夾:

5、進(jìn)入 /usr/local/sysbench-master/ 執(zhí)行:./autogen.sh

# cd /usr/local/sysbench-0.5

# ./autogen.sh

6.

#./configure –prefix=/usr/local/sysbench-0.5 –with-mysql-includes=/usr/local/mysql/include –with-mysql-libs=/usr/local/mysql/lib/;

7.

#  make

8.

# make install

9. 查看版本

[root@msyqlzhu sysbench-0.5]# /usr/local/sysbench-0.5/bin/sysbench version

sysbench 0.5

如果出現(xiàn):(sysbench: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory)報(bào)錯(cuò),

則在(vim /etc/profile 中加入:export LD_LIBRARY_PATH=/usr/local/mysql/lib/)

常用參數(shù): 

#-test=tests/db/oltp.lua 表示調(diào)用 tests/db/oltp.lua 腳本進(jìn)行 oltp 模式測(cè)試

#–oltp_tables_count=10 表示會(huì)生成 10 個(gè)測(cè)試表

#–oltp-table-size=100000 表示每個(gè)測(cè)試表填充數(shù)據(jù)量為 100000 

#–rand-init=on 表示每個(gè)測(cè)試表都是用隨機(jī)數(shù)據(jù)來填充的

#-num-threads=8 表示發(fā)起 8 個(gè)并發(fā)連接

#–oltp-read- 表示不要進(jìn)行只讀測(cè)試,也就是會(huì)采用讀寫混合模式測(cè)試

#–report-interval=10 表示每 10 秒輸出一次測(cè)試進(jìn)度報(bào)告

#–rand-type=uniform 表示隨機(jī)類型為固定模式,其他幾個(gè)可選隨機(jī)模式:uniform(固定),gaussian(高斯),special(特定的),pareto(帕累托)

#–max-time=120 表示最大執(zhí)行時(shí)長(zhǎng)為 120 秒

#–max-requests=0 表示總請(qǐng)求數(shù)為 0,因?yàn)樯厦嬉呀?jīng)定義了總執(zhí)行時(shí)長(zhǎng),所以總請(qǐng)求數(shù)可以設(shè)定為 0;也可以只設(shè)定總請(qǐng)求數(shù),不設(shè)定最大執(zhí)行時(shí)長(zhǎng)

#–percentile=99 表示設(shè)定采樣比例,默認(rèn)是 95%,即丟棄 1% 的長(zhǎng)請(qǐng)求,在剩余的 99% 里取最大值

測(cè)試文件 IO

測(cè)試 cpu 的 CPU 測(cè)試使用 64 位整數(shù),測(cè)試計(jì)算素?cái)?shù)直到某個(gè)最大值所需要的時(shí)間。

# /usr/local/sysbench-0.5/bin/sysbench –test=cpu –cpu-max-prime=20000 run

 General statistics:

    total time:                          26.8631s

    total number of events:              10000

    total time taken by event execution: 26.8434s

    response time:

         min:                                  2.24ms

         avg:                                  2.68ms

         max:                                  7.49ms

         approx.  95 percentile:               3.20ms

Threads fairness:

    events (avg/stddev):           10000.0000/0.00

    execution time (avg/stddev):   26.8434/0.00

1. 測(cè)試線程

[root@msyqlzhu t]# /usr/local/sysbench-0.5/bin/sysbench –test=threads –num-threads=64 run 

sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 64

Random number generator seed is 0 and will be ignored

Initializing worker threads…

Threads started!

General statistics:

    total time:                          5.2132s

    total number of events:              10000

    total time taken by event execution: 332.6492s

    response time:

         min:                                  0.23ms

         avg:                                 33.26ms

         max:                                282.98ms

         approx.  95 percentile:              87.66ms

Threads fairness:

    events (avg/stddev):           156.2500/5.53

    execution time (avg/stddev):   5.1976/0.01

2. 互斥鎖測(cè)試互斥鎖(mutex)

/usr/local/sysbench-0.5/bin/sysbench –test=mutex –num-threads=16 –mutex-num=2048 –mutex-locks=1000000 –mutex-loops=5000 run

sysbench 0.5:  multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 16

Random number generator seed is 0 and will be ignored

Initializing worker threads…

Threads started!

General statistics:

    total time:                          2.5536s

    total number of events:              16

    total time taken by event execution: 39.6446s

    response time:

         min:                               2348.59ms

         avg:                               2477.79ms

         max:                               2553.24ms

         approx.  95 percentile:            2549.79ms

Threads fairness:

    events (avg/stddev):           1.0000/0.00

    execution time (avg/stddev):   2.4778/0.07

3. 內(nèi)存測(cè)試

 [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench –test=memory –memory-block-size=8K –memory-total-size=1G  –num-threads=16 run

4. 文件 IO 基準(zhǔn)測(cè)試

  共 1G

 [root@msyqlzhu ~]# /usr/local/sysbench-0.5/bin/sysbench –test=fileio –file-total-size=1G prepare

 1073741824 bytes written in 8.15 seconds (125.60 MB/sec).

  測(cè)試文件 IO 4 個(gè)文件共 4G

 [root@msyqlzhu ~]#  /usr/local/sysbench-0.5/bin/sysbench –test=fileio –file-num=4 –file-total-size=4G prepare

 4261412864 bytes written in 6.52 seconds (623.68 MB/sec).

  測(cè)試文件 IO 4 個(gè)文件共 4G. 塊大小為 16K

 [root@msyqlzhu ~]#  /usr/local/sysbench-0.5/bin/sysbench –test=fileio –file-num=4 –file-block-size=16384 –file-total-size=4G prepare

這個(gè)命令會(huì)在當(dāng)前工作目錄下創(chuàng)建測(cè)試文件,后續(xù)的運(yùn)行 (run) 階段將通過讀寫這些文件進(jìn)行測(cè)試。第二步就是運(yùn)行 (run) 階段,針對(duì)不同的 IO 類型有不同的測(cè)試選項(xiàng):

seqwr 順序?qū)懭?/p>

seqrewr 順序重寫

seqrd 順序讀取

rndrd 隨機(jī)讀取

rndwr 隨機(jī)寫入

rndrw 混合隨機(jī)讀 / 寫

下面的命令運(yùn)行文件 I / O 混合隨機(jī)讀 / 寫基準(zhǔn)測(cè)試:

混合隨機(jī)讀 / 寫

/usr/local/sysbench-0.5/bin/sysbench –test=fileio –file-total-size=4G –file-test-mode=rndrw  –init-rng=on –max-time=300 –max-requests=0 run

清除測(cè)試的文件

/usr/local/sysbench-0.5/bin/sysbench –test=fileio –fil-total-size=30G cleanup

測(cè)試 oltp

1. 找到 select.lua 腳本路徑

[root@msyqlzhu t]# find / -name oltp.lua

/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua

2. 創(chuàng)建測(cè)試的時(shí)候默認(rèn)用 sbtest 庫(kù)

create database sbtest;

3.prepare 生成數(shù)據(jù)和表

使用的參數(shù)

–oltp-table-size 生成的表的記錄數(shù)

–oltp-tables-count 生成的表的個(gè)數(shù)

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua  –oltp-table-size=100000  –mysql-user=root –oltp-tables-count=10 –mysql-password=ORACLE –mysql-socket=/mysqldata/mysql/data/mysql.sock prepare

4.run 運(yùn)行

也可使用 parallel_prepare.lua 腳本并行準(zhǔn)備測(cè)試數(shù)據(jù), 

運(yùn)行時(shí)使用的參數(shù)

–oltp-dist-pct 熱點(diǎn)數(shù)據(jù)的比例

–oltp-dist-res 熱點(diǎn)數(shù)據(jù)訪問頻率

–num-threads    線程數(shù)

–max-time=3000    執(zhí)行時(shí)間

–report-interval  打印報(bào)告的時(shí)間間隔

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua –num-threads=20 –oltp-dist-pct=1  –oltp-dist-res=75 –oltp-table-size=100000  –num-threads=100 –mysql-db=sbtest  –mysql-user=root –oltp-tables-count=10 –max-time=3000 –max-requests=0 –report-interval=3 –mysql-password=ORACLE  –mysql-socket=/mysqldata/mysql/data/mysql.sock run

生成的報(bào)告,tps: 約為 495,響應(yīng)時(shí)間 response time 約為 380 毫秒,qps 約為 6 千多

[141s] threads: 100, tps: 481.38, reads: 6728.28, writes: 2001.18, response time: 369.82ms (95%), errors: 0.33, reconnects:  0.00

[144s] threads: 100, tps: 495.94, reads: 6958.09, writes: 1970.41, response time: 339.89ms (95%), errors: 0.00, reconnects:  0.00

[147s] threads: 100, tps: 513.72, reads: 7193.10, writes: 2076.22, response time: 326.33ms (95%), errors: 0.33, reconnects:  0.00

[150s] threads: 100, tps: 494.33, reads: 6921.66, writes: 1971.33, response time: 333.44ms (95%), errors: 0.33, reconnects:  0.00

[153s] threads: 100, tps: 441.32, reads: 6032.87, writes: 1685.30, response time: 396.06ms (95%), errors: 0.00, reconnects:  0.00

[156s] threads: 100, tps: 502.62, reads: 7007.69, writes: 2000.82, response time: 398.92ms (95%), errors: 0.00, reconnects:  0.00

[159s] threads: 100, tps: 428.68, reads: 6192.48, writes: 1805.71, response time: 365.53ms (95%), errors: 0.00, reconnects:  0.00

[162s] threads: 100, tps: 438.70, reads: 6140.14, writes: 1777.47, response time: 586.58ms (95%), errors: 0.33, reconnects:  0.00

[165s] threads: 100, tps: 495.63, reads: 6928.11, writes: 1951.51, response time: 380.04ms (95%), errors: 0.00, reconnects:  0.00

5.clearnup

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/oltp.lua  –oltp-table-size=100000 –mysql-db=sbtest –mysql-user=root –oltp-tables-count=10 –mysql-password=ORACLE –mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup

測(cè)試 select 

1.prepare 生成數(shù)據(jù)

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua  –oltp-table-size=10000000  –mysql-user=root –oltp-tables-count=10 –mysql-password=ORACLE –mysql-socket=/mysqldata/mysql/data/mysql.sock prepare

2.run 運(yùn)行

運(yùn)行時(shí)使用的參數(shù)

–oltp-dist-pct 熱點(diǎn)數(shù)據(jù)的比例

–oltp-dist-res 熱點(diǎn)數(shù)據(jù)訪問頻率

–num-threads    線程數(shù)

–max-time=3000    執(zhí)行時(shí)間

–report-interval  打印報(bào)告的時(shí)間間隔

打印的報(bào)告種的 reads 表示 qps,response time 表示響應(yīng)時(shí)間

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua –num-threads=20 –oltp-dist-pct=1  –oltp-dist-res=75 –oltp-table-size=100000  –num-threads=10 –mysql-db=sbtest  –mysql-user=root –oltp-tables-count=10 –max-time=3000 –max-requests=0 –report-interval=3 –mysql-password=ORACLE  –mysql-socket=/mysqldata/mysql/data/mysql.sock run

[  84s] threads: 100, tps: 0.00, reads: 22529.11, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects:  0.00

[  87s] threads: 100, tps: 0.00, reads: 22455.45, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects:  0.00

[  90s] threads: 100, tps: 0.00, reads: 22569.36, writes: 0.00, response time: 0.13ms (95%), errors: 0.00, reconnects:  0.00

[  93s] threads: 100, tps: 0.00, reads: 21957.72, writes: 0.00, response time: 0.15ms (95%), errors: 0.00, reconnects:  0.00

[  96s] threads: 100, tps: 0.00, reads: 21588.06, writes: 0.00, response time: 0.14ms (95%), errors: 0.00, reconnects:  0.00

cleanup

# /usr/local/sysbench-0.5/bin/sysbench –test=/usr/local/sysbench-0.5/sysbench/tests/db/select.lua –oltp-dist-pct=1  –oltp-dist-res=75 –oltp-table-size=100000  –num-threads=10 –mysql-db=sbtest  –mysql-user=root –oltp-tables-count=10 –mysql-password=ORACLE  –mysql-socket=/mysqldata/mysql/data/mysql.sock cleanup

常用參數(shù):

Run 的時(shí)候常用的參數(shù)

–oltp-tables-count

–oltp-read-only 僅執(zhí)行 SELECT 測(cè)試 on | off, 默認(rèn)為 off

–oltp-dist-type 隨機(jī)數(shù)分布狀態(tài)。uniform(均勻分布)、gauss(高斯分布)、special(特殊分布)

–oltp-dist-pct 特殊分布的百分比值

–oltp-dist-res 特殊分布的百分比

–oltp-point-selects 單個(gè)事務(wù)中指定的 selec 查詢個(gè)數(shù)

–oltp-range-size 范圍查詢的范圍大小,該值應(yīng)比 oltp-table-size 小

–oltp-simple-ranges 單個(gè)事務(wù)中指定的簡(jiǎn)單范圍查詢個(gè)數(shù)

–oltp-sum-ranges 單個(gè)事務(wù)中指定的 SUM 范圍查詢個(gè)數(shù)

–oltp-order-ranges 單個(gè)事務(wù)中指定的 ORDER 范圍查詢個(gè)數(shù)

–oltp-distinct-ranges 單個(gè)事務(wù)中指定的 DISTINCT 范圍查詢個(gè)數(shù)

–oltp-index-updates 單個(gè)事務(wù)中指定的使用索引更新的個(gè)數(shù)

–oltp-non-index-updates 單個(gè)事務(wù)中指定的不使用索引更新的個(gè)數(shù)

到此,關(guān)于“mysql sysben0.5 的安裝和測(cè)試步驟”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-07-28發(fā)表,共計(jì)8975字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請(qǐng)注明出處。
評(píng)論(沒有評(píng)論)
主站蜘蛛池模板: 临清市| 铜陵市| 金溪县| 文成县| 鹤壁市| 昌宁县| 绩溪县| 德令哈市| 郧西县| 河北省| 南平市| 达日县| 安龙县| 偃师市| 连江县| 江都市| 四会市| 出国| 玉山县| 山东| 无棣县| 博乐市| 汪清县| 黄骅市| 肇庆市| 昌江| 龙江县| 宁明县| 临猗县| 顺义区| 巴彦县| 永丰县| 绩溪县| 徐水县| 雷波县| 泉州市| 甘肃省| 永康市| 临泉县| 姜堰市| 固镇县|