xen dom0_管理Xen Dom0的CPU和内存

xen dom0

The performance of Xen’s Dom0 is important for the overall system. The disk and network drivers are running on Dom0. I/O intensive guests’ workloads may consume lots Dom0′s CPU cycles. The Linux kernel calculates various network related parameters based on the amount of memory at boot time. The kernel also allocate memory for storing memory metadata (per page info structures) is also based on the boot time amount of memory. After ballooning down Dom0′s memory, the network related parameters will not be correct. Ballooning down busy Dom0′s memory sometimes cause SSH to die from our observation, which is a nightmare for the administrator since SSH is usually the only way for remote control of the server. Another bed effect is that it’s a waste of memory with a large memory metadata for a smaller memory amount.

Xen Dom0的性能对于整个系统很重要。 磁盘和网络驱动程序在Dom0上运行。 I / O密集型来宾的工作量可能会消耗大量Dom0的CPU周期。 Linux内核根据启动时的内存量来计算各种与网络相关的参数。 内核还根据内存的启动时间分配内存以存储内存元数据(每页信息结构)。 Swift增加Dom0的内存后,与网络相关的参数将不正确。 繁忙的Dom0内存Swift膨胀有时会导致SSH从我们的观察中消失,这对于管理员来说是一场噩梦,因为SSH通常是远程控制服务器的唯一方法。 另一个潜在的影响是浪费大量的内存元数据来减少较小的内存量。

Now let’s look at how to menage Xen Dom0′s CPU and memory in a better way.

现在让我们看一下如何更好地管理Xen Dom0的CPU和内存。

专门用于dom0的一个CPU核心 (Dedicate a CPU core for Dom0 )

Dom0 will have free CPU time to process the I/O requests from the DomUs if it has dedicated CPU core(s). Better performance may be achieved by this since there are less CPU context switches to do in Dom0.

如果Dom0具有专用的CPU内核,则它将有空闲的CPU时间来处理来自DomU的I / O请求。 由于在Dom0中要做的CPU上下文切换较少,因此可以实现更好的性能。

We can dedicate CPU core for Dom0 by passing “dom0_max_vcpus=X dom0_vcpus_pin” options to Xen hypervisor (xen.gz) in /boot/grub/grub.conf. X is the number of vcpus dedicated to Dom0.

我们可以通过将“ dom0_max_vcpus = X dom0_vcpus_pin”选项传递给/boot/grub/grub.conf中的Xen虚拟机管理程序(xen.gz),将CPU内核专用于Dom0。 X是专用于Dom0的vcpus的数量。

As hyperthreading technology is enabled in most modern CPUs, we need to specify two processors to dedicate one CPU core. So the “X” above should usually be 2 for one CPU core.

由于大多数现代CPU中都启用了超线程技术,因此我们需要指定两个处理器来专用于一个CPU内核。 因此,对于一个CPU内核,上面的“ X”通常应为2。

kernel /xen.gz console=vga vga=ask noreboot dom0_max_vcpus=2 dom0_vcpus_pin

After booting the system, the VCPU list can be got on Dom0 by this command:

引导系统后,可以通过以下命令在Dom0上获取VCPU列表:

# xm vcpu-list

Even after booting the system, the VCPU number can be configured by xm command. We can set Domain-0 have two VCPUs and processor 0 and 1 to be dedicated to Dom0 by these commands:

即使在引导系统之后,也可以通过xm命令配置VCPU编号。 我们可以通过以下命令将Domain-0设置为具有两个VCPU,并将处理器0和1专用于Dom0:

# xm vcpu-set Domin-0 2
# xm vcpu-pin Domain-0 0
# xm vcpu-pin Domain-0 1

为dom0的奉献内存 (Dedicate memory for Dom0 )

We should always dedicate fixed amount of memory for Xen Dom0.

我们应该始终为Xen Dom0分配固定的内存量。

We can set the initial memory size of Dom0 by passing “dom0_mem=xxx” (in KB) option to Xen hypervisor (gen.gz) in /boot/grub/grub.conf. “xxx” is the amount of memory for Dom0 in KB.

我们可以通过将“ dom0_mem = xxx”(以KB为单位)选项传递给/boot/grub/grub.conf中的Xen虚拟机管理程序(gen.gz)来设置Dom0的初始内存大小。 “ xxx”是Dom0的内存量,以KB为单位。

If we set the initial memory size of Dom0 to 2GB, just change the entry in grub.conf to:

如果我们将Dom0的初始内存大小设置为2GB,只需将grub.conf中的条目更改为:

kernel /xen.gz console=vga vga=ask noreboot dom0_max_vcpus=2 dom0_vcpus_pin dom0_mem=2097152
为dom0中设置最低允许内存 (Set lowest permissible memory for Dom0 )

The option dom0-min-mem in Xend configuration file /etc/xen/xend-config.sxp is used to specify the lowest permissible memory for Dom0.

Xend配置文件/etc/xen/xend-config.sxp中的dom0-min-mem选项用于指定Dom0的最低允许内存。

The value of dom0-min-mem (in MB) is the lowest permissible memory level for Dom0. The default value is 256. If we limit the memory size of Dom0 to 2G, just set:

dom0-min-mem的值(以MB为单位)是Dom0的最低允许内存级别。 默认值为256。如果将Dom0的内存大小限制为2G,则只需设置:

(dom0-min-mem 2048)
防止dom0内存膨胀 (Preventing dom0 memory ballooning )

The “enable-dom0-ballooning” option in Xend configuration file is used to specify whether Dom0′s memory can be ballooned out. Setting “enable-dom0-ballooning” to “no” will make sure Xend never takes any memory away from Dom0:

Xend配置文件中的“ enable-dom0-ballooning”选项用于指定是否可以膨胀Dom0的内存。 将“ enable-dom0-ballooning”设置为“ no”将确保Xend永远不会占用Dom0的任何内存:

(enable-dom0-ballooning no)

翻译自: https://www.systutorials.com/managing-xen-dom0s-cpu-and-memory/

xen dom0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值