zoukankan      html  css  js  c++  java
  • 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亿还是可以。

  • 相关阅读:
    11.【nuxt起步】-登录验证
    10.【nuxt起步】-引用mintui
    9.【nuxt起步】-scroll分页加载
    8.【nuxt起步】-vue组件之间数据交互
    7.【nuxt起步】-Nuxt与后端数据交互
    6.【nuxt起步】-完成一个静态的页面
    5.【nuxt起步】-swiper组件
    4.【nuxt起步】-具体练习一个h5实例
    3.【nuxt起步】-下面以一个SPA单页程序为例子
    2.【nuxt起步】-初始化创建nuxt项目
  • 原文地址:https://www.cnblogs.com/sunss/p/2452559.html
Copyright © 2011-2022 走看看