容器与虚拟机对比
<p><strong><span style="font-size:18px">技术本质</span></strong></p>
<p><span style="font-size:16px"><strong>容器</strong></span></p>
<p>容器的实现方式是通过内核技术进行形式上的模拟,本质上容器还是一个进程,技术支撑是Cgroup/Namespace/Capability,主要从资源限制、环境隔离、权限管理三个维度进行模拟。</p>
<p><img src="https://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20190409143914-183fdb4e9efb.png" style="height:288px; width:372px" /></p>
<p><span style="font-size:16px"><strong>虚拟机</strong></span></p>
<p>虚拟机的实现方式是对底层设备的抽象虚拟,实现方式是Hypervisor,本质实际上是CPU等硬件的VT技术,使用VMware/VirtualBox一定要在BIOS里开启VT设置,GPU目前不支持VT,所有不能虚拟化,公有云或Kubernetes的GPU都是独占的,即资源配置只能设置为个位数,不能有小数。</p>
<p><img src="https://pcp-portal-sca.obs-cn-shenzhen.pinganyun.com/pcp-portal-sca/20190409143924-126a2c599877.png" style="height:299px; width:375px" /></p>
<p> </p>
<p><span style="font-size:18px"><strong>性能对比</strong></span></p>
<p>容器与虚拟机的性能对比如下表所示:</p>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="background-color:#ededed; vertical-align:top; width:106px">
<p><strong>特性</strong></p>
</td>
<td style="background-color:#ededed; vertical-align:top; width:114px">
<p><strong>容器</strong></p>
</td>
<td style="background-color:#ededed; vertical-align:top; width:120px">
<p><strong>虚拟机</strong></p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>操作系统</p>
</td>
<td style="vertical-align:top; width:114px">
<p>Linux为主</p>
</td>
<td style="vertical-align:top; width:120px">
<p>非常广泛</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>技术本质</p>
</td>
<td style="vertical-align:top; width:114px">
<p>模拟</p>
</td>
<td style="vertical-align:top; width:120px">
<p>虚拟</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>隔离策略</p>
</td>
<td style="vertical-align:top; width:114px">
<p>Namespace</p>
</td>
<td style="vertical-align:top; width:120px">
<p>Hypervisor</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>启动时间</p>
</td>
<td style="vertical-align:top; width:114px">
<p>秒级</p>
</td>
<td style="vertical-align:top; width:120px">
<p>分钟级</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>资源损耗</p>
</td>
<td style="vertical-align:top; width:114px">
<p>0-5%</p>
</td>
<td style="vertical-align:top; width:120px">
<p>5-15%</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>镜像存储</p>
</td>
<td style="vertical-align:top; width:114px">
<p>KB-MB</p>
</td>
<td style="vertical-align:top; width:120px">
<p>GB-TB</p>
</td>
</tr>
<tr>
<td style="vertical-align:top; width:106px">
<p>集群规模</p>
</td>
<td style="vertical-align:top; width:114px">
<p>近万</p>
</td>
<td style="vertical-align:top; width:120px">
<p>数百</p>
</td>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!