Docker 容器的运行时性能成本是多少? [英] What is the runtime performance cost of a Docker container?

查看:47
本文介绍了Docker 容器的运行时性能成本是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想全面了解 Docker 容器的运行时性能成本.我发现对 网络的引用据说慢了大约 100µs.

I'd like to comprehensively understand the run-time performance cost of a Docker container. I've found references to networking anecdotally being ~100µs slower.

我还发现提到运行时成本可以忽略不计"和接近于零",但我想更准确地了解这些成本是多少.理想情况下,我想知道 Docker 以性能成本抽象什么,以及在没有性能成本的情况下抽象的东西.网络、CPU、内存等

I've also found references to the run-time cost being "negligible" and "close to zero" but I'd like to know more precisely what those costs are. Ideally I'd like to know what Docker is abstracting with a performance cost and things that are abstracted without a performance cost. Networking, CPU, memory, etc.

此外,如果有抽象成本,有没有办法绕过抽象成本.例如,也许我可以直接挂载磁盘而不是在 Docker 中虚拟挂载.

Furthermore, if there are abstraction costs, are there ways to get around the abstraction cost. For example, perhaps I can mount a disk directly vs. virtually in Docker.

推荐答案

一篇优秀的 2014 IBM 研究论文虚拟机和 Linux 容器的更新性能比较",Felter 等人.提供了裸机、KVM 和 Docker 容器之间的比较.总体结果是:Docker 几乎与原生性能相同,并且在每个类别中都比 KVM 更快.

An excellent 2014 IBM research paper "An Updated Performance Comparison of Virtual Machines and Linux Containers" by Felter et al. provides a comparison between bare metal, KVM, and Docker containers. The general result is: Docker is nearly identical to native performance and faster than KVM in every category.

例外是 Docker 的 NAT — 如果您使用端口映射(例如,docker run -p 8080:8080),那么您可以预期延迟会受到轻微影响,如下所示.但是,您现在可以在启动 Docker 容器时使用主机网络堆栈(例如,docker run --net=host),这将与 Native 列执行相同(如 Redis 延迟结果所示)降低).

The exception to this is Docker’s NAT — if you use port mapping (e.g., docker run -p 8080:8080), then you can expect a minor hit in latency, as shown below. However, you can now use the host network stack (e.g., docker run --net=host) when launching a Docker container, which will perform identically to the Native column (as shown in the Redis latency results lower down).

他们还对一些特定服务(例如 Redis)进行了延迟测试.您可以看到超过 20 个客户端线程,最高延迟开销是 Docker NAT,然后是 KVM,然后是 Docker 主机/本机之间的粗略联系.

They also ran latency tests on a few specific services, such as Redis. You can see that above 20 client threads, highest latency overhead goes Docker NAT, then KVM, then a rough tie between Docker host/native.

仅仅因为这是一篇非常有用的论文,这里有一些其他的数字.请下载以获取完整访问权限.

Just because it’s a really useful paper, here are some other figures. Please download it for full access.

看看磁盘 I/O:

现在查看 CPU 开销:

Now looking at CPU overhead:

现在一些内存示例(阅读论文了解详细信息,内存可能会更加棘手):

Now some examples of memory (read the paper for details, memory can be extra tricky):

这篇关于Docker 容器的运行时性能成本是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆