Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1097176
  • 博文数量: 276
  • 博客积分: 10077
  • 博客等级: 上将
  • 技术积分: 2513
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 20:31
文章分类

全部博文(276)

文章存档

2020年(1)

2015年(5)

2012年(2)

2011年(6)

2010年(7)

2009年(224)

2008年(31)

我的朋友

分类:

2011-03-22 14:31:18

对于运行Oracle数据库的AIX操作系统VMM(Virtual Memory Management)层面的系统内核参数如何进行调整,这是一个很古老的话题。这篇文章力图解释一些概念,同时与时俱进地提出一些设置的建议。

通常对VMM系统内核调优的目的,在于最大限度的保护计算内存页(computational memory)不被page-out到paging space中,因为对于计算内存页(特定于Oracle数据库来说就比如是SGA和PGA)来说被page-out出去的内存页总在之后的某一时刻又会被 重新page-in,通常这样会对系统性能产生负面影响。另外对于像Oracle数据库这样拥有自己的数据缓存机制(data buffer cache)的数据库应用来说,保护计算内存页更显得格外重要。

在IBM AIX 5.3 ML1之前,对于作为Oracle Database Server用途并且使用裸设备作为Datafile存储的的AIX操作系统内核参数调优的经验通常如下:

maxperm%=maxclient%=(通常是一个很低的值,小于20或者30)
设置较小maxperm%值的原因在于,如果文件内存页在内存中的比例高过该参数值,那么VMM换页算法将只从文件内存页中进行偷页。将maxperm%值降低就意味着有更大的机会让VMM只从文件内存页中偷页。
minperm%=5(通常是一个比maxperm%更低的值)
lru_file_repage = 1(这是默认值)

比如以下的VMM参数设置就符合该种调优方式。

root@hostname:/> vmo -a |grep "maxclient%"
maxclient% = 15
root@hostname:/> vmo -a |grep "maxperm%"
maxperm% = 15
root@hostname:/> vmo -a |grep "minperm%"
minperm% = 10
root@hostname:/> vmo -a |grep "lru_file_repage"
lru_file_repage = 1

但是实际上在AIX 5.3 引入了lru_file_repage参数之后,对于操作系统VMM层的内核参数调整方法已经发生了改变。现在的VMM参数调优建议应该如下。

maxperm%=maxclient%=(较高值,通常为90%)
因为较高的maxperm%值能够防止不必要的lrud进程运行,lrud进程是系统核心进程负责在需要的时候偷取内存页(stealing memory)。如果可以,maxperm%应该大于numclient%值(通过vmstat -v可以获得)。
minperm%=(较低值,对于超过64G物理内存的服务器来说通常为20%,IBM甚至建议将该值设置为3%)
较低的minperm%值用以保证lru_file_repage参数作用不至于无法体现。通常minperm%值应该低于numperm%值(通过vmstat -v可以获得),如果当前的minperm%=5%满足需求那么可以不用修改。
strict_maxperm=0(这是默认值)
strict_maxclient=1(这是默认值)
lru_file_repage = 0
当该参数设置为0的时候,VMM将会优先尝试从文件内存页中进行偷页操作,而不影响到计算内存页。

更详细地看一下lru_file_repage参数是如何影响VMM偷页算法的。

由于空闲页低于了minfree参数值,或者其它的一些触发机制(比如说client page数量超过了maxclient%并且strict_maxclient=1)导致lrud进程要开始偷页操作,此时如果 lru_file_repage =1(这是默认值)那么lrud进程将会根据多种内核参数和系统当前状况进行判断,可能是只从文件内存页中偷页也可能是不管内存段的类型从整个内存中进行 偷页,这就可能导致计算内存页被page-out出去,而如果lru_file_repage =0,那么只要文件内存页(file memory)占内存的比值(numperm)高于minperm并且VMM确实能够从文件内存页中偷取到足够的内存以满足需求,那么就只会做文件内存页 的page-out。因此,保护了Oracle数据库SGA在内存中的稳定性。

另外可以调整的参数包括:
page_steal_method = 1(应该为默认值)

参看如下解释:

The VMM maintains a logical list of free page frames that it uses to accommodate page faults. In most environments, the VMM must occasionally add to the free list by reassigning some page frames owned by running processes. The virtual-memory pages whose page frames are to be reassigned are selected by the VMM’s page-replacement algorithm. The VMM thresholds determine the number of frames reassigned.
By default in AIX 6.1, and optionally in AIX 5.3 the LRU algorithm can either use lists or the page frame table. Prior to AIX 5.3, the page frame table method was the only method available. The list-based algorithm provides a list of pages to scan for each type of segment.
You can disable the list-based LRU feature and enable the original physical-address-based scanning with the page_steal_method parameter of the vmo command. The default value for the page_steal_method parameter is 1, which means that the list-based LRU feature is enabled and lists are used to scan pages. If the page_steal_method parameter is set to 0, the physical-address-based scanning is used. The value for the page_steal_method parameter takes effect after a bosboot and reboot.

因此,对于作为Oracle数据库服务器的IBM AIX 5.3之后版本,VMM参数建议值如下。

minperm%=3
maxperm%=90
maxclient%=90
lru_file_repage=0
strict_maxperm=0
strict_maxclient=1
page_steal_method=1

修改VMM参数的命令如下。

#!/usr/bin/ksh
vmo -p -o minperm%=3;
vmo -p -o maxperm%=90;
vmo -p -o maxclient%=90;
vmo -p -o lru_file_repage=0;
vmo -p -o strict_maxperm=0;
vmo -p -o strict_maxclient=1;
vmo -r -o page_steal_method=1;
阅读(2459) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~