1
ulimit的用法
source link: https://bajie.dev/posts/20240118-ulimit/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Ulimit的用法
2024-01-18
1 分钟阅读
基本常识,各种语焉不详啊,其实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
...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK