KVM 虚拟化时,如果主机内存充足建议停止 ksm 服务

今天一台KVM主机CPU据高不下,一看是 ksmd cpu 占用居高不下,后来看了redhat的文档 和 fedora的文档了解了 ksm的作用,

Allow KVM guest virtual machines to share identical memory pages. 
This is especially useful when running multiple guests from the same or similar base operating system image. 
Because memory is shared, the combined memory usage of the guests is reduced.

我的主机内存充足,所以我就停掉了ksm 和 ksmtuned 服务

# service ksm stop
Stopping ksm:                                              [  OK  ]
# service ksmtuned stop
Stopping ksmtuned:                                         [  OK  ]
# chkconfig ksm off
# chkconfig ksmtuned off

停完后cpu负载就好多了。

注:如果内存不多,又想新加 KVM guest 可以启用,不过Swap要足够大