Chinaunix首页 | 论坛 | 博客
  • 博客访问: 304251
  • 博文数量: 26
  • 博客积分: 2052
  • 博客等级: 大尉
  • 技术积分: 686
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-23 22:02
文章分类

全部博文(26)

文章存档

2013年(1)

2011年(1)

2010年(12)

2009年(2)

2008年(10)

我的朋友

分类:

2008-04-08 09:30:50

本章介绍和AIX内存相关的一些基本概念.

物理内存

      物理存在的内存,查看命令:

# prtconf |grep Memory

Memory Size: 15936 MB

Good Memory Size: 15936 MB

 

物理内存的分类

(1) persistent(长久型)和work(工作型)内存

       Persistent型是指读入到内存的内容本身在文件系统是存在的,例如包含数据的文件,可执行文件; 工作型是指进程中的Stack,变量, 共享内存段等(working segments, as are the kernel text segment, the kernel-extension text segments, as well as the shared-library text and data segments. ),是进程中途产生的。Persistent型内存被page out的时候回写到文件系统中,work型内存被page out的时候回写到paging space中.

      通过svmon可以看到这两种内存的类型.

# svmon -G

               size      inuse       free        pin    virtual

memory      4079616    3477314     602302     535874     894316

pg space    7995392       2915

               work       pers       clnt

pin          535874          0          0

in use       894316          0    2582998

 (2) Computational(计算型)和File(文件型)

       Computational型内存包含working-storage segments or program text (executable files) segments. 也就是包括work(工作型)再加上persistent(长久型)中的可执行文件的部分. File(文件型)是除去计算型的所有内存. Computational型可以理解为读入可执行文件的地方,文件型可以理解为读入文件中的data部分.

      可以通过topas看到这两种内存的类型.

MEMORY

Real,MB   15936

% Comp     22.8

% Noncomp  63.3

% Client   63.8

 (3) Client类型

      Persistent类型的内存进一步被分类,其中client类型的内存被用于map remote files(例如通过NFS访问的文件). Enhanced JFS file system使用clients page来缓存cache,所以在上面的svmon的结果中看到实际没有persistent的值,而都是clnt的值, 因为用的都是Enhanced JFS 文件系统.

               work       pers       clnt

pin          535874          0          0

in use       894316          0    2582998

 

虚拟内存

      虚拟内存是物理内存和Paging Space组合形成的虚拟内存空间,通过虚拟的地址空间映射到物理内存或者Paging Space.

 

Paging space

      Paging space是系统的一个物理存储空间, 占用一定的磁盘空间, 可以是logical volume或者文件的形式. AIX内核需要利用 Paging Space 来管理虚拟内存。和内存页面一样,AIX的 Paging Space也是以4KB为单位,当实际内存数的空闲值低于一定数量以后,系统需要把实际内存中的某些计算页面(Computation Page)写回到Paging Space中(page out),以便释放出实际内存页面用于其他程序。查看当前paging space的命令:

# lsps -a

Page Space      Physical Volume   Volume Group    Size %Used Active  Auto  Type

hd6             hdisk1            rootvg       31232MB     1   yes   yes    lv

 

Page Fault

      If the access is going to a page of virtual memory that is stored over to disk, or has not been brought in yet, a page fault occurs, and the execution of the program is suspended until the page has been read from disk. 查看page fault的命令:

# sar -r 5

System configuration: lcpu=8 mem=15936MB

10:28:12   slots cycle/s fault/s  odio/s

10:28:17 7992467    0.00    3.39    0.20

 

pi(Page In)

      The number of pages paged in from paging space. 从paging space page到内存中的page数目, 这些页必定以前被page out到page space中的. 通过vmstat查看

# vmstat   

System configuration: lcpu=8 mem=15936MB

kthr    memory              page              faults        cpu   

----- ----------- ------------------------ ------------ -----------

 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa

 1  1 894750 601858   0   0   0   2    3   0  15  861 286  0  0 99  1

 

po(Page Out)

      The number (rate) of pages paged out to paging space. 如果持续看到po但是没有看到pi的增长,并不一定代表出现了Thrashing, 比如 系统正在读取大量的persistent pages会导致看到大量的page out, 这时候需要查看一下应用的类型. 被page out出去的数据,如果有进程需要再次reference的时候,将产生page fault,然后通过page in再次写入到内存. 通过vmstat查看

 

Thrashing

      表示系统连续地paging in和out, 经常是系统缺乏内存的现象.

 

Repage

      Page fault可以是一个新的page fault,也可以是一个repage fault.  A new page fault occurs when there is no record of the page having been referenced recently. A repage fault occurs when a page that is known to have been referenced recently is referenced again, and is not found in memory because the page has been replaced (and perhaps written to disk) since it was last accessed. 发生一次page fault是正常机制,但应该避免发生多次的page fault,AIX在这里是做了一种统计,分别统计计算型和非计算型内存发生repage的count,我们可以用vmtune去调整这两种内存的 page的机制(vmtune -p -P)
阅读(2543) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~