maxperm小记

来源:互联网 发布:熊片私家数据库 编辑:程序博客网 时间:2024/05/16 18:59

maxperm%=90是aix 6.1安装oracle推荐值,设置为20%是5.3及其以下版本要求的,而且本系统中文件系统cache很小



minfree 和 maxfree 参数的值

使用空闲列表的目的是保持跟踪进程终止释放的实内存的页帧,向要求者立即提供页帧,而不是等待页面窃取和与之相连的输入输出的结束。minfree 限制了空闲列表的容量,低于该数值时必须开始窃取页充入空闲列表。当大于maxfree 参数时页窃取会停止。

minperm 和 maxperm 参数的值

操作系统通过把在曾经读写的内存页留在实内存一满足不同要求。如果文件页面在它们的页帧被重新分配前被请求,那就节省了输入输出操作。该文件页面可以来自本地的或远程的(如 NFS)系统。

页帧使用的文件相对用于计算的(工作或程序文本)段的文件的比例是松散地受控于 minperm 和 maxperm 的值的:

如果 RAM 中文件页面所占的百分比高于 maxperm,页面替换的窃取只用于文件页。 

如果 RAM 中文件页面所占的百分比低于 minperm,页面替换的窃取同时用于文件页和计算页。 

如果 RAM 中文件页面所占的百分比介于 minperm 和 maxperm之间,页面替换只窃取文件页,除非文件页的重调入数量大于计算页数。

其中Noncomp在20%-80%之间,此时内存页交换算法通常只交换文件缓存页,但如果文件缓存页的交换率大于程序页时,程序页也同样被交换。由于SGA属于Comp页,数据文件缓存属于Noncomp页,而在数据大量访问时,文件缓存页的交换率大于程序页(SGA),因此大量的SGA页面被交换;为避免大量SGA页被交换,需要降低maxperm%值到35%以下,这样就只有文件缓存页面被交换,减少了SGA交换的次数。

5)结论

调整maxperm%和minperm%的值,可以将MINPERM和MAXPERM分别设为5%和20%甚至更小,从而使内存更多地被用于Oracle的SGA而不是系统的文件缓存。

具体命令:# vmo -o minperm%=5 -o maxperm%=20 

注意:加-p参数可以永久更改系统的配置,否则只改动当前的系统配置,重新启动后则失效。



关于aix的maxperm,minperm和lru_file_repage

aix内存管理中有几个重要参数:maxperm,minperm,lru_file_repage,时间长了不用就容易忘掉它们到底会起什么样的作用,因此简单总结一下( numperm表示当前系统的文件页数):

一、 当 lru_file_repage = 0 时:

   当 numperm <= minperm,系统同时交换计算页和文件页,而且根据lru原则优先交换未被引用的页。

   当 minperm < numperm <= maxperm, 系统只交换文件页。

   当 numperm > maxperm,系统只交换文件页。

二、 当 lru_file_repage = 1 时:

   当 numperm <= minperm,系统同时交换计算页和文件页,而且根据lru原则优先交换未被引用的页。

   当 minperm < numperm <= maxperm,系统根据lru原则在计算页和文件页中权衡,优先交换引用次数少的页,文件页引用次数少就交换文件页,计算页引用次数少就交换计算页。

   当 numperm > maxperm,系统只交换文件页。

 

因此一般的需要大量计算页的服务器(比如数据库服务器),有两种设置:

早先是lru_file_repage = 1(aix5的默认值),而maxperm设得尽量小,例如 maxperm%=20。

现在还有一种是设置 lru_file_repage = 0(aix6的默认值),而minperm% = 5, maxperm% = 90。

下面是ORACLE中关于这个设置说明
  
AIX: Database performance gets slower the longer the database is running [ID 316533.1] 
 
Applies to: 
Oracle Server - Enterprise Edition - Version: 9.2.0.1 and later   [Release: 9.2 and later ]
z*OBSOLETE: Bull Escala RL AIX (64-bit)
IBM AIX on POWER Systems (64-bit)
z*OBSOLETE: IBM AIX 4.3 Based Systems (64-bit)
IBM AIX on POWER Systems (32-bit)
IBM AIX Based Systems (64-bit)IBM AIX Based Systems (32-bit)Bull Escala RL AIX (64-bit)IBM AIX 4.3 Based Systems (64-bit)
Oracle databases running on AIX based systems. 
Symptoms
Database performance continues to get slower and slower the longer the database is left running.  You may also notice a continuing increase in the amount of paging space usage the longer the database is left running.  However, database performance returns to normal after rebooting the system, or shutting down and restarting the database.
The slowdown can appear as increased latch contention for system critical latches such as the "library cache" and "shared pool" latches.

Cause
It is likely that you have not tuned the AIX Virtual Memory Manager (VMM).  The default values for the AIX VMM are generally not appropriate for use with relational databases.  The default values for the AIX VMM will gradually allow up to 80% of physical memory to be used to buffer file I/O.  Since Oracle is already buffering file I/O in the SGA, the same data is unnecessarily being buffered twice, and leaves only 20% of physical memory to run the Oracle database(s) and all other programs.  This causes the majority of the Oracle database to be pushed out of physical memory to paging space, thus greatly impacting database performance.
The information in this article does not apply, or the impact will be much less, if you are using one or more of the following storage types for the database datafiles, because AIX does not buffer file I/O for these types:
Raw logical volumes, filesystems using the Concurrent I/O (CIO) or Direct I/O (DIO) option
If the database is in archive mode, and the archives are written to a filesystem that does not use CIO or DIO, then this article still applies, even if the datafiles are located on a raw logical volume or a filesystem using CIO or DIO.
If your RMAN backups are being written to a filesystem that does not use CIO or DIO, then this article still applies, even if the datafiles are located on a raw logical volume or a filesystem using CIO or DIO.
There is no "built-in" support for CIO or DIO in Oracle Database 9iR2 (9.2.0) or lower, though you can force the use of CIO (JFS2) or DIO (JFS) with filesystem mount options.
Please note that tuning the AIX VMM is outside the scope of Oracle Support.  You should not create an SR regarding information in this article as Oracle Support personnel are not familiar with tuning the AIX VMM.  If you need help with checking, setting, or tuning the AIX VMM beyond what is covered in this article, you must contact your AIX systems administrator and/or IBM Support for further assistance.
Solution
To check whether your system is using the untuned default values for the AIX VMM, run the command:
/usr/sbin/vmo -a
If you do not have the /usr/sbin/vmo file you will need to have your AIX systems administrator load the AIX fileset "bos.perf.tune".  The vmo command will list out all of the VMM parameters and their current values.  The parameters you want to examine are:
MINPERM%, MAXPERM%, and MAXCLIENT%
Here is an example of the vmo report:
# vmo –a
memory_frames = 1572864
pinnable_frames = 1431781
maxfree = 1088
minfree = 960
minperm% = 20
minperm = 294356
maxperm% = 80
maxperm = 1177427
strict_maxperm = 0
maxpin% = 80
maxpin = 1258292
maxclient% = 80
lrubucket = 131072
… 
The untuned default settings are MINPERM%=20%, MAXPERM%=80%, and MAXCLIENT%=80%.  There is no "correct" value for these parameters and only extensive testing will reveal the optimal values.  The optimal value may be different for different databases on the same system, so keep this in mind when tuning the VMM and choose values which work best for all of the databases you will be running on the system.  Use the following values as a starting point:
MINPERM% = 10-15%, MAXPERM% = 20-30%, MAXCLIENT% = MAXPERM%
To get a snapshot of how much physical memory is being used by AIX to buffer file I/O, run the command:
/usr/bin/svmon -G
The svmon command is part of the same AIX fileset "bos.perf.tune" that vmo belongs to.  The last line of the svmon output should be "in use".  Add the values for "in use / pers" and "in use / clnt".  Now divide the sum by the value for "memory / size".  For best database performance, this value should generally not be higher than 30% (0.30).
Here is an example of the svmon output:
# svmon -G
                     size       inuse     free        pin     virtual
memory  131072   129432   1640   11704   50091
pg space 262144   100913
            work       pers      clnt  lpage
pin      11704           0         0     0
in use  47062   76126   6244     0
In this example, (in use / pers) 76126 plus (in use / clnt) 6244 equals 82370.  82370 divided by (memory / size) 131072 equals 0.628 or approximately 63% of physical memory being used by AIX to buffer file I/O.  This indicates the AIX VMM needs to be tuned to allow more physical memory to be used by Oracle and other processes, and less physical memory to be used to buffer file I/O.
Remember that although AIX associates this memory with the Oracle processes (because Oracle requested the file I/O), all of the memory used to buffer file I/O is completely allocated and controlled by AIX, not Oracle.  If you need help checking, setting, or tuning the AIX VMM, contact your AIX systems administrator and/or IBM Support.  You may also want to review the AIX "Performance Management Guide" by IBM linked in the References section below.
---
UPDATE: After this article was originally written, IBM has introduced a new VMM parameter which is also very helpful with this issue. The parameter is...
lru_file_repage 
The default value is "1", but it is recommended to set this to "0". This setting hints to the VMM to only steal file pages (from the AIX file buffer cache) and leave the computational pages (from the SGA) alone.
This new lru_file_repage parameter is only available on AIX 5.2 ML04 or higher and AIX 5.3 ML01 or higher.
NOTE: If you are using an older AIX system which does not support the lru_file_repage parameter, then you must use the "legacy" settings above.  If you are using a newer AIX system which does support the lru_file_repage parameter, then you should use the revised settings below instead.
As documented in the IBM "VMM Tuning Tip" referenced below, if you are running on AIX 5.2 ML04 or higher, or AIX 5.3 ML01 or higher, IBM is now recommending the following VMM settings for use with programs which need to protect computational memory (like Oracle):
strict_maxperm=0 (default)
strict_maxclient=1 (default)
lru_file_repage=0
maxperm%=90
minperm%=5 (physical RAM <32 GB)
minperm%=10 (physical RAM >32 GB but <64 GB)
minperm%=20 (physical RAM >64 GB)
v_pinshm=1
maxpin%=percent_of_real_memory
(IBM does not recommend decreasing the maxpin% value.  See the "Support for pinned memory" link in the References section below.)
Where "percent_of_real_memory" = ( (size of SGA / size of physical memory) *100) + 3
and
Set Oracle database parameter LOCK_SGA to TRUE in the pfile/spfile
and
Sum of all SGAs on the system do not exceed approximately 60% of physical memory
------------------------------------------------------------------------
Accessibility of Links to External Web Sites
This documentation may contain links to Web sites of other companies
or organizations that Oracle Corporation does not own or control.
Oracle Corporation neither evaluates nor makes any representations
regarding the accessibility of these Web sites.
------------------------------------------------------------------------ 
References
NOTE:123754.1 - AIX: Determining Oracle Memory Usage On AIX
VMM Tuning Tip: Protecting Computational Memory at http://www.ibm.com/developerworks/wikis/download/attachments/53871915/VMM+Tuning+Tip+-+Proctecting+Comp+Memory.pdf?version=2
AIX 5.3 Peformance Mangement Guide at http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.prftungd/doc/prftungd/prftungd.pdf
Configuring IBM General Parallel File System (GPFS) with Oracle RAC at http://www.ibm.com/servers/enable/site/peducation/wp/zb726/zb726.pdf
Optimizing AIX 5L performance: Tuning your memory settings at http://www.ibm.com/developerworks/views/aix/libraryview.jsp?search_by=Tuning+your+memory+settings
Support for pinned memory at http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/support_pinned_mem.htm


0 0