Linux 使用者開啟進程數的調整

來源:互聯網
上載者:User

標籤:

Linux 使用者開啟進程數的調整

參考文章:

關於RHEL6中ulimit的nproc限制(http://www.cnblogs.com/kumulinux/archive/2012/12/16/2820609.html)

!! 本文內容僅在 RHEL6.4 上測試通過.本文僅針對所有使用者

1 查看nproc(max user processes)命令

[[email protected] ~]# ulimit -u14866

2 修改nproc

臨時修改, 重登入或重啟後失效:

[[email protected] ~]# ulimit -u 32768
[[email protected] ~]# ulimit -u
32768

嘗試在 /etc/security/limits.conf 中加入下面的配置:

*    soft    nproc     32768

退出目前使用者, 重登入或重啟後, 查看發現配置仍然失效.

繼續嘗試在 /etc/security/limits.d/90-nproc.conf 中加入配置:

*    soft    nproc     65536
退出目前使用者, 重登入或重啟後, 查看發現配置仍然失效.

繼續嘗試在 /etc/security/limits.d/90-nproc.conf 中加入配置:

* soft nproc 65536* hard nproc 65536
重登入或重啟後, 查看發現配置生效. 可見hard nproc起作用.

3 結論

 臨時修改(shell中不受限制, xxx可以是任何數, 說明這個修改沒有意義):

# ulimit -u xxx

永久修改, 保險的做法是同時修改 /etc/security/limits.d/90-nproc.conf/etc/security/limits.conf如下:

limits_conf = /etc/security/limits.conf:

*   soft   nproc    s1*   hard   nproc    h1

nproc_conf = /etc/security/limits.d/90-nproc.conf:

*   soft    nproc    s2*   hard    nproc    h2

s1,h1,s2,h2必須是具體有意義的數. 此時ulimit -u顯示的值為=min(h1,h2)

因此通常就設定s1=s2=h1=h2, 例如在limits_confnproc_conf中同時加入:

*   soft   nproc   16384*   hard   nproc   16384

Linux 使用者開啟進程數的調整

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.