SYSBENCH—達夢數據庫性能測試


環境准備

 

測試環境

操作系統

centos7.8

Cpu

 Intel(R) Xeon(R) E5-2670 (32核)

內存

32G

磁盤

500G

數據庫版本

DM8 單機

 

 

a. 初始化數據庫

b. 前台方式啟動數據庫服務

c. 設置數據庫的參數

d. 重啟數據庫服務

e. 擴展表空間以及日志

說明:擴展roll表空間文件及日志文件,保證測試過程中不刷檢查點。

alter tablespace "ROLL" resize datafile 'ROLL.DBF' to 20000;

alter tablespace "MAIN" resize datafile 'MAIN.DBF' to 20000;

alter database resize logfile 'DAMENG01.log' to 50000;

alter database resize logfile 'DAMENG02.log' to 50000;

 測試工具

鏈接:https://pan.baidu.com/s/1zf5lhfNfbslezxWUvz1Hdw

提取碼:1432

unzip sysbench-master-dm.zip -d /opt/sysbench-master

cd /opt/sysbench-master/

unzip sysbench-master-dpi-20200604-src.zip

cd sysbench-master-dpi/src/lua/

chmod +x sysbench

./sysbench --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=5 --events=0 --time=600 oltp_read_only prepare

cd ../../

chmod +x autogen.sh

檢查和安裝gcc和libtool包

rpm -qa|grep gcc

yum -y install gcc

yum -y install automake libtool

./autogen.sh

檢查數據庫是否啟動

ps -ef|grep dmdba

檢查參數

echo $DM_HOME

如果沒有配置,添加配置

export DM_HOME=/dm8

chmod +x configure

./configure --without-mysql

make

cd src

mv sysbench ./lua/sysbenchnew

cd lua

 數據准備與執行

說明:因為sysbench需要dm數據庫驅動,因此在執行此工具的機器上必須本地安裝dm數據庫,不啟動服務都可以,sysbench主要是要調用dm數據庫安裝目錄bin下的一個os動態庫,不過給出的包已經帶有所需的動態庫,在/sysbench-master/src/lib64下,安裝部署好dm數據庫后,把sysbench解壓到相關目錄下:目錄結構最好為/opt/sysbench-master

案例:

a. 數據准備

./sysbench oltp_read_write.lua --tables=25 --table-size=250000

--db-driver=dm --dm-db=localhost:5236 --dm-user=SYSDBA

--dm-password=SYSDBA001 --auto-inc=1 --threads=64 --time=180

--report-interval=10 prepare

n --table-size=250000 表示每個測試表填充數據量為 250000

n --tables=25表示25張表

n --threads=64 表示發起64個並發連接

n --report-interval=10 表示每10秒輸出一次測試進度報告

n --time=180 表示最大執行時長為180秒

b. 上一步prepare執行完畢后,執行如下腳本進行測試:

./sysbench oltp_read_write.lua --tables=25 --table-size=250000

--db-driver=dm --dm-db=localhost:5236 --dm-user=SYSDBA

--dm-password=SYSDBA001 --auto-inc=1 --threads=64 --time=180

--report-interval=10 run

c. 上一步run執行完畢后,執行如下腳本進行清楚數據:

./sysbench oltp_read_write.lua --tables=25 --table-size=250000

--db-driver=dm --dm-db=localhost:5236 --dm-user=SYSDBA

--dm-password=SYSDBA001 --auto-inc=1 --threads=64 --time=180

--report-interval=10 cleanup

切記,每一次測試都是一個閉環: prepare---run---cleanup,不然會報錯,必須嚴格按照這三步來進行

執行測試1:純讀

##准備數據

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25 --events=0 --time=600 oltp_read_only prepare

##運行workload

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 --range-selects=0 --skip-trx=1 --report-interval=1 oltp_read_only run

##清理

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 --range-selects=0 oltp_read_only cleanup

 

 

測試點2:純寫:

##准備數據

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25--events=0 --time=600 oltp_write_only prepare

##運行workload

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 --report-interval=1 oltp_write_only run

##清理

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=25000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 oltp_write_only cleanup

 

 

測試點3:讀寫

##准備數據

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=250000 --tables=25 --events=0 --time=600 oltp_read_write prepare

##運行workload

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=250000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 --report-interval=1 oltp_read_write run

##清理

./sysbenchnew --db-driver=dm --dm-db=192.168.10.72:5236 --dm-user=SYSDBA --dm-password=SYSDBA --table_size=250000 --tables=25 --events=0 --time=600 --threads=32 --percentile=95 oltp_read_write cleanup

 

 

我們一般關注的指標主要有:

  • response time avg:平均響應時間(后面的95%的大小可以通過–percentile=98的方式去更改)。
  • transactions:精確的說是這一項后面的TPS,但如果使用了–skip-trx=on,這項事務數為0,需要用total number of events去除以總時間,得到tps(其實還可以分為讀tps和寫tps)。
  • queries:用它除以總時間,得到吞吐量QPS。

 

 

 

 

附錄:服務器基准的IO能力測試

dd 測試磁盤寫入速度

dd if=/dev/zero of=aaa bs=32k count=4k oflag=dsync

讀取速率

dd if=aaa of=/dev/null iflag=dsync

fio測試:

fio -filename=/dev/sdb -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psync -bs=32k -size=50G -numjobs=32 -runtime=100 -group_reporting -name=mytest

說明:

1) 注意cd到data文件目錄下進行測試。

2) 請不要調整測試參數

3) Fio測試時,請注意記錄IOPS和吞吐量(兩個指標都很重要)

讀寫分離配置建議:

上述命令測試,建議可以提供:32k隨機讀寫時IOPS保持在3k以上,吞吐量在80MBPS以上服務器。

 

網速測試

yum -y install git

git clone https://github.com/sivel/speedtest-cli.git

cd speedtest-cli/

./speedtest.py

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM