首页 > 解决方案 > VM 或 Hypervisor 中的 Linux 内核配置范围

问题描述

在生产中,我们将部署一个 redis 服务器,并且需要overcommit_memory=1在内核中设置和禁用透明大页面。

问题是目前我们只有一台巨型服务器,并且要被许多其他应用程序共享。我们只想要 redis 服务器中的那些内核配置。我想知道我们是否可以通过为 redis 启动专用 VM 来实现它。在 docker 中这样做当然没有意义。我的问题是:

  1. 即使主机操作系统没有相同的配置,这些内核配置是否会在 redis VM 中实际生效?我对此表示怀疑,因为硬件资源最终是由主机分配的。

  2. redis 虚拟机中的内核配置会影响运行其他应用程序的其他虚拟机吗?我认为不会,只是想确认一下。

  3. 为了实现这个目标,我们应该使用什么样的虚拟机或管理程序?

如果在 VM 中无法做到这一点,那么为 redis 配备单独的服务器(硬件)是唯一的方法吗?

标签: linuxlinux-kernelvirtual-machine

解决方案


If you're running a real kernel on a virtual machine, the VM should be able to correctly handle overcommitted memory.

  1. The host server will grant a fixed chunk of memory to the VM. The VM should manage that memory as it sees fit, including overcommitting its own address space.

  2. This will not affect other applications running on the host (apart from the fact that is has less memory available). If it does, there is a problem with your hypervisor.

  3. This should work with any Hypervisor. KVM is a good place to start.

Note that I have not actually tried this -- experiment results are welcome!


推荐阅读