做网站专题模板,目前好的推销网站,网页设计个人简介模板代码,手机网站快速排名 软件1. limits是一个进程的资源#xff0c;会被子进程继承2. soft limit -S, hard limits -Hhard limits只能被root用户修改#xff0c;启动的时候会加载配置/etc/security/limits.confsoft limits可以被任何用户修改#xff0c;但不能超过hard limits3. 在linux下#xff0c;每…1. limits是一个进程的资源会被子进程继承 2. soft limit -S, hard limits -H hard limits只能被root用户修改启动的时候会加载配置/etc/security/limits.conf soft limits可以被任何用户修改但不能超过hard limits 3. 在linux下每个进程的limit信息保存在/proc/PID/limits文件中(linux OS kenerl 2.6.24)。低于2.6.24版本的kenerl需要手动统计 /proc/PID/fd下面有多个少个文件。 4. lsof -p pid显示所有的打开文件包括shared library lsof 会统计一些duplicate的open file 5. system-wide fd sysctl -a vim /etc/sysctl.conf 6. max open file on the system cat /proc/sys/fs/file-max 7. stat the openning file from the kenerl point of view cat /proc/sys/fs/file-nr 864 0 3274116have 864 out of max 3274116 open files8.利用lsof统计每个进程打开的文件数目lsof -n |awk {print $2}|sort|uniq -c |sort -nr|more 9. 设置普通用户下打开文件的最大值 ulimit -n 4096-bash: ulimit: open files: cannot modify limit: Operation not permitted9.1 在/etc/security/limits.conf中添加* hard nofile 100000* soft nofile 1000009.2 /etc/pam.d/login 添加 session required /lib64/security/pam_limits.so 9.3 重启 ssh2和rccron这样只进程就自动继承了nofile/etc/init.d/ssh2 restartrccron restart 参考文献 1. http://blackbird.si/checking-limits-of-a-linux-process-ulimit/ 2. http://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux 3. http://geekswing.com/geek/quickie-tutorial-ulimit-soft-limits-hard-limits-soft-stack-hard-stack/ 4. http://stackoverflow.com/questions/1356675/check-the-open-fd-limit-for-a-given-process-in-linux 5. http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/ 6. http://mcmvp.blog.51cto.com/5497438/1257713 7. http://www.myexception.cn/linux-unix/436451.html 转载于:https://www.cnblogs.com/Torstan/p/4097638.html