美文网首页
阿里云1C2G性能基准测试

阿里云1C2G性能基准测试

作者: 一剑光寒十九洲 | 来源:发表于2019-07-15 15:12 被阅读0次

    CPU

    系统信息

    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                1
    On-line CPU(s) list:   0
    Thread(s) per core:    1
    Core(s) per socket:    1
    座:                 1
    NUMA 节点:         1
    厂商 ID:           GenuineIntel
    CPU 系列:          6
    型号:              79
    型号名称:        Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
    步进:              1
    CPU MHz:             2494.222
    BogoMIPS:            4988.44
    超管理器厂商:  KVM
    虚拟化类型:     完全
    L1d 缓存:          32K
    L1i 缓存:          32K
    L2 缓存:           256K
    L3 缓存:           40960K
    NUMA 节点0 CPU:    0
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt spec_ctrl intel_stibp
    

    基准测试

    sysbench --events=5000 --cpu-max-prime=10000 cpu run
    
    Running the test with following options:
    Number of threads: 1
    Initializing random number generator from current time
    
    
    Prime numbers limit: 10000
    
    Initializing worker threads...
    
    Threads started!
    
    CPU speed:
        events per second:   946.17
    
    General statistics:
        total time:                          5.2826s
        total number of events:              5000
    
    Latency (ms):
             min:                                    1.04
             avg:                                    1.06
             max:                                    8.10
             95th percentile:                        1.08
             sum:                                 5278.34
    
    Threads fairness:
        events (avg/stddev):           5000.0000/0.00
        execution time (avg/stddev):   5.2783/0.00
    

    执行5000次素数计算(素数上限10000),总执行时间5.2783秒,每条完成946.17次素数计算,平均每次素数计算完成时间为1.06ms,95%的素数计算在1.08ms内完成。

    内存

    系统信息

    free -h
                  total        used        free      shared  buff/cache   available
    Mem:           1.8G        831M        764M        1.2M        241M        843M
    Swap:          1.0G          0B        1.0G
    

    基准测试

    [root@izuf62iqgz8u2rtutismxez mem]# sysbench --memory-block-size=8K --memory-total-size=100G  --threads=1 memory run
    sysbench 1.0.17 (using system LuaJIT 2.0.4)
    
    Running the test with following options:
    Number of threads: 1
    Initializing random number generator from current time
    
    
    Running memory speed test with the following options:
      block size: 8KiB
      total size: 102400MiB
      operation: write
      scope: global
    
    Initializing worker threads...
    
    Threads started!
    
    Total operations: 13107200 (1322607.28 per second)
    
    102400.00 MiB transferred (10332.87 MiB/sec)
    
    
    General statistics:
        total time:                          9.9082s
        total number of events:              13107200
    
    Latency (ms):
             min:                                    0.00
             avg:                                    0.00
             max:                                    1.37
             95th percentile:                        0.00
             sum:                                 7924.22
    
    Threads fairness:
        events (avg/stddev):           13107200.0000/0.00
        execution time (avg/stddev):   7.9242/0.00
    

    可以看到,内存传输速率大约为10G/s。

    磁盘

    系统信息

    cat /sys/block/vda/queue/rotational
    1
    
    fdisk -l
    磁盘 /dev/vda:42.9 GB, 42949672960 字节,83886080 个扇区
    Units = 扇区 of 1 * 512 = 512 bytes
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x0008de3e
       设备 Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048    83884031    41940992   83  Linux
    

    40G的高效云盘(HDD和SSD混合设备:HHD)

    基准测试

    sysbench --file-total-size=10G --num-threads=8  --file-test-mode=rndrw fileio run
    
    Running the test with following options:
    Number of threads: 8
    Report intermediate results every 1 second(s)
    Initializing random number generator from current time
    
    Extra file open flags: (none)
    128 files, 80MiB each
    10GiB total file size
    Block size 16KiB
    Number of IO requests: 0
    Read/Write ratio for combined random IO test: 1.50
    Periodic FSYNC enabled, calling fsync() each 100 requests.
    Calling fsync() at the end of test, Enabled.
    Using synchronous I/O mode
    Doing random r/w test
    Initializing worker threads...
    
    Threads started!
    
    File operations:
        reads/s:                      2070.20
        writes/s:                     1379.63
        fsyncs/s:                     4508.38
    
    Throughput:
        read, MiB/s:                  32.35
        written, MiB/s:               21.56
    
    General statistics:
        total time:                          10.0206s
        total number of events:              78735
    
    Latency (ms):
             min:                                    0.00
             avg:                                    1.02
             max:                                   97.11
             95th percentile:                        2.18
             sum:                                79952.87
    
    Threads fairness:
        events (avg/stddev):           9841.8750/79.75
        execution time (avg/stddev):   9.9941/0.00
    

    可以看到,对128*80M=10G的文件随机读写测试中,随机读iops为2070,随机写iops为1379,读吞吐量为32.35M,写吞吐量为21.56M,平响为1.02ms,百分之九十五的请求在2.18ms内完成。

    POSIX线程

    基准测试

    sysbench --threads=64 --thread-yields=1000 --thread-locks=8 threads run
    
    Running the test with following options:
    Number of threads: 64
    Initializing random number generator from current time
    
    Initializing worker threads...
    
    Threads started!
    
    General statistics:
        total time:                          10.1310s
        total number of events:              5139
    
    Latency (ms):
             min:                                    1.40
             avg:                                  125.23
             max:                                 1603.01
             95th percentile:                      475.79
             sum:                               643542.67
    
    Threads fairness:
        events (avg/stddev):           80.2969/12.13
        execution time (avg/stddev):   10.0554/0.04
    

    以64个线程执行"加锁-让出-解锁"操作,每次该操作的平均响应时间为125.23ms,95%的操作能够在475.79内完成。

    互斥锁

    基准测试

    sysbench --mutex-num=4096 --mutex-locks=50000 --mutex-loops=10000 mutex run
    
    sysbench 1.0.17 (using system LuaJIT 2.0.4)
    
    Running the test with following options:
    Number of threads: 1
    Initializing random number generator from current time
    
    
    Initializing worker threads...
    
    Threads started!
    
    
    General statistics:
        total time:                          0.1862s
        total number of events:              1
    
    Latency (ms):
             min:                                  186.02
             avg:                                  186.02
             max:                                  186.02
             95th percentile:                      186.54
             sum:                                  186.02
    
    Threads fairness:
        events (avg/stddev):           1.0000/0.00
        execution time (avg/stddev):   0.1860/0.00
    
    

    完成整个操作的花费的时间为186.02ms。

    MySQL

    基准测试

    sysbench --table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=xxx --mysql-host=127.0.0.1 --mysql-port=3306 --db-driver=mysql oltp_read_write prepare
    
    mysql root@127.0.0.1:test> show create table sbtest1;
    +---------+----------------------------------------------------------------+
    | Table   | Create Table                                                   |
    +---------+----------------------------------------------------------------+
    | sbtest1 | CREATE TABLE `sbtest1` (                                       |
    |         |   `id` int(11) NOT NULL AUTO_INCREMENT,                        |
    |         |   `k` int(11) NOT NULL DEFAULT '0',                            |
    |         |   `c` char(120) NOT NULL DEFAULT '',                           |
    |         |   `pad` char(60) NOT NULL DEFAULT '',                          |
    |         |   PRIMARY KEY (`id`),                                          |
    |         |   KEY `k_1` (`k`)                                              |
    |         | ) ENGINE=InnoDB AUTO_INCREMENT=1000001 DEFAULT CHARSET=utf8mb4 |
    +---------+----------------------------------------------------------------+
    
    sysbench --threads=8 --table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=1fba8913b066a8b9 --mysql-host=127.0.0.1 --mysql-port=3306 --db-driver=mysql oltp_read_write run
    
    
    Running the test with following options:
    Number of threads: 8
    Initializing random number generator from current time
    
    Initializing worker threads...
    
    Threads started!
    
    SQL statistics:
        queries performed:
            read:                            33208
            write:                           9486
            other:                           4743
            total:                           47437
        transactions:                        2371   (236.69 per sec.)
        queries:                             47437  (4735.51 per sec.)
        ignored errors:                      1      (0.10 per sec.)
        reconnects:                          0      (0.00 per sec.)
    
    General statistics:
        total time:                          10.0154s
        total number of events:              2371
    
    Latency (ms):
             min:                                   14.89
             avg:                                   33.77
             max:                                   84.55
             95th percentile:                       40.37
             sum:                                80072.17
    
    Threads fairness:
        events (avg/stddev):           296.3750/1.32
        execution time (avg/stddev):   10.0090/0.00
    

    通过测试可以看到:在8个线程时,TPS为236.69,QPS为4735.51,平均响应时间为33.77ms,95%响应时间为40.37ms。

    参考资料:

    相关文章

      网友评论

          本文标题:阿里云1C2G性能基准测试

          本文链接:https://www.haomeiwen.com/subject/hlpnkctx.html