Docker中IO、MariaDB的性能测试

每准备使用新东西前需要考虑它有什么功能,耐不耐用,性能好不好,不盲目追新,也不无缘无故排斥。

主要任务
一:Docker中IO、MariaDB的性能测试
二:并宿主机进行对比
Docker version 1.12.1
操作系统:CentOS7.2
内存:32G
CPU:Intel(R) Xeon(R) CPU E5-2603 v3 @ 1.60GHz 1颗6核

  1. Docker中磁盘IO的性能测试
sysbench --test=fileio --file-num=16 --file-block-size=16384 --file-total-size=2G --num-threads=4 --file-test-mode=rndrd --max-requests=100000000 --max-time=180 --file-extra-flags=direct prepare
sysbench --test=fileio --file-num=16 --file-block-size=16384 --file-total-size=2G --num-threads=4 --file-test-mode=rndrd --max-requests=100000000 --max-time=180 --file-extra-flags=direct run
#其他类型的读写-只要改成file-test-mode即可seqwr 顺序写 、seqrewr 连续改写 、seqrd 连续读 、rndrd 随机读取 、rndwr 随机写 、rndrw 结合随机读/写 
sysbench --test=fileio --file-num=16 --file-block-size=16384 --file-total-size=2G --num-threads=4 --file-test-mode=rndrd --max-requests=100000000 --max-time=180 --file-extra-flags=direct cleanup

重要:测试写不需要准备数据,测试读时一定要将文件数据都准备好。

Docker中IO、MariaDB的性能测试_第1张图片
Paste_Image.png
从数据可看出是在Docker进行文件操作时和跟在宿主机上操作差不了多少。

  1. Docker中MariaDB的性能测试
    本地磁盘和docker挂载磁盘上mariaDB的性能比较


    Docker中IO、MariaDB的性能测试_第2张图片
    Sysbench OLTP read only compare.jpg

    Docker中IO、MariaDB的性能测试_第3张图片
    Sysbench OLTP read-write compare.jpg

    可以看出在docker上运行的性能比本地要差点,但差别的数据在可接受范围内。

有兴趣的同学-还可以顺带测试下memory和cpu,我得到结果是native是稍微比docker差点,支持这个理论依据是什么?看来是时候重读理论啦。

sysbench --test=memory --num-threads=16 --memory-block-size=8192 --memory-total-size=8G run
sysbench --test=cpu --cpu-max-prime=20000 run
#native
sysbench 0.5:  multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Random number generator seed is 0 and will be ignored
Prime numbers limit: 20000
Initializing worker threads...
Threads started!
General statistics:
    total time:                          56.4280s
    total number of events:              10000
    total time taken by event execution: 56.4238s
    response time:
         min:                                  5.46ms
         avg:                                  5.64ms
         max:                                  7.52ms
         approx.  95 percentile:               5.65ms
Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   56.4238/0.00
#docker
sysbench 0.5:  multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Random number generator seed is 0 and will be ignored
Prime numbers limit: 20000
Initializing worker threads...
Threads started!
General statistics:
    total time:                          56.0816s
    total number of events:              10000
    total time taken by event execution: 56.0777s
    response time:
         min:                                  5.60ms
         avg:                                  5.61ms
         max:                                  7.52ms
         approx.  95 percentile:               5.61ms
Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   56.0777/0.00

你可能感兴趣的:(Docker中IO、MariaDB的性能测试)