zoukankan      html  css  js  c++  java
  • 【原创】运维基础之Docker(6)性能

    The general result is that Docker is nearly identical to Native performance and faster than KVM in every category.

    1 CPU

    2 Memory

     

    3 Network

    Docker’s use of bridging and NAT noticeably increases the transmit path length; vhost-net is fairly efficient at transmitting but has high overhead on the receive side. Containers that do not use NAT have identical performance to native Linux.

    NAT, as used in Docker, doubles latency in this test. KVM adds 30µs of overhead to each transaction compared to the non-virtualized network stack, an increase of 80%.

    4 Disk

     

    5 Other

    5.1 redis

    5.2 mysql

    可见除了Network之外,docker非常接近native,
    带宽测试:nuttcp (http://www.nuttcp.net/)
    延迟测试:netperf (http://netperf.org/netperf/)
    而docker network中常用的host和bridge差别也很大,对nginx压测数据如下:

    1)native

    # ./http_load -p 10 -s 10 urls/raw_nginx.urls
    274791 fetches, 10 max parallel, 1.78339e+08 bytes, in 10.0001 seconds
    649 mean bytes/connection
    27478.9 fetches/sec, 1.78338e+07 bytes/sec
    msecs/connect: 0.0345773 mean, 0.445 max, 0.011 min
    msecs/first-response: 0.310406 mean, 1.026 max, 0.088 min
    HTTP response codes:
    code 200 -- 274791

    2)docker network-host

    # ./http_load -p 10 -s 10 urls/docker_host_nginx.urls
    202773 fetches, 10 max parallel, 1.316e+08 bytes, in 10 seconds
    649 mean bytes/connection
    20277.3 fetches/sec, 1.31599e+07 bytes/sec
    msecs/connect: 0.0426044 mean, 0.897 max, 0.013 min
    msecs/first-response: 0.423675 mean, 1.401 max, 0.076 min
    HTTP response codes:
    code 200 -- 202773

    3)docker network-bridge

    # ./http_load -p 10 -s 10 urls/docker_bridge_nginx.urls
    80282 fetches, 10 max parallel, 5.2103e+07 bytes, in 10 seconds
    649 mean bytes/connection
    8028.2 fetches/sec, 5.2103e+06 bytes/sec
    msecs/connect: 0.0522431 mean, 0.489 max, 0.014 min
    msecs/first-response: 1.17323 mean, 10.748 max, 0.122 min
    HTTP response codes:
    code 200 -- 80282

    几种部署的nginx结果如下:使用native可以达到27k的tps,使用docker network-host可以达到20k的tps(下降24%),使用docker network-bridge(默认)可以达到8k的tps(下降70%);

    参考:

    docker network

    https://docs.docker.com/network/

    An Updated Performance Comparison of Virtual Machines and Linux Containers

    https://domino.research.ibm.com/library/cyberdig.nsf/papers/0929052195DD819C85257D2300681E7B/$File/rc25482.pdf

  • 相关阅读:
    Android打包key密码丢失找回
    Java 操作 elasticsearch 报错(1)
    Linux Hbase1.2.6 安装及使用(1)
    JAVA WEB 作用域之间的区别
    JSTL 与 EL
    HTML CSS 常用单词
    java
    CentOS 7 MySQL 5.7 主从设置
    VMware安装CentOS7后配置静态IP
    MySQL explain,type分析(转)
  • 原文地址:https://www.cnblogs.com/barneywill/p/10510861.html
Copyright © 2011-2022 走看看