更改linux的最大檔案描述符限制

來源:互聯網
上載者:User
ile Descriptor Requirements (Linux Systems)

To ensure good server performance, the total number of client connections, database files, and log files must not exceed the maximum file descriptor limit on the operating system (ulimit -n). By default, the directory server allows an unlimited number of connections but is restricted by the file descriptor limit on the operating system. Linux systems limit the number of file descriptors that any one process may open to 1024 per process. (This condition is not a problem on Solaris machines, x86, x64, or SPARC).

After the directory server has exceeded the file descriptor limit of 1024 per process, any new process and worker threads will be blocked. For example, if the directory server attempts to open a Oracle Berkeley JE database file when the operating system has exceeded the file descriptor limit, the directory server will no longer be able to open a connection that can lead to a corrupted database exception. Likewise, if you have a directory server that exceeds the file descriptor limit set by the operating system, the directory server can become unresponsive as the LDAP connection handler consumes all of the CPU's processing in attempting to open a new connection.

To fix this condition, set the maximum file descriptor limit per process on Linux machines.

 

To Increase the File Descriptor Limit (Linux)
  1. Display the current hard limit of your machine.

    The hard limit is the maximum server limit that can be set without tuning the kernel parameters in proc file system.

    $ ulimit -aHcore file size (blocks)       unlimiteddata seg size (kbytes)        unlimitedfile size (blocks)            unlimitedmax locked memory (kbytes)    unlimitedmax memory size (kbytes)      unlimitedopen files                    1024pipe size (512 bytes)         8stack size (kbytes)           unlimitedcpu time (seconds)            unlimitedmax user processes            4094virtual memory (kbytes)       unlimited
  2. Edit the /etc/security/limits.conf and add the lines:
    *     soft   nofile  65535*     hard   nofile  65535 
  3. Edit the /etc/pam.d/login by adding the line:
    session required /lib/security/pam_limits.so
  4. Use the system file limit to increase the file descriptor limit to 65535.

    The system file limit is set in /proc/sys/fs/file-max .

    echo 65535 > /proc/sys/fs/file-max
  5. Use the ulimit command to set the file descriptor limit to the hard limit specified in/etc/security/limits.conf.
    ulimit -n unlimited
  6. Restart your system.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.