How to adjust socket descriptors?

后端 未结 5 715
盖世英雄少女心
盖世英雄少女心 2021-02-02 11:15

\"enter

I want to know who to adjust quantity of the socket descriptors?

In additi

5条回答
  •  时光说笑
    2021-02-02 12:04

    Looks like you have to change max opened file descriptors in your system.

    From RabbitMQ installation manual for Debian and Ubuntu systems, section Controlling system limits:

    RabbitMQ installations running production workloads may need system limits and kernel parameters tuning in order to handle a decent number of concurrent connections and queues. The main setting that needs adjustment is the max number of open files, also known as ulimit -n. The default value on many operating systems is too low for a messaging broker (eg. 1024 on several Linux distributions). We recommend allowing for at least 65536 file descriptors for user rabbitmq in production environments. 4096 should be sufficient for most development workloads.

    There are two limits in play: the maximum number of open files the OS kernel allows (fs.file-max) and the per-user limit (ulimit -n). The former must be higher than the latter.

    The most straightforward way to adjust the per-user limit for RabbitMQ is to edit the /etc/default/rabbitmq-server (provided by the RabbitMQ Debian package) or rabbitmq-env.conf to invoke ulimit before the service is started.

    ulimit -S -n 4096

    This soft limit cannot go higher than the hard limit (which defaults to 4096 in many distributions). The hard limit can be increased via /etc/security/limits.conf. This also requires enabling the pam_limits.so module and re-login or reboot.

    Note that limits cannot be changed for running OS processes.

    For more information about controlling fs.file-max with sysctl, please refer to the excellent Riak guide on open file limit tuning.

    P.S.:

    The similar issue was discussed in RabbitMQ mailing list "Increasing the file descriptors limit". The last message contains final link to the RabbitMQ installation document and explicitly point to ulimit issue, but reading through it also may help you to deal with you problem while the whole thread covers the descriptors limit issue from different points.

提交回复
热议问题