zoukankan      html  css  js  c++  java
  • 使用 sysbench对mysql进行压力测试介绍之二

    上篇说到在这个服务器上安装mysql 5.5.16老是启动就crashed,设置参数innodb_native_aio = off也没有用。主要是因为内核参数没有设置好,须增加与异步相关的设置:
    fs.aio-max-nr = 3145728
     
    同时innodb的参数还是一样:
     
    innodb_log_file_size = 200M
    innodb_log_files_in_group = 3
    innodb_buffer_pool_size = 2048M
    innodb_log_buffer_size = 16M
    innodb_additional_mem_pool_size = 60M
    innodb_flush_log_at_trx_commit = 2
    innodb_lock_wait_timeout = 50
    innodb_thread_concurrency = 0
    query_cache_size = 0
    init_connect='SET autocommit=0'
     
    从下面看出TPS确实比5.1有很大的提高,同时对多cpu的利用也更加充分
     
    [root@testdb2 bin]# ./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=sbtest --mysql-password=123456 --mysql-host=localhost --mysql-socket=/var/lib/mysql/mysql.sock --num-threads=20 --max-requests=100000 --oltp-test-mode=complex run

    sysbench 0.4.12:  multi-threaded system evaluation benchmark
    No DB drivers specified, using mysql
    Running the test with following options:
    Number of threads: 20
    Doing OLTP test.
    Running mixed OLTP test
    Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
    Using "BEGIN" for starting transactions
    Using auto_inc on the id column
    Maximum number of requests for OLTP test is limited to 100000
    Threads started!
    Done.
    OLTP test statistics:
        queries performed:
            read:                            1400140
            write:                           500050
            other:                           200020
            total:                           2100210
        transactions:                        100010 (2031.71 per sec.)
        deadlocks:                           0      (0.00 per sec.)
        read/write requests:                 1900190 (38602.54 per sec.)
        other operations:                    200020 (4063.43 per sec.)
    Test execution summary:
        total time:                          49.2245s
        total number of events:              100010
        total time taken by event execution: 982.9139
        per-request statistics:
             min:                                  2.48ms
             avg:                                  9.83ms
             max:                               1001.61ms
             approx.  95 percentile:              19.33ms
    Threads fairness:
        events (avg/stddev):           5000.5000/172.07
        execution time (avg/stddev):   49.1457/0.02
     
    [root@testdb2 bin]# ./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=1000000 --mysql-user=sbtest --mysql-password=123456 --mysql-host=localhost --mysql-socket=/var/lib/mysql/mysql.sock --num-threads=15 --max-requests=100000 --oltp-test-mode=complex run 

    sysbench 0.4.12:  multi-threaded system evaluation benchmark
    No DB drivers specified, using mysql
    Running the test with following options:
    Number of threads: 15
    Doing OLTP test.
    Running mixed OLTP test
    Using Special distribution (12 iterations,  1 pct of values are returned in 75 pct cases)
    Using "BEGIN" for starting transactions
    Using auto_inc on the id column
    Maximum number of requests for OLTP test is limited to 100000
    Threads started!
    Done.
    OLTP test statistics:
        queries performed:
            read:                            1400084
            write:                           500030
            other:                           200012
            total:                           2100126
        transactions:                        100006 (2075.49 per sec.)
        deadlocks:                           0      (0.00 per sec.)
        read/write requests:                 1900114 (39434.40 per sec.)
        other operations:                    200012 (4150.99 per sec.)
    Test execution summary:
        total time:                          48.1842s
        total number of events:              100006
        total time taken by event execution: 721.1929
        per-request statistics:
             min:                                  2.70ms
             avg:                                  7.21ms
             max:                                997.79ms
             approx.  95 percentile:               8.92ms
    Threads fairness:
        events (avg/stddev):           6667.0667/136.28
        execution time (avg/stddev):   48.0795/0.03
    下面是cpu的使用情况,比较充分的利用了多个cpu的能力:
     
    procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
     r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
    24  0 1575868  37612 115372 27004044    0    0     0  3004 8835 169704 46 34 20  0  0
    18  0 1575868  36744 115380 27004204    0    0     4  2720 7426 171943 44 35 20  0  0
    23  0 1575868  36620 115396 27004212    0    0     4  2960 7271 162067 45 36 19  0  0
    21  0 1575868  36620 115396 27004212    0    0     0     4 6649 173904 47 42 11  0  0
    26  0 1575868  36992 115412 27004216    0    0     0  3928 7743 177347 46 41 14  0  0
     9  0 1575868  36496 115428 27004204    0    0    12  2468 8154 175983 43 40 17  0  0
    26  0 1575868  36496 115444 27004228    0    0     4  2416 9160 172780 46 38 16  0  0
    24  0 1575868  36248 115460 27004212    0    0     0  2716 7968 174385 49 37 15  0  0
    26  0 1575868  35876 115476 27004236    0    0     0  2504 7406 181327 49 42  9  0  0
    27  0 1575868  35876 115492 27004220    0    0     0  2616 6903 182099 48 39 13  0  0
    21  0 1575868  36000 115508 27004236    0    0     4  2824 8915 174273 45 40 15  0  0
    23  0 1575868  36620 115524 27004220    0    0     0  2508 7299 175947 45 41 14  0  0
    25  0 1575868  36620 115540 27004240    0    0     0  2480 8489 178815 44 43 12  0  0
    27  0 1575868  36736 115556 27004224    0    0     0  2852 7201 172072 43 43 14  0  0
    22  0 1575868  36000 115584 27004228    0    0     0  3020 7271 177431 43 40 17  0  0
    27  0 1575868  36248 115584 27004232    0    0     0  2584 8935 176867 49 30 21  0  0
    16  0 1575868  36000 115592 27004264    0    0     0  2628 7144 164690 52 29 20  0  0
    17  0 1575868  35480 115616 27004240    0    0     0  3028 7813 170283 49 37 14  0  0
    28  0 1575868  29664 115640 27004692    0    0   204  3348 8833 163507 44 44 11  0  0
    27  0 1575868  30068 115648 26998316    0    0    88  3384 7921 157621 44 42 13  1  0
    22  0 1575864  40552 115656 26992500    4    0    92  2860 6497 128295 36 53 10  0  0
    21  0 1575864  33732 115672 26993368    0    0    28  3320 6950 161859 46 43 11  0  0
    25  0 1575792  30244 115692 26993440   20    0    32  2632 7703 147772 39 51 10  0  0
    22  0 1575792  46520 115700 26993604    0    0     4  2048 8538 150350 38 49 13  0  0
    27  0 1575792  46892 115704 26993628    0    0     0  2728 10178 180623 47 39 14  0  0
     
     
    top - 10:00:02 up 267 days, 22:37,  4 users,  load average: 3.67, 0.90, 0.35
    Tasks: 765 total,   2 running, 763 sleeping,   0 stopped,   0 zombie
    Cpu0  : 40.7%us, 43.3%sy,  0.0%ni, 15.4%id,  0.3%wa,  0.0%hi,  0.0%si,  0.3%st
    Cpu1  : 40.8%us, 44.1%sy,  0.0%ni, 14.4%id,  0.0%wa,  0.0%hi,  0.3%si,  0.3%st
    Cpu2  : 39.7%us, 46.6%sy,  0.0%ni, 13.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu3  : 45.9%us, 41.6%sy,  0.0%ni, 11.8%id,  0.0%wa,  0.0%hi,  0.3%si,  0.3%st
    Cpu4  : 39.5%us, 43.1%sy,  0.0%ni, 17.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu5  : 25.6%us, 28.9%sy,  0.0%ni, 45.2%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu6  : 43.8%us, 42.8%sy,  0.0%ni, 12.7%id,  0.0%wa,  0.0%hi,  0.7%si,  0.0%st
    Cpu7  : 38.2%us, 45.4%sy,  0.0%ni, 15.4%id,  0.0%wa,  0.0%hi,  0.7%si,  0.3%st
    Cpu8  : 44.7%us, 44.7%sy,  0.0%ni, 10.2%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st
    Cpu9  : 36.3%us, 48.4%sy,  0.0%ni, 15.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Cpu10 : 37.3%us, 42.6%sy,  0.0%ni, 19.8%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st
    Cpu11 : 43.0%us, 43.0%sy,  0.0%ni, 13.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.3%st
    Cpu12 : 45.4%us, 42.2%sy,  0.0%ni, 12.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.3%st
    Cpu13 : 40.2%us, 41.2%sy,  0.0%ni, 18.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.3%st
    Cpu14 : 39.4%us, 42.3%sy,  0.0%ni, 17.6%id,  0.0%wa,  0.0%hi,  0.7%si,  0.0%st
    Cpu15 : 46.4%us, 41.1%sy,  0.0%ni, 12.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:  32628736k total, 32597064k used,    31672k free,   115176k buffers
    Swap: 104856244k total,  1575868k used, 103280376k free, 27011068k cached
  • 相关阅读:
    map/reduce/filter/lambda
    DHCP Option43配置
    函数的参数
    通用路由封装协议——GRE
    spring 中使用quartz实现定时任务
    自己实现的简单的grid
    Java 中 Double 相关问题
    爬坑纪——RESTful WCF
    Hi,UEditor——百度编辑器配置若干
    去除ColumnChart自带的阴影效果
  • 原文地址:https://www.cnblogs.com/duanxz/p/2808419.html
Copyright © 2011-2022 走看看