“Max open files” for working process

后端 未结 8 661
春和景丽
春和景丽 2020-12-02 17:33

Is it possible to increase \"Max open files\" parameter for working process ? I mean this parameter:

cat /proc//limits | grep files
相关标签:
8条回答
  • 2020-12-02 18:23

    The following commands give the max # of open files per process permissible by default limits (soft and hard respectively):

    ulimit -Sa
    ulimit -Ha
    

    You can use a program or a command to change these limits. Look at ulimit (man ulimit).

    0 讨论(0)
  • 2020-12-02 18:26

    On Ubuntu 16.04, with a rethinkdb process running, none of these solutions worked.

    I kept getting error: accept() failed: Too many open files.

    What ultimately worked was this in my /etc/security/limits.conf file. Note the nproc in addition to the nofile. As I understand it, root needs to specified separately.

    *                soft    nofile          200000
    *                hard    nofile          1048576
    root             soft    nofile          200000
    root             hard    nofile          1048576
    *                soft    nproc           200000
    *                hard    nproc           1048576
    root             soft    nproc           200000
    root             hard    nproc           1048576
    

    You can see the system max files by running cat /proc/sys/fs/file-max. I just set mine to a high maximum well within reason for the size of the server.

    You can verify the max open files your process is allowed by running cat /proc/{your-pid}/limits.

    Helpful post: https://medium.com/@muhammadtriwibowo/set-permanently-ulimit-n-open-files-in-ubuntu-4d61064429a

    0 讨论(0)
提交回复
热议问题