MySQL 5.7 vs 8.0,性能PK


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

cat sysbench_test_mysql5.7_8.0_tps_qps.sh

#!/bin/bash

#用于sysbench 测试在读写模式、只读模式、只写模式下 mysql5.7和mysql8.0 的tps,qps

#nohup bash $0 >/tmp/sysbench_test 2>& 1 &

#

user=admin

passwd=admin

ports="8015 57222"

host=127.0.0.1

sysbench_test_mode="oltp_read_write oltp_read_only oltp_write_only"

sysbench_test_info_path=/tmp/sysbench-test

function red_echo () {

        local what="$*"

        echo -e "$(date +%F-%T) e[1;31m ${what} e[0m"

}

function check_las_comm(){

    if [ $1 -ne 0 ];then

        red_echo $2

        exit 1

    fi

}

function  restart_mysqld(){

  service mysqld${1} restart

  sleep 2

}

function  purge_binlog(){

port=$1

mysql -u$user -p$passwd -P$port -h$host<<EOF

purge binary logs before now();

EOF

}

function clean_os_cache(){

  echo 3 > /proc/sys/vm/drop_caches

}

function  sysbench_with_diff_thread(){

thread_num=$1

port=$2

order=$3

test_mode=$4

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

}

function  main(){

for test_mode in $sysbench_test_mode;do

  for port in $ports;do

    for thread_num in {5,10,20,30,40,80,120,200};do

      restart_mysqld "$port"

      check_las_comm  "$?" "restart mysqld${port} failed "

      clean_os_cache

      purge_binlog "$port"

      red_echo "sysbench $thread_num  threads cleanup mysqld${port}"

      sysbench_with_diff_thread "$thread_num" "$port" "cleanup" "$test_mode">/dev/null

      red_echo "sysbench $thread_num  threads prepare mysqld${port}"

      sysbench_with_diff_thread "$thread_num" "$port" "prepare" "$test_mode">/dev/null

      mkdir -p $sysbench_test_info_path

      red_echo "sysbench $thread_num  threads run mysqld${port} $test_mode"

      sysbench_with_diff_thread "$thread_num" "$port" "run" "$test_mode" > $sysbench_test_info_path/${test_mode}_${thread_num}_$port

      # service mysqld{port} stop

    done

  done

done

}

main复制代码

更多相关免费学习推荐:mysql教程(视频)

以上就是MySQL 5.7 vs 8.0,性能PK的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

mysql如何替换掉字母

mysql 数据汇总与分组

mysql innodb索引原理的详细介绍(代码示例)

mysql optimizer是什么

浅谈mysql join底层原理

mysql怎么给字符串字段加索引

mysql单表容量有多少

mysql添加用户可访问不了怎么办

pandas操作mysql的方法详解

excel数据导入mysql数据库的实现方法

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...