Chinaunix首页 | 论坛 | 博客
  • 博客访问: 267427
  • 博文数量: 107
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 74
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-18 09:57
文章分类

全部博文(107)

文章存档

2023年(2)

2021年(1)

2017年(1)

2015年(4)

2014年(9)

2013年(4)

2012年(14)

2011年(49)

2010年(23)

分类:

2010-09-19 16:15:55

在HP Unix有两个可以限制系统最大进程数的内核参数:maxuprc(max user processes)和nproc(the number of system processes);maxuprc只对普通用户生效,对root用户不生效,只有nproc才对root生效。

以下的这段日志是因为普通用户的maxuprc开的太大,即开成了maxuprc + 5 = nproc (最大值)而且应用程序发生了大量的僵尸进程(defunct)并达到了maxuprc的值引起的。基本所有的系统命令不能执行,root用户也不能远程登录。


GenericSysName [HP Release B.11.31] (see /etc/issue)
Console Login: root
Please wait...checking for disk quotas
could not execute quota command

- - - - - - - - - - - - Live Console - - - - - - - - - - - -
/etc/profile[30]: The fork function failed. Too many processes already exist.
/etc/profile[47]: The fork function failed. Too many processes already exist.

syslog中有proc table is full 的报错,这说明nproc也用满了。


发生这种情况之后,假如还有一个已登录的终端的话,可以用exec kill 来尝试杀某个进程(猜吧),如果成功,ps就可以执行了。然后再做响应处理。

我当前的系统nproc默认值是4200,maxuprc的默认值是256。maxuprc比较容易满,可以适当加大。

# kctune |grep nproc
nproc 4200 Default Immed
# uname -a
HP-UX hpux B.11.31 U 9000/800 1071694491 unlimited-user license

加大方法:

kctune maxuprc+=1024 (增加1024)

nproc大最大值我个人认为跟系统配置有关系,但肯定不能超过65535。

在HP-UX hpux B.11.31 U 9000/800 1071694491上调大maxuprc和nproc,不必重启就可以工作。

# kctune nproc+=4000
==> Update the automatic 'backup' configuration first? y
* The automatic 'backup' configuration has been updated.
* Future operations will update the backup without prompting.
* The requested changes have been applied to the currently
running configuration.
Tunable Value Expression Changes
nproc (before) 4200 Default Immed
(now) 8200 8200

用下句来测试建立6000个进程:

i=1; while :; do nohup sleep 200 & ((i=$i + 1)); echo Now No is $i;if [ $i -eq 6000 ]; then echo === Now No is $i ====; break;fi; done

我的大致理解是这样。在实际环境中还需要具体测试。











阅读(4025) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~