linux虚拟机中 idle,Linux 虚拟机注意事项

Linux 虚拟机注意事项Linux Virtual Machine Considerations

10/16/2017

本文内容

与 Hyper-v 中的 Windows 虚拟机相比,Linux 和 BSD 虚拟机有其他注意事项。Linux and BSD virtual machines have additional considerations compared to Windows virtual machines in Hyper-V.

首先要考虑 Integration Services 是存在还是仅在不悟道的模拟硬件上运行 VM。The first consideration is whether Integration Services are present or if the VM is running merely on emulated hardware with no enlightenment. Windows 上的 Hyper-v 支持的 linux 和 FreeBSD 虚拟机中提供了包含内置或可下载 Integration Services 的 LINUX 和 BSD 版本表。A table of Linux and BSD releases that have built-in or downloadable Integration Services is available in Supported Linux and FreeBSD virtual machines for Hyper-V on Windows. 这些页面提供适用于 Linux 分发版的可用 Hyper-v 功能网格,并在适用的情况下提供有关这些功能的说明。These pages have grids of available Hyper-V features available to Linux distribution releases, and notes on those features where applicable.

即使来宾 Integration Services 运行,它也可以配置旧版硬件,而不会表现出最佳性能。Even when the guest is running Integration Services, it can be configured with legacy hardware which does not exhibit the best performance. 例如,为来宾配置和使用虚拟以太网适配器,而不是使用旧版网络适配器。For example, configure and use a virtual ethernet adapter for the guest instead of using a legacy network adapter. 对于 Windows Server 2016,还提供了高级网络,如 SR-IOV。With Windows Server 2016, advanced networking like SR-IOV are available as well.

Linux 网络性能Linux Network Performance

默认情况下,Linux 允许硬件加速和卸载。Linux by default enables hardware acceleration and offloads by default. 如果在主机上的 NIC 的属性中启用了 vRSS 并且 Linux 来宾可以使用 vRSS,则将启用该功能。If vRSS is enabled in the properties of a NIC on the host and the Linux guest has the capability to use vRSS the capability will be enabled. 在 Powershell 中,可以通过命令更改同一个参数 EnableNetAdapterRSS 。In Powershell this same parameter can be changed with the EnableNetAdapterRSS command.

同样,可以在 "来宾属性 > 配置 > " 所使用的物理 NIC 上启用 VMMQ (虚拟交换机 RSS) 功能。"高级" 选项卡 > 将虚拟交换机 RSS设置为 "启用",或在 POWERSHELL 中使用以下命令启用 VMMQ:Similarly, the VMMQ (Virtual Switch RSS) feature can be enabled on the physical NIC used by the guest Properties > Configure... > Advanced tab > set Virtual Switch RSS to Enabled or enable VMMQ in Powershell using the following:

Set-VMNetworkAdapter -VMName **$VMName** -VmmqEnabled $True

在来宾中,可以通过增加限制来执行其他 TCP 优化。In the guest additional TCP tuning can be performed by increasing limits. 为了获得跨多个 Cpu 的最佳性能分配工作负荷,并且具有深度工作负载,可以获得最佳吞吐量,因为虚拟化工作负荷的延迟高于 "裸机"。For the best performance spreading workload over multiple CPUs and having deep workloads produces the best throughput, as virtualized workloads will have higher latency than "bare metal" ones.

一些在网络基准中有用的优化参数示例包括:Some example tuning parameters that have been useful in network benchmarks include:

net.core.netdev_max_backlog = 30000

net.core.rmem_max = 67108864

net.core.wmem_max = 67108864

net.ipv4.tcp_wmem = 4096 12582912 33554432

net.ipv4.tcp_rmem = 4096 12582912 33554432

net.ipv4.tcp_max_syn_backlog = 80960

net.ipv4.tcp_slow_start_after_idle = 0

net.ipv4.tcp_tw_reuse = 1

net.ipv4.ip_local_port_range = 10240 65535

net.ipv4.tcp_abort_on_overflow = 1

用于网络 microbenchmarks 的有用工具是 ntttcp,可在 Linux 和 Windows 上使用。A useful tool for network microbenchmarks is ntttcp, which is available on both Linux and Windows. The Linux version is open source and available from ntttcp-for-linux on github.com. 可以在 下载中心找到 Windows 版本。The Windows version can be found in the download center. 优化工作负荷时,最好使用尽可能多的流来获得最佳吞吐量。When tuning workloads it is best to use as many streams as necessary to get the best throughput. 使用 ntttcp 来为流量建模, -P 参数设置使用的并行连接数。Using ntttcp to model traffic, the -P parameter sets the number of parallel connections used.

Linux 存储性能Linux Storage Performance

Some best practices, like the following, are listed on Best Practices for Running Linux on Hyper-V. Linux 内核具有不同的 i/o 计划程序,用不同的算法对请求重新排序。The Linux kernel has different I/O schedulers to reorder requests with different algorithms. NOOP 是一个先进先出队列,该队列通过虚拟机监控程序做出的计划决策。NOOP is a first-in first-out queue that passes the schedule decision to be made by the hypervisor. 在 Hyper-v 上运行 Linux 虚拟机时,建议使用 NOOP 作为计划程序。It is recommended to use NOOP as the scheduler when running Linux virtual machine on Hyper-V. 若要更改特定设备的计划程序,请在启动加载器的配置中 (/etc/grub.conf,例如) ,将添加 elevator=noop 到内核参数,然后重新启动。To change the scheduler for a specific device, in the boot loader's configuration (/etc/grub.conf, for example), add elevator=noop to the kernel parameters, and then restart.

与网络类似,Linux 来宾的存储性能从具有足够深度的多个队列中获益最大,使主机保持繁忙状态。Similar to networking, Linux guest performance with storage benefits the most from multiple queues with enough depth to keep the host busy. Microbenchmarking 存储性能可能适用于 fio 基准工具与 libaio 引擎。Microbenchmarking storage performance is probably best with the fio benchmark tool with the libaio engine.

其他参考Additional References

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值