【分布式】hadoop安装篇(11)CDH安装中的问题:swappiness

现象

在运行的过程中,即使我们看到host的内存仍富有余量,但是健康检查亮橙灯,会有Swapping Concerning的提示,例如

6 pages were swapped to disk in the previous 15 minute(s). Warning threshold: any.

其实在安装过程中的自检中,也看到有关的warning

Cloudera recommends setting /proc/sys/vm/swappiness to a maximum of 10. Current setting is 60. Use the sysctl command to change this setting at run time and edit /etc/sysctl.conf for this setting to be saved after a reboot. You can continue with installation, but Cloudera Manager might report that your hosts are unhealthy because they are swapping. The following hosts are affected:

原因

在CDH的官网https://www.cloudera.com/documentation/enterprise/latest/topics/cdh_admin_performance.html,对此给出了说明

The Linux kernel parameter, vm.swappiness, is a value from 0-100 that controls the swapping of application data (as anonymous pages) from physical memory to virtual memory on disk. The higher the value, the more aggressively inactive processes are swapped out from physical memory. The lower the value, the less they are swapped, forcing filesystem buffers to be emptied.

On most systems, vm.swappiness is set to 60 by default. This is not suitable for Hadoop clusters because processes are sometimes swapped even when enough memory is available. This can cause lengthy garbage collection pauses for important system daemons, affecting stability and performance.

Cloudera recommends that you set vm.swappiness to a value between 1 and 10, preferably 1, for minimum swapping.

Note: Cloudera previously recommended setting vm.swappiness to 0. However, a change in Linux kernel 3.5-rc1 (fe35004f), can lead to frequent out of memory (OOM) errors. For details, see Evan Klitzke's blog post. This commit was backported to RHEL / CentOS 6.4 and Ubuntu 12.04 LTS (Long Term Support).

解决

根据官网的提示,将vm.swappiness设置为1,具体方式如下:

$ sudo sysctl vm.swappiness=1

同时修改配置,以后重启依然有效。在/etc/sysctl.conf,增加

vm.swappiness = 1

你可能感兴趣的:(分布式,恺风(Wei)之分布式学习笔记)