linux什么时候触发内存交换,linux – 何时交换触发或如何计算swap_tendency?

我正在尝试将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;

nr_mapped

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

$grep nr_mapped /proc/vmstat

nr_mapped 47640

苦难

“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”的值,因为扫描了区域.

参考

标签:linux,kernel,swap,meminfo

来源: https://codeday.me/bug/20190813/1648045.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值