如何调整套接字描述符? [英] How to adjust socket descriptors?

查看:45
本文介绍了如何调整套接字描述符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道谁来调整socket描述符的数量?

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

另外,如何在有限的超时时间内自动关闭连接?

In addition, how to auto-close the connection for limited timeout?

推荐答案

看来您必须更改系统中最大打开的文件描述符.

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

来自 Debian 和 Ubuntu 系统的 RabbitMQ 安装手册,部分 控制系统限制:

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

运行生产工作负载的 RabbitMQ 安装可能需要系统限制和内核参数调整以处理合适的数字并发连接和队列.需要的主要设置调整是打开文件的最大数量,也称为 ulimit -n.许多操作系统上的默认值对于消息传递来说太低了代理(例如,几个 Linux 发行版上的 1024).我们推荐允许至少 65536 个文件描述符用于用户 rabbitmq生产环境.4096 对大多数人来说应该足够了开发工作负载.

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.

有两个限制:操作系统打开的最大文件数内核允许 (fs.file-max) 和每个用户的限制 (ulimit -n).这前者必须高于后者.

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.

调整RabbitMQ的每用户限制最直接的方法是编辑/etc/default/rabbitmq-server(由RabbitMQ提供)Debian 包)或 rabbitmq-env.conf 在服务已启动.

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

这个软限制不能高于硬限制(默认在许多发行版中为 4096).可以通过以下方式增加硬限制/etc/security/limits.conf.这也需要启用pam_limits.so 模块并重新登录或重启.

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.

有关使用 sysctl 控制 fs.file-max 的更多信息,请请参阅优秀的 关于打开文件限制调整的 Riak 指南.

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

附注:

RabbitMQ 邮件列表中讨论了类似的问题增加文件描述符限制".最后一条消息包含指向 RabbitMQ 安装文档的最终链接,并明确指出 ulimit 问题,但通读它也可以帮助您解决问题,同时整个线程涵盖了不同点的描述符限制问题.

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.

这篇关于如何调整套接字描述符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆