运维基础之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
相关文章
- 【Docker异常】ERROR: dial unix docker.raw.sock: connect: connection refused
- Docker - 构建镜像:使用docker build命令和Dockerfile文件
- [Docker] Run Stateless Docker Containers (Volumes with docker compose)
- [Docker] Container & image (docker run)
- docker desktop 配置
- Docker - Docker加速器(国内镜像)的配置及使用
- [Docker] 镜像源配置 for Linux
- 【华为云技术分享】Docker容器+Phoronix-Test-Suite测试X86和ARM的ffmpeg转码性能
- 78.第十七章 企业级容器技术docker -- Docker 镜像制作和管理(六)
- y23.第二章 Docker从入门到精通 -- docker 的资源限制(五)
- 【云原生之Docker实战】使用docker部署IT资产管理系统GLPI
- 【云原生之Docker实战】使用docker部署nginx-proxy-manager-zh反向代理工具
- 【云原生之Docker实战】使用docker部署kodbox私有云
- Ubuntu20.04 在线安装docker
- docker-compose------------启动etcd
- docker启动服务---------------elasticsearch
- Docker决战到底(五) 制作自己的Jenkins镜像
- 【云原生 • Docker】docker 入门、docker 与虚拟机对比、docker 组件
- docker将容器设置与宿主机为同一局域网
- 【Docker】如何将已有的容器打为镜像???
- Docker重学系列之docker可视化工具
- Docker容器
- Docker学习笔记17:docker实例之安装 Node.js、PHP、MySQL、Tomcat、Python、Redis、MongoDB、Apache
- 【Docker系列】6.使用docker-compose安装nginx