本文为转载 http://www.opensolution.org.cn/archives/502.html

一、free

该工具主要是显示系统里可用和已用的内存

Linux 通常按一定的算法把常用的数据加载到系统的虚拟内存buffers 和cached 中,以便于用户程序在访问系统资源更快。而由free 查看到的buffers 是用于存放元数据,而cached 是用于存放真实的文件内容。

由上图free -k 的输出结果中可知:

系统总物理内存(total) 是4144656K( 约4G);

已用(Mem 行对应的used) 的物理内存 是3871932K( 约3.8G, 注: 这里包含了buffers 的152460K( 约152M) 和cached 的2253060K(2.2G).) ,他包含系统的buffers 和cached 的。

-/+ buffers/cache 对应的used 是1466412K( 约1.4G), 也就是Mem 行used(3871932K)-Mem 行buffers(152460K)-

Mem 行cached(2253060K)=1466412K( 约1.4G). 所以实际上可用于分配的物理内存(-/+ buffers/cache 行对应的free) 是2678244K( 约2.6G).

Shared 在man 手册里提示应该忽略(man free:The shared memory column should be ignored; it is obsolete.) 。

Mem 行对应的free 对应的274220K( 约274M). 其实这个free 是有一定限制的: 不能低于min_free_kbytes 。

min_free_kbytes 用于计算系统里lowmem zone( 物理内存0-896MB 之间的zone) 的值(This is used to force the Linux VM to keep a minimum number of kilobytes free.  The VM uses this number to compute a pages_min value for each lowmem zone in the system.  Each lowmem zone gets a number of reserved free pages based proportionally on its size.).

计算方式参见mm/page_alloc.c 的min_free_kbytes = sqrt(lowmem_kbytes * 16)

上述值是一定的公式计算

系统的lowmem 是872656KB

[root@crm_10 /root]grep LowTotal /proc/meminfo

LowTotal: 872656

min_free_kbytes=sqrt(872656*16) 约等于 3797

二、ps,top

这两个工具在内存监视方面有很大的相似性,所以一并说一下:

下面top 里的VIRT 相当于ps 里的VSZ : 指用于这个任务的总虚拟内存( 虚拟内存包括物理内存和swap 交换分区), 包括所有的代码、数据、共享库以及已经被out 到swap 分区的数据。/* The total amount of virtual memory used by the task.  It includes all code, data and shared libraries plus pages that have been swapped out.*/

而top 里的RES 相当于ps 里的RSS : 指用于这个任务的没被out 到swap 分区的总物理内存/* resident set size, the non-swapped physical memory that a task has used */

top里的%MEM : 指这个任务的RES 占总物理内存的比率/* Memory usage (RES) A task's currently used share of available physical memory.*/

三、vmstat

显示的值跟用free 工具查看到的值相似。一般情况下: 只要swap 一列的si/so 数值不超过1024 即可。

Swap

si: Amount of memory swapped in from disk (/s).

so: Amount of memory swapped to disk (/s).

四:VFS 里的meminfo 信息:

Dirty : 是指数据已写入内存,但还没同步到外存( 磁盘) 的数据量.

Slab: 为了提供内核空间以页分配对有些调用( 只需小内存) 不合适的一种内存分配方式, 提出Pool 的概念。

Vmalloc: 为了解决非连续性内存的使用,提供的一种内存分配方式( 采用链表) 。

CommitLimit: 指当前可以分配给程序使用的虚拟内存( 只有当vm.overcommit_memory 的值设置为2 时,CommitLimit 才有意义)

CommitLimit: Based on the overcommit ratio ('vm.overcommit_ratio'),

this is the total amount of  memory currently available to

be allocated on the system. This limit is only adhered to

if strict overcommit accounting is enabled (mode 2 in

'vm.overcommit_memory').

The CommitLimit is calculated with the following formula:

CommitLimit = ('vm.overcommit_ratio' * Physical RAM) + Swap

For example, on a system with 1G of physical RAM and 7G

of swap with a `vm.overcommit_ratio` of 30 it would

yield a CommitLimit of 7.3G.

For more details, see the memory overcommit documentation

in vm/overcommit-accounting.

Committed_AS: 指当前已分配给程序使用的总虚拟内存( 包含已分配给进程但还没使用的内存)

Committed_AS: The amount of memory presently allocated on the system.

The committed memory is a sum of all of the memory which

has been allocated by processes, even if it has not been

"used" by them as of yet. A process which malloc()'s 1G

of memory, but only touches 300M of it will only show up

as using 300M of memory even if it has the address space

allocated for the entire 1G. This 1G is memory which has

been "committed" to by the VM and can be used at any time

by the allocating application. With strict overcommit

enabled on the system (mode 2 in 'vm.overcommit_memory'),

allocations which would exceed the CommitLimit (detailed

above) will not be permitted. This is useful if one needs

to guarantee that processes will not fail due to lack of

memory once that memory has been successfully allocated.

HugePagesize: 在X86 架构下, 通常linux 给内存分页时,默认是每页是4KB, 而有些应用自己可以管理内存( 例如db,java ……), 所以可以把页的大小分大些( 在32 位下:4K 或4M, 在PAE 模式下可以把每页设置为2M. 在64 位下: 4K, 8K, 64K, 256K, 1M, 4M, 16M,256M ), 这样可以增加TLB( 一个存储线性地址和物理地址对应表的高速缓冲器) 存储的条目, 这样就可减少线性地址到物理地址转换的过程. 可通过vm.hugetlb_shm_group 和vm.nr_hugepages 参数进行调整。具体可查看 /usr/share/doc/kernel-doc-`uname –r |cut -d- -f1`/Documentation/vm/hugetlbpage.txt( 如果你的机器上已经安装了 kernel-doc)

The intent of this file is to give a brief summary of hugetlbpage support in

the Linux kernel.  This support is built on top of multiple page size support

that is provided by most of modern architectures.  For example, IA-32

architecture supports 4K and 4M (2M in PAE mode) page sizes, IA-64

architecture supports multiple page sizes 4K, 8K, 64K, 256K, 1M, 4M, 16M,

256M.  A TLB is a cache of virtual-to-physical translations.  Typically this

is a very scarce resource on processor.  Operating systems try to make best

use of limited number of TLB resources.  This optimization is more critical

now as bigger and bigger physical memories (several GBs) are more readily

available.

linux机器的物理内存监控,Linux内存监控工具相关推荐

  1. john 探测(爆破)弱口令(包含linux机器,aix小机)/linux上的shadow文件破解,亲测可用

    john 探测(爆破)弱口令(包含linux机器,aix小机),linux上的shadow文件破解 手头上上面的机器居多,而且这些机器也是几经转折到了奴家的手上,前期已经出现了有几个密码是1234的情 ...

  2. loadrunner监控linux性能指标,使用LoadRunner监控Linux系统性能.doc

    使用LoadRunner监控Linux系统性能 性能监控案例 ■秘密 □机密 □绝密 PAGE Linux系统性能监控案例 (仅供内部使用) 版 本 号: V0.1 保 密 等 级: ■秘密 □机密 ...

  3. mrtg监控短信报警 linux,使用 snmp+mrtg 监控 Linux 系统

    使用snmp+mrtg监控Linux 系统 CPU.流量.磁盘空间.内存 1. 安装snmp yum install net-snmp* -y 2. 修改/etc/snmpd.conf(可直接清空内容 ...

  4. zabix监控linux进程名称,zabbix监控Linux进程方法

    利用zabbixproc.num方法监控Linux服务进程 proc.num[,,,] 监控用户某些状态的进程的数量 name- 进程名称 (默认"all processes")u ...

  5. linux机器查看物理内存,Linux系统中下查看内存的方法

    Linux中使用free可以查看系统内存使用状态, 默认单位为k blue_stone@blueice:~$ free total used free shared buffers cached Me ...

  6. linux 进程装入 物理内存 页表,linux内存管理解析----linux物理,线性内存布局及页表的初始化...

    主要议题: 1分页,分段模式及实模式 2Linux分页 3linux内存线性地址空间布局及物理内存空间布局 4linux页表初始化及代码解析 1.1.1内存寻址和保护模式 在X86平台上,内存控制单元 ...

  7. linux 进程装入 物理内存 页表,linux进程空间一步步探究.doc

    linux进程空间一步步探究.doc linux 进程地址空间的一步步探究 讲师:程姚根 我们知道,在32位机器上linux操作系统中的进程的地址空间大小是4G,其中0-3G是用户空间,3G-4G是内 ...

  8. linux怎么用jconsole_jconsole监控linux系统的jvm使用

    1.在linux系统下载安装jdk和tomcat 2.配置tomcat参数 [root@node3 ~]# vim /usr/local/tomcat-7.0.64Front/bin/catalina ...

  9. linux机器不能上网,Deepin Linux 无法上网

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 我又用回2008了 LINUX图形界面还是太慢 我的感觉太敏锐 虽然LINUX的图形界面的延迟 从你鼠标发出信号 到XSERVER的视觉呈现也就几百毫秒 ...

最新文章

  1. java服务端的 极光推送
  2. php gbk字符串 存utf8 html,php utf8 gbk 数组 互转(示例代码)
  3. JDBC ResultSet 可更新的结果集
  4. 3D点云分割算法汇总
  5. 滴滴java开发面试题_最新Java面试题汇总,看完这些面试文章足够了
  6. Duilib使用---颜色配置
  7. 苹果关掉200m限制_苹果下载超过200兆怎么设置
  8. 二十一世纪大学英语读写教程(第二册)学习笔记(原文)——5 - Holding Onto a Dream(坚持梦想)
  9. SpringBoot之九重九阳神功
  10. 搭建react + typescript + airbnb eslint 项目
  11. 1.4 极限的运算法则
  12. 为什么发动机需要吸入大量的空气?
  13. CAD版本转换,手机该如何转换操作呢?
  14. 【C语言】三子棋实现AI智能落子(简单语法)
  15. 【从0开始vue】点击后弹出对话框(其他部分变灰度) + 导航栏之间的切换动画
  16. (邱维声)高等代数课程笔记:目录
  17. JAVA通过itextpdf实现PDF骑缝章
  18. 华为OD机试 - 热点网络统计(JavaScript) | 机试题+算法思路+考点+代码解析 【2023】
  19. 一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
  20. STM32-CUBEMX之找不到安装包小记

热门文章

  1. Bailian2810 完美立方【暴力】(POJ NOI0201-1812)
  2. POJ3982 序列【大数】
  3. 数学概念的提出(一) —— 熵的定义式 H(x)=-log2(p(x))
  4. 从二叉搜索树到平衡二叉搜索树
  5. UNIX 环境高级编程(四)—— dirent.h
  6. uBLAS——Boost 线性代数基础程序库 (三)
  7. 矩阵的谱(半径)及其性质
  8. 移动端调取摄像头上面如何给出框_智能AI助力家居安防,创维小湃高清智能摄像头...
  9. 12c集群日志位置_关于Oracle 12c的集群监控(CHM)
  10. python编程入门指南-最简单的Python编程入门指南,没基础也能快速入门Python编程...