Linux用户资源限制-ulimit

 2023-09-05 阅读 115 评论 0

摘要:为什么80%的码农都做不了架构师?>>> 如果你的linux用户跑了很多程序,java进程等等,就有可能出现如下问题: There is insufficient memory for the Java Runtime Environment to continue. Cannot create GC thread. Out of system res

为什么80%的码农都做不了架构师?>>>   hot3.png

如果你的linux用户跑了很多程序,java进程等等,就有可能出现如下问题:
There is insufficient memory for the Java Runtime Environment to continue.
Cannot create GC thread. Out of system resources.
或者
java.io.IOException: Too many open files
出现这个原因,有可能是系统限制了用户的资源使用,所以需要使用ulimit来设置用户能获得的资源,使用命令:ulimit -a,查看资源配置情况,一般我们需要修改的是open files和max user processes,open files对应的配置是nofile,用户打开文件最大的数量,max user processes对应的配置是nproc,用户启动最大的线程数。

  • 修改/etc/security/limits.conf文件,将noproc和nofile修改成如下值:
* soft noproc 143622
* hard noproc 143622
* soft nofile 196605
* hard nofile 196605
  • nproc在/etc/security/limit.conf中修改有可能不生效,在/etc/security/limits.d/90-nproc.conf中修改才生效,修改/etc/security/limits.d/90-nproc.conf文件,将nproc修改成如下值:
* soft nproc 143622
* hard nproc 143622

修改后重启或重新ssh连接服务器,使用命令ulimit -a即可看到效果。
参考:
ulimit -a详解
Linux下修改ulimit设置的最大进程

转载于:https://my.oschina.net/cjun/blog/761226

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/2/960.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息