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

查看:233
本文介绍了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中挂载磁盘,而实际上可以在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 some examples of memory (read the paper for details, memory can be extra tricky):

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

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