[CentOS6] Page allcation failure

简介:

线上发现多次page allocation failure的问题:

查看当时的监控内存并没有用满,还有很大的headroom,简单Google了下在CentOS 6.2下好多遇到同样的问题,疑是OSbughttps://bugzilla.redhat.com/show_bug.cgi?id=767127

提供的solution基本上是调整2个参数: vm.zone_reclaim_mode=1double/quadruple min_free_kbytes ,修改后基本上还没有看到这个问题再出现.

简单看了下参数的意思.

1.zone_reclaim_mode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
   Zone_reclaim_modeallows someone to set more or less aggressive approaches to
reclaim memory when a zone runs out of memory. If it is set to zero then no zone reclaim occurs.
1   = Zone reclaim on
2   = Zone reclaim writes dirty pages out
4   = Zone reclaim swaps pages
   zone_reclaim_modeis set during bootup to 1 if it is determined that pages from remote zones will cause a measurable performance reduction. The pageallocator will then reclaim easily reusable pages (those page
cachepages that are currently not used) before allocating off node pages.
   It may be beneficial to switch off zone reclaim if the system is
usedfor a file server and all of memory should be used for caching files from disk. In that case the caching effect is more important than data locality.
   Allowing zone reclaim to write out pages stops processes that are
writing large amounts of data from dirtying pages on other nodes. Zone
reclaim will write out dirty pages if a zone fills up and so effectively throttle the process.
   This may decrease the performance of a single process since it cannot use all of system memory to buffer the outgoing writes anymore but it preserve the memory on other nodes so that the performance of other processes running on other nodes will not be affected.
   Allowing regular swap effectively restricts allocations to the local
node unless explicitly overridden by memory policies or cpuset
configurations.

具体算法请参考:http://www.orczhou.com/index.php/2011/02/linux-memory-management-3/

2.min_free_kbytes

1
2
3
4
5
6
7
8
9
   This is used to force the Linux VM to keep a minimum number
of kilobytes free.  The VM uses this numberto compute a
watermark [WMARK_MIN] value for each lowmem zone in the system.
   Each lowmem zone gets a number of reserved free pages based
proportionallyon its size.
   Some minimal amount of memory is needed to satisfy PF_MEMALLOC
allocations;if you set this to lower than 1024KB, your system will
become subtly broken, and prone to deadlock under high loads.
   Setting this too high will OOM your machine instantly.

其中watermark的min low high计算如下:

watermark[min] = min_free_kbytes

watermark[low] = watermark[min] * 5 / 4

watermark[high] = watermark[min] * 3 / 2

 在系统空闲内存低于 watermark[low]时,开始启动内核线程kswapd进行内存回收(每个zone一个),直到该zone的空闲内存数量达到watermark[high]后停止回收。如果上层申请内存的速度太快,导致空闲内存降至watermark[min]后,内核就会进行direct reclaim(直接回收),即直接在应用程序的进程上下文中进行回收,再用回收上来的空闲页满足内存申请,因此实际会阻塞应用程序,带来一定的响应延迟,而且可能会触发系统OOM。这是因为watermark[min]以下的内存属于系统的自留内存,用以满足特殊使用,所以不会给用户态的普通申请来用。

可以通过/proc/zoneinfo查看每个zone的watermark


本文转自MIKE老毕 51CTO博客,原文链接:http://blog.51cto.com/boylook/1335662,如需转载请自行联系原作者


相关文章
|
网络安全
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
ssh: Could not resolve hostname centos02: Temporary failure in name resolution
1222 0
|
4月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
775 69
|
3月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
1099 5
|
4月前
|
Ubuntu Linux 索引
Centos 7、Debian及Ubuntu系统中安装和验证tree命令的指南。
通过上述步骤,我们可以在CentOS 7、Debian和Ubuntu系统中安装并验证 `tree`命令。在命令行界面中执行安装命令,然后通过版本检查确认安装成功。这保证了在多个平台上 `tree`命令的一致性和可用性,使得用户无论在哪种Linux发行版上都能使用此工具浏览目录结构。
390 78
|
3月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
589 16
|
5月前
|
Linux 网络安全 Apache
针对在Centos/Linux安装Apache过程中出现的常见问题集锦
以上每个问题的解决方案应深入分析错误日志、系统消息和各种配置文件,以找到根本原因并加以解决。务必保持系统和Apache软件包更新到最新版本,以修复已知的bugs和安全漏洞。安装和管理Web服务器是一项需要细致关注和不断学习的任务。随着技术的发展,推荐定期查看官方文档和社区论坛,以保持知识的更新。
242 80
|
4月前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
339 10
|
5月前
|
人工智能 数据挖掘 Linux
Centos安装Python3.7(亲测可用)
本指南详细介绍了在基于Linux(以CentOS系统为例,使用yum包管理器)的系统上安装Python 3.7版本的完整流程。Python是一种广泛使用的高级编程语言,在各种领域如软件开发、数据分析、人工智能和区块链开发等都有着重要的应用。
491 3
|
6月前
|
机器人 Linux
CentOS 7系统中安装特定版本CMake 3.21.2的方法。
到这里,过程已经全部完成。如果你跟随上面的步骤来,那么你现在已经拥有了一个全新的CMake版本在你的CentOS 7系统上了。这个过程就像是你通过一系列仪式,唤醒了一个沉睡已久的古老机器人,它现在完全按照你的意愿来帮你构建和编译软件了。
504 18