自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL 5.7 vs 8.0,哪個(gè)性能更牛?

數(shù)據(jù)庫(kù) MySQL
測(cè)試mysql5.7和mysql8.0 分別在讀寫、只讀、只寫模式下不同并發(fā)時(shí)的性能(tps,qps)。

 背景

測(cè)試mysql5.7和mysql8.0 分別在讀寫、只讀、只寫模式下不同并發(fā)時(shí)的性能(tps,qps)

前提

  • 測(cè)試使用版本為mysql5.7.22和mysql8.0.15
  •  sysbench測(cè)試前先重啟mysql服務(wù),并清空os的cache(避免多次測(cè)試時(shí)命中緩存)
  •  每次進(jìn)行測(cè)試都是新生成測(cè)試數(shù)據(jù)后再進(jìn)行mysql5.7和mysql8.0的測(cè)試
  •  每次測(cè)試時(shí)保證mysql5.7和mysql8.0的配置參數(shù)一致

環(huán)境

機(jī)器 

  1. cat /etc/redhat-release | xargs echo '版本 ' && dmidecode -s system-product-name | xargs echo '是否虛擬化 ' && cat /proc/cpuinfo |grep "processor"|wc -l | xargs echo 'cpu核數(shù) '  
  2. 版本 CentOS Linux release 7.5.1804 (Core)    
  3. 是否虛擬化 KVM    
  4. cpu核數(shù) 4 

 myql5.7.22 

  1. 5.7.22-log  
  2. innodb_buffer_pool_size 128M  
  3. innodb_log_buffer_size  64M  
  4. innodb_log_file_size    48M  
  5. binlog_format   ROW  
  6. log_bin ON  
  7. transaction_isolation   REPEATABLE-READ 

mysql8.0.15 

  1. 8.0.15 
  2. innodb_buffer_pool_size 128M  
  3. innodb_log_buffer_size  64M  
  4. innodb_log_file_size    48M  
  5. binlog_format   ROW  
  6. log_bin ON  
  7. transaction_isolation   REPEATABLE-READ 

sysbench 

  1. sysbench -V  
  2. sysbench 1.1.0 (using bundled LuaJIT 2.1.0-beta3)

測(cè)試

  •  在不同的持久化策略下(binlog, redo log持久化)mysql5.7和mysql8.0 在讀寫模式、只讀模式、只寫模式(oltp_read_write,oltp_read_only,oltp_write_only)下的性能表現(xiàn)
  •  sysbench 測(cè)試時(shí)間為60s,測(cè)試的表數(shù)量為20
  •  測(cè)試分別在雙1模式(安全性)和0 2模式(高性能)下進(jìn)行

雙1模式下 

  1. SHOW GLOBAL  VARIABLES WHERE Variable_name IN('sync_binlog','innodb_flush_log_at_trx_commit');  
  2. +--------------------------------+-------+  
  3. | Variable_name                  | Value |  
  4. +--------------------------------+-------+  
  5. | innodb_flush_log_at_trx_commit | 1     |  
  6. | sync_binlog                    | 1   |  
  7. +--------------------------------+-------+ 

mysql5.7和mysql8.0 在讀寫模式下的表現(xiàn) 

  •  雙1 配置,讀寫模式下,mysql5.7.22 和mysql8.0.15 tps 、qps 性能差不多,mysql8.0.15 在120 線程并發(fā)時(shí),性能出現(xiàn)了下降抖動(dòng):

mysql5.7和mysql8.0 在只讀模式下的表現(xiàn)   

  • 雙1 配置,只讀模式下,mysql5.7.22 的tps、qps比mysql8.0.15 好1/3 左右;并發(fā)線程數(shù)增加后,tps、qps并沒有隨著增加,反而出現(xiàn)了下降的趨勢(shì)。

mysql5.7和mysql8.0 在只寫模式下的表現(xiàn)

  •  雙1 配置,只寫模式下,隨著并發(fā)數(shù)的上升,mysql5.7.22 的性能比mysql8.0.15 好1/4左右。

0 2 模式下 

  1. SHOW GLOBAL  VARIABLES WHERE Variable_name IN('sync_binlog','innodb_flush_log_at_trx_commit');  
  2. +--------------------------------+-------+  
  3. | Variable_name                  | Value |  
  4. +--------------------------------+-------+  
  5. | innodb_flush_log_at_trx_commit | 2     |  
  6. | sync_binlog                    | 0   |  
  7. +--------------------------------+-------+ 

mysql5.7和mysql8.0 在讀寫模式下的表現(xiàn)   

  • 0 2配置,讀寫模式下,并發(fā)數(shù)低時(shí),mysql5.7.22性能好于mysql8.0.15; 并發(fā)數(shù)比較高時(shí),mysql8.0.15 性能好于mysql5.7.22;在80 線程的并發(fā)以上時(shí),性能開始下降。

mysql5.7和mysql8.0 在只讀模式下的表現(xiàn)

  •  0 2配置,只讀模式下,mysql5.7.22性能比mysql8.0.15 好1/3左右;隨著并發(fā)數(shù)的上升,性能也沒有上升,反而有下降的趨勢(shì).

mysql5.7和mysql8.0 在只寫模式下的表現(xiàn)

  •  0 2 配置,只寫模式下,mysql5.7.22的tps 抖動(dòng)比較大;mysql5.7.22 的qps比mysql8.0.15好1/3左右

結(jié)論

  •  整體來看,mysql5.7.22在讀寫模式、只讀模式、只寫模式下的表現(xiàn)是優(yōu)于mysql8.0.15的
  •  隨著并行數(shù)的增加,性能表現(xiàn)不會(huì)也跟著增加,還會(huì)出現(xiàn)下降
  •  本次測(cè)試結(jié)果是在配置很低的情況下進(jìn)行的,不代表絕對(duì)

注意

sysbench 需要設(shè)置--db-ps-mode=disable 禁用預(yù)編譯語句,不然并發(fā)測(cè)試線程多時(shí)會(huì)報(bào)下面的錯(cuò)誤 

  1. FATAL: mysql_stmt_prepare() failed  
  2. FATAL: MySQL error: 1461 "Can't create more than max_prepared_stmt_count statements (current value: 16382)"  
  3. FATAL: mysql_stmt_prepare() failed  
  4. FATAL: MySQL error: 1461 "Can't create more than max_prepared_stmt_count statements (current value: 16382)"  
  5. FATAL: thread_init' function failed: /usr/local/share/sysbench/oltp_common.lua:288: SQL API error FATAL: mysql_stmt_prepare() failed FATAL: MySQL error: 1461 "Can't create more than max_prepared_stmt_count statements (current value: 16382)" FATAL:thread_init' function failed: /usr/local/share/sysbench/oltp_common.lua:288: SQL API error 
  6. FATAL: mysql_stmt_prepare() failed 

使用腳本 

  1. cat sysbench_test_mysql5.7_8.0_tps_qps.sh  
  2. #!/bin/bash  
  3. #用于sysbench 測(cè)試在讀寫模式、只讀模式、只寫模式下 mysql5.7和mysql8.0 的tps,qps  
  4. #nohup bash $0 >/tmp/sysbench_test 2>& 1 &  
  5.  
  6. user=admin  
  7. passwd=admin  
  8. ports="8015 57222"  
  9. host=127.0.0.1  
  10. sysbench_test_mode="oltp_read_write oltp_read_only oltp_write_only"  
  11. sysbench_test_info_path=/tmp/sysbench-test  
  12. function red_echo () {  
  13.         local what="$*"  
  14.         echo -e "$(date +%F-%T) \e[1;31m ${what} \e[0m"  
  15.  
  16. function check_las_comm(){  
  17.     if [ $1 -ne 0 ];then  
  18.         red_echo $2  
  19.         exit 1  
  20.     fi  
  21.  
  22. function  restart_mysqld(){  
  23.   service mysqld${1} restart  
  24.   sleep 2  
  25.  
  26. function  purge_binlog(){  
  27. port=$1  
  28. mysql -u$user -p$passwd -P$port -h$host<<EOF  
  29. purge binary logs before now();  
  30. EOF  
  31.  
  32. function clean_os_cache(){  
  33.   echo 3 > /proc/sys/vm/drop_caches  
  34.  
  35. function  sysbench_with_diff_thread(){  
  36. thread_num=$1  
  37. port=$2  
  38. order=$3  
  39. test_mode=$4  
  40. sysbench /usr/local/share/sysbench/${test_mode}.lua --mysql_storage_engine=innodb  --table-size=100000 --tables=20 --mysql-db=test_1 --mysql-user=$user --mysql-password=$passwd --mysql-port=$port  --mysql-host=$host --threads=$thread_num  --time=60 --report-interval=2 --db-ps-mode=disable --events=0 --db-driver=mysql $order 
  41. function  main(){  
  42. for test_mode in $sysbench_test_mode;do  
  43.   for port in $ports;do  
  44.     for thread_num in {5,10,20,30,40,80,120,200};do  
  45.       restart_mysqld "$port"  
  46.       check_las_comm  "$?" "restart mysqld${port} failed "  
  47.       clean_os_cache  
  48.       purge_binlog "$port"  
  49.       red_echo "sysbench $thread_num  threads cleanup mysqld${port}"  
  50.       sysbench_with_diff_thread "$thread_num" "$port" "cleanup" "$test_mode">/dev/null  
  51.       red_echo "sysbench $thread_num  threads prepare mysqld${port}"  
  52.       sysbench_with_diff_thread "$thread_num" "$port" "prepare" "$test_mode">/dev/null  
  53.       mkdir -p $sysbench_test_info_path  
  54.       red_echo "sysbench $thread_num  threads run mysqld${port} $test_mode"  
  55.       sysbench_with_diff_thread "$thread_num" "$port" "run" "$test_mode" > $sysbench_test_info_path/${test_mode}_${thread_num}_$port  
  56.       # service mysqld{port} stop  
  57.     done  
  58.   done  
  59. done  
  60.  
  61. main 

 【編輯推薦】

 

責(zé)任編輯:龐桂玉 來源: 民工哥技術(shù)之路
相關(guān)推薦

2019-09-24 13:53:19

MySQLMySQL 8.0數(shù)據(jù)庫(kù)

2022-05-23 09:11:18

AngularBlazor前端

2019-03-01 09:36:25

ReactAngular開發(fā)

2016-01-11 11:56:14

jQueryAngularJS

2024-02-26 07:39:16

2009-09-30 10:30:19

FreeBSD 8.0Ubuntu 9.10性能測(cè)試

2021-05-31 10:16:04

代碼Java工具

2020-12-31 05:35:53

MySQL 8.0MySQL 5.7JSON

2020-07-31 13:55:57

MySQL數(shù)據(jù)庫(kù)DBA

2024-04-18 09:00:00

MySQL數(shù)據(jù)庫(kù)

2023-05-12 08:04:11

2023-12-11 07:37:08

mongodb經(jīng)緯度性能

2021-12-01 10:18:08

MongoDBMySQL數(shù)據(jù)庫(kù)

2023-05-03 21:34:34

MySQL狀態(tài)變量

2023-06-20 12:02:39

WhileFor(;;)

2012-05-22 14:26:10

Windows 8顯示器

2013-03-25 11:27:13

Windows Blu

2021-09-10 11:12:50

開發(fā)技能代碼

2022-01-17 07:50:36

Maven Gradle 工具
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)