• innodb大表数据测试


    有这样一个业务场景,数据的写入就是回流,平常都是依赖user_id查询,数据大概5亿左右,因此我做了下测试,测试过程如下:

    性能测试机的环境:

    View Code
          Uptime | 364 days, 4:02, 2 users, load average: 0.43, 0.19, 0.06
        Platform | Linux
         Release | Red Hat Enterprise Linux Server release 5.4 (Tikanga)
          Kernel | 2.6.18-164.el5
    Architecture | CPU = 64-bit, OS = 64-bit
       Threading | NPTL 2.5
        Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-44).
         SELinux | Disabled
     Virtualized | No virtualization detected
    # Processor ##################################################
      Processors | physical = 2, cores = 8, virtual = 16, hyperthreading = yes
          Speeds | 16x2261.063
          Models | 16xIntel(R) Xeon(R) CPU E5520 @ 2.27GHz
          Caches | 16x8192 KB
    # Memory #####################################################
           Total | 23.53G
            Free | 106.74M
            Used | physical = 23.43G, swap = 5.02M, virtual = 23.43G
         Buffers | 165.41M
          Caches | 4.78G
           Dirty | 572 kB
         UsedRSS | 18.3G
      Swappiness | vm.swappiness = 60
     DirtyPolicy | vm.dirty_ratio = 40, vm.dirty_background_ratio = 10

    MySQL的版本5.1.48

    2.5亿数据测试:

    数据准备:

    ./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=250000000 --mysql-user=lingluo --mysql-password=lingluo --mysql-socket=/u01/mysql/run/mysql.sock prepare

    执行:

    View Code
    $./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=250000000 --oltp-read-only --mysql-user=root --mysql-socket=/u01/mysql/run/mysql.sock 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: 1
    
    Doing OLTP test.
    Running mixed OLTP test
    Doing read-only 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 10000
    Threads started!
    Done.
    
    OLTP test statistics:
        queries performed:
            read:                            140000
            write:                           0
            other:                           20000
            total:                           160000
        transactions:                        10000  (61.46 per sec.)
        deadlocks:                           0      (0.00 per sec.)
        read/write requests:                 140000 (860.42 per sec.)
        other operations:                    20000  (122.92 per sec.)
    
    Test execution summary:
        total time:                          162.7105s
        total number of events:              10000
        total time taken by event execution: 162.6381
        per-request statistics:
             min:                                  2.86ms
             avg:                                 16.26ms
             max:                                280.82ms
             approx.  95 percentile:              33.86ms
    
    Threads fairness:
        events (avg/stddev):           10000.0000/0.00
        execution time (avg/stddev):   162.6381/0.00

    数据清理:

    $./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=250000000 --mysql-user=root --mysql-socket=/u01/mysql/run/mysql.sock cleanup
    sysbench 0.4.12:  multi-threaded system evaluation benchmark
    
    No DB drivers specified, using mysql
    Dropping table 'sbtest'...
    Done.

    5亿数据测试:

    数据准备:

    ./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=500000000 --mysql-user=lingluo --mysql-password=lingluo --mysql-socket=/u01/mysql/run/mysql.sock prepare

    执行:

    View Code
    $./sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=500000000 --oltp-read-only --mysql-user=root --mysql-socket=/u01/mysql/run/mysql.sock 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: 1
    
    Doing OLTP test.
    Running mixed OLTP test
    Doing read-only 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 10000
    Threads started!
    Done.
    
    OLTP test statistics:
        queries performed:
            read:                            140000
            write:                           0
            other:                           20000
            total:                           160000
        transactions:                        10000  (14.27 per sec.)
        deadlocks:                           0      (0.00 per sec.)
        read/write requests:                 140000 (199.83 per sec.)
        other operations:                    20000  (28.55 per sec.)
    
    Test execution summary:
        total time:                          700.6116s
        total number of events:              10000
        total time taken by event execution: 700.5176
        per-request statistics:
             min:                                 12.31ms
             avg:                                 70.05ms
             max:                                445.24ms
             approx.  95 percentile:             110.52ms
    
    Threads fairness:
        events (avg/stddev):           10000.0000/0.00
        execution time (avg/stddev):   700.5176/0.00

    清理数据

    结论:

    5亿的数据,95%的范围还是在111ms之内,稍微慢了点,2亿的数据,95%的查询时间范围在34ms,速度还可以接受。在这个场景下,单表数据量2亿还是可以。

  • 相关阅读:
    js array 排序
    element 右键菜单
    Element ui tree 搜索
    threejs CameraHelper 查看照相机的观察范围
    android 错误解决
    数据结构学习--数组
    js 遍历树的层级关系的实现
    一篇文章理清WebGL绘制流程
    最基础的CSS面试题
    display:flex;多行多列布局学习
  • 原文地址:https://www.cnblogs.com/sunss/p/2452559.html
Copyright © 2020-2023  润新知