要设置Linux进程的资源限制,可以使用 ulimit 命令或者使用 /etc/security/limits.conf 配置文件。
username soft nofile 10000
username hard nofile 20000
需要注意的是,ulimit 命令设置的资源限制只对当前 shell 进程和其子进程有效,而 /etc/security/limits.conf 配置文件中的配置对系统中的所有进程都生效。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:Linux进程资源:如何限制使用