1、nfile,maxfiles_lim,nproc参数说明
nfile:系统所有经常可打开的最大文件数量
maxfiles_lim:单进程可打开的最大文件数量
nproc: 系统可并发运行的进程数量
执行man nfile(maxfiels_lim,nproc)可获取更详细的信息
2、查看当前nfile参数的值,默认值为0,表示不限制
db178.cm2:/home/fengjing/kmif>#kctune -v nfile
Tunable nfile
Description Maximum number of file descriptors (system-wide)
Module fs_filedscrp
Current Value 330800 [(21*nproc+204800)]
Value at Next Boot 330800 [(21*nproc+204800)]
Value at Last Boot 330800
Default Value 0
Constraints nfile == 0 or nfile >= 2048
nfile <= 2147483647
Can Change Immediately or at Next Boot
补充:执行kctune -v maxfiles_lim和kctune -v nproc可查看想参数的值
3、查看当前nfile的使用情况
3.1 sar -v命令
00:00:01 text-sz ov proc-sz ov inod-sz ov file-sz ov
00:05:00 N/A N/A 1263/6000 0 2315/52096 0 208980/330800 0
00:10:00 N/A N/A 1249/6000 0 2306/52096 0 208839/330800 0
......
11:25:00 N/A N/A 1445/6000 0 2422/52096 0 287402/330800 0
11:30:01 N/A N/A 1427/6000 0 2407/52096 0 280057/330800 0
11:35:00 N/A N/A 1437/6000 0 2411/52096 0 279036/330800 0
其中:file-sz为279036/330800,即表示当前打开的文件数量是279036,nfile参数的值是330800
3.2 glance命令
然后输入“H”,再输入“t”,可得如下界面:
System Table Available Used Utilization High(%)
--------------------------------------------------------------------------------
Proc Table (nproc) 4096 352 9 9
File Table (nfile) 661600 4816 1 1
Shared Mem Table (shmmni) 4096 10 0 0
Message Table (msgmni) 4096 2 0 0
Semaphore Table (semmni) 8192 32 0 0
File Locks (nflocks) 8192 39 0 0
Pseudo Terminals (npty) 60 0 0 0
Buffer Headers (nbuf) na 1978 na na
4、动态设置nfile参数值,不影响在线业务
执行kctune nfile=xxxx命令,当前生效且重启也生效,下面信息中也提示,该参数建议使用默认值
db178.cm2:/home/fengjing/kmif>#kctune nfile=661600
==> Update the automatic 'backup' configuration first? y
* The automatic 'backup' configuration has been updated.
* Future operations will update the backup without prompting.
WARNING: The tunable nfile has been deprecated and should not be tuned
to a non-default value. See nfile(5) for details on this
tunable.
* The requested changes have been applied to the currently
running configuration.
Tunable Value Expression Changes
nfile (before) 330800 (21*nproc+204800) Immed
(now) 661600 661600
db178.cm2:/home/fengjing/kmif>#
如果设置nfile=0,则表示对nfile不限制,HP-UX 11.31版本开始建议设置nfile为0,且从该版本开始,nfile的默认值也为0。
nfile设置为0后,其实是表示HP-UX将废弃该内核可调参数,HP-UX系统将会自动的调整系统资源来协调工作。
从man nfile的信息中,也可以看出在将来的版本中会废弃nfile这个参数,如下:
...
WARNINGS
This tunable is obsolete and will be removed in a future release of
HP-UX.
...
5、lsof工具
需单独安装该工具。
可用户查看某进程打开的文件系统等详细信息(待确认)
6、crashinfo工具
需要单独安装。
可以查看各个进程的打开文件数,如下:
my_db01#[/tmp] ./crashinfo -ofiles
crashinfo (4.74)
Note: HP CONFIDENTIAL
libp4 (9.305): Opening /stand/vmunix /dev/kmem
Loading symbols from /stand/vmunix
Kernel TEXT pages not requested in crashconf
Will use an artificial mapping from a.out TEXT pages
Command line: ./crashinfo -ofiles
crashinfo (4.74)
pid p_maxof ofiles p_comm
----- ------- ------ ------
1 4096 2 init
2011 4096 4 getty
……
22466 4096 51 oracle
12300 4096 847 oracle
12898 4096 9 oracle
12302 4096 979 oracle
13003 4096 671 oracle
13009 4096 670 oracle
13012 4096 459 oracle
13014 4096 49 oracle
Total = 116775
说明:pid为进程号,ofiles为打开的进程,找到几个ofiles最多的进程号,再执行ps -ef|grep pid,可以查看具体的进程信息,如下
my_db01#[/tmp]ps -ef |grep 12298
oracle 12298 1 0 Jan 15 ? 9:31 ora_dbw0_orasid
root 12469 11867 1 02:06:39 pts/te 0:00 grep 12298
my_db01#[/tmp]ps -ef |grep 12300
oracle 12300 1 0 Jan 15 ? 9:32 ora_dbw1_orasid
root 13363 11867 0 02:16:09 pts/te 0:00 grep 12300
my_db01#[/tmp]
阅读(10140) | 评论(0) | 转发(1) |