ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux – 何时交换触发或如何计算swap_tendency?

2019-08-13 06:54:37  阅读:434  来源: 互联网

标签:linux kernel swap meminfo


我正在尝试将Redis用于生产服务并尝试避免交换,这对性能不利.

我已经知道交换是由swap_tendency触发的,这取决于

swap_tendency = mapped_ratio/2 + swappiness + distress

如何从/ proc / meminfo为我的监视器脚本获取mapped_ratio / distress?

或者任何可以告诉我系统要交换页面的参数?

解决方法:

mapped_ratio

mapped_ratio可以像这样计算:

mapped ratio = (nr mapped * 100) / total memory;

资料来源:https://www.cs.columbia.edu/~smb/classes/s06-4118/l19.pdf

nr_mapped

可以从/ proc / vmstat读取值nr_mapped:

$grep nr_mapped /proc/vmstat
nr_mapped 47640

苦难

根据这篇文章,标题为:Linux Memory – Implementation Notes

“This is a measurement of how much difficulty the VM is having reclaiming pages. Each time the VM tries to reclaim memory, it scans 1/nth of the inactive lists in each zone in an effort to reclaim pages. Each time a pass over the list is made, if the number of inactive clean + free pages in that zone is not over the low water mark, n is decreased by one. Distress is measured as 100 >> n” 07002

在研究大部分文档时,听起来好像“遇险”是内核计数器,但事实并非如此.相反,它是在扫描每个内存区域时使用的值,随着内核扫描内存的页面帧以尝试回收它们,该值逐渐增加.对此的讨论超出了本Q& A的范围,但是如果您对“理解Linux内核”一书中的部分感到好奇,那么“遇险”的值来自于“prev_priority”的值,因为扫描了区域.

参考

> Understanding Memory
> Linux Memory Allocation – PDF
> What Is the Linux Kernel Parameter vm.swappiness?
> 2.6 swapping behavior
> Understanding Virtual Memory In Red Hat Enterprise Linux 4
> Understanding the Linux Kernel 3rd Ed.

标签:linux,kernel,swap,meminfo
来源: https://codeday.me/bug/20190813/1648045.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有