Quantcast
Channel: 钻戒 and 仁豆米
Viewing all articles
Browse latest Browse all 290

ulimit的用法

$
0
0

语焉不详,其实ulimit最常用的就两个参数

-u number:  单个用户能运行的最大进程数
-n number:  单个进程可以同时打开的文件描述符的最大值,缺省1024

有两个地方需要设置,Hard和Soft,Hard是Soft的最高限值,天花板。这两个值都可以针对某用户单独设置。

所以设法如下:

ulimit -S -n 10240  
ulimit -H -n 20480  
ulimit -S -u 10240  
ulimit -H -u 20480  

可以在/etc/security/limits.conf里设置

* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

也可以在/etc/rc.d/rc.local中用命令设置

cat /etc/rc.d/rc.local  
...
ulimit -u 204800 -HSn 204800  
...

Viewing all articles
Browse latest Browse all 290

Trending Articles