溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何壓測mysql5.6中audit.log插件性能損耗

發(fā)布時間:2020-05-22 17:01:33 來源:網(wǎng)絡(luò) 閱讀:170 作者:三月 欄目:數(shù)據(jù)庫

下面一起來了解下如何壓測mysql5.6中audit.log插件性能損耗,相信大家看完肯定會受益匪淺,文字在精不在多,希望如何壓測mysql5.6中audit.log插件性能損耗這篇短內(nèi)容是你想要的。

    測試虛擬機環(huán)境:

    主機:

    CPU:Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz 4核

    內(nèi)存:1G

    磁盤:SCSI硬盤 10G

    數(shù)據(jù)庫:

    版本:5.6.34

    參數(shù): innodb_buffer_pool_size = 128M、 innodb_io_capacity = 2000

    

    以下是我的測試腳本:cat for_sysbench.sh

#!/bin/sh
time=3600
#0.0
for thread in {16,32,64,128,256}
do
echo "now the number of theads is $thread"
echo "============================================================================================================================================"
/bin/sh /home/linzj/shell/mysql.sh restart
sleep 30
sysbench --test=oltp --mysql-host=192.168.110.100 --mysql-port=3306 --mysql-user=root --mysql-password=root --mysql-db=sbtest1 --oltp-num-tables=10 --oltp-table-size=500000 --report-interval=10  --max-requests=0 --oltp-test-mode=nontrx --oltp-nontrx-mode=select --oltp-read-only=off --max-time=$time --num-threads=$thread run
echo "============================================================================================================================================"
done >> /tmp/sysbench.log.0.0
#1.1
sed -i 's/sync_relay_log=0/sync_relay_log=1/g' /etc/my.cnf 
sed -i 's/sync_binlog=0/sync_binlog=1/g' /etc/my.cnf  
sed -i 's/innodb_flush_log_at_trx_commit = 0/innodb_flush_log_at_trx_commit = 1/g' /etc/my.cnf  
for thread in {32,256}
do
echo "now the number of theads is $thread"
echo "============================================================================================================================================"
/bin/sh /home/linzj/shell/mysql.sh restart
sleep 30
sysbench --test=oltp --mysql-host=192.168.110.100 --mysql-port=3306 --mysql-user=root --mysql-password=root --mysql-db=sbtest1 --oltp-num-tables=10 --oltp-table-size=500000 --report-interval=10  --max-requests=0 --oltp-test-mode=nontrx --oltp-nontrx-mode=select --oltp-read-only=off --max-time=$time --num-threads=$thread run
echo "============================================================================================================================================"
done >> /tmp/sysbench.log.1.1
#100.2
sed -i 's/sync_relay_log=1/sync_relay_log=100/g' /etc/my.cnf
sed -i 's/sync_binlog=1/sync_binlog=100/g' /etc/my.cnf
sed -i 's/innodb_flush_log_at_trx_commit = 1/innodb_flush_log_at_trx_commit = 2/g' /etc/my.cnf
for thread in {32,256}
do
echo "now the number of theads is $thread"
echo "============================================================================================================================================"
/bin/sh /home/linzj/shell/mysql.sh restart
sleep 30
sysbench --test=oltp --mysql-host=192.168.110.100 --mysql-port=3306 --mysql-user=root --mysql-password=root --mysql-db=sbtest1 --oltp-num-tables=10 --oltp-table-size=500000 --report-interval=10  --max-requests=0 --oltp-test-mode=nontrx --oltp-nontrx-mode=select --oltp-read-only=off --max-time=$time --num-threads=$thread run
echo "============================================================================================================================================"
done >> /tmp/sysbench.log.100.2

其實這里測試時間不應(yīng)該只有3600s,表個數(shù)和行數(shù)也不是太大,如果要獲得更為準確的壓測值,建議調(diào)大測試時間、表的行數(shù)和線程并發(fā)數(shù)。

測試出來的數(shù)據(jù)如下:

not  audit_log.sosync_binlog=0  innodb_flush_log_at_trx_commit=0 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128Msync_binlog=1  innodb_flush_log_at_trx_commit=1 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128Msync_binlog=100  innodb_flush_log_at_trx_commit=2 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128M
thread numbertransactions95% response timetransactions95% response timetransactions95% response time
16322134950.25ms294105040.25ms305236650.35ms
32261591900.98ms277098800.66ms269330620.68ms
64832989870.23ms864236340.23ms771570300.27ms
128887151240.34ms908174200.35ms813493620.41ms
256663695202.19ms690104221.98ms715051441.81ms


audit_log.sosync_binlog=0  innodb_flush_log_at_trx_commit=0 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128Msync_binlog=1  innodb_flush_log_at_trx_commit=1 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128Msync_binlog=100  innodb_flush_log_at_trx_commit=2 innodb_io_capacity = 2000  innodb_buffer_pool_size = 128M
thread numbertransactions95% response timetransactions95% response timetransactions95% response time
16286929660.50ms302270400.44ms306352310.43ms
32263502080.69ms267892170.64ms265159250.66ms
64582600780.45ms601292660.41ms626359250.37ms
128613847280.69ms624356970.67ms644553540.59ms
256555601772.83ms556838332.87ms560683422.79ms


從測試的數(shù)據(jù)可以發(fā)現(xiàn):

1、數(shù)據(jù)庫的audit插件的使用,確實損耗了一定的數(shù)據(jù)庫性能,如果以最佳壓測性能的128個線程并發(fā)的數(shù)據(jù)來看,有audit功能的數(shù)據(jù)庫在同等壓測時間下,事務(wù)數(shù)占比少了30%以上,響應(yīng)時間延長了1倍。

2、數(shù)據(jù)庫性能并非同并發(fā)線程數(shù)呈線性關(guān)系,在并發(fā)數(shù)達到128時,事務(wù)數(shù)和響應(yīng)時間均為最佳,接下來再繼續(xù)增加并發(fā),性能反而下降。

3、這里測試數(shù)據(jù)sync_binlog和innodb_flush_log_at_trx_commit為雙1的時候,性能反而最高。這里應(yīng)該是參數(shù)調(diào)整or壓測時間不足導致。至少innodb_buffer_pool_size應(yīng)該調(diào)整為內(nèi)存的80%。所以這份測試數(shù)據(jù)也僅僅作為參考,需要再繼續(xù)調(diào)整參數(shù)后再進行壓測才能得到更為準確的數(shù)值。

看完如何壓測mysql5.6中audit.log插件性能損耗這篇文章后,很多讀者朋友肯定會想要了解更多的相關(guān)內(nèi)容,如需獲取更多的行業(yè)信息,可以關(guān)注我們的行業(yè)資訊欄目。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI