java - RabbitMq,客户端突然关闭TCP连接

标签 java client rabbitmq

我正在编写一个小程序,用于抓取从 RabbitMQ 队列收到的所有 url。我测试了大约 6000 个 url,在处理了一半后,客户端无一异常(exception)地停止,所有与rabbitmq服务器的连接都丢失了。我还检查了日志并有类似的内容

=WARNING REPORT==== 7-Apr-2016::10:40:50 ===
closing AMQP connection <0.32373.9> (192.168.55.1:55716 -> 192.168.55.100:5672):
connection_closed_abruptly

我正在使用此连接工厂设置:

ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.55.100");
        factory.setUsername(params.username);
        factory.setPassword(params.password);
        factory.setVirtualHost(params.virtualHost);
        factory.setAutomaticRecoveryEnabled(true);
        factory.setRequestedHeartbeat(2);

你对此有什么想法吗?问候!

最佳答案

您必须配置 RabbitMQ 和您的操作系统才能处理更多连接。

阅读此内容:https://www.rabbitmq.com/networking.html

Erlang VM I/O Thread Pool Erlang runtime uses a pool of threads for performing I/O operations asynchronously. The size of the pool is configured via the +A VM command line flag, e.g. +A 128. We highly recommend overriding the flag using the RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS environment variable:

RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS="+A 128"

还有这个:https://www.rabbitmq.com/production-checklist.html

Open File Handles Limit Operating systems limit maximum number of concurrently open file handles, which includes network sockets. Make sure that you have limits set high enough to allow for expected number of concurrent connections and queues.

关于java - RabbitMq,客户端突然关闭TCP连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36478496/

相关文章:

java - 日历 - 时间间隔

java - pom.xml 文件没有配置好

java - 在 Java 中通过 TCP 发送 ArrayList<String[]> 的最佳方式?

python - 'METHODNAME' 作为客户端方法与扭曲的 irc _'METHODNAME'

C# TCP 服务器模拟

asp.net - 使用 RabbitMQ 或 SignalR 的微服务架构

java - 如何在 RetroFit 中使用 Gson 转换器?

java - Java 中的时间间隔本地化

docker - 如何防止在Dockerfile的中间步骤中丢失RabbitMQ设置?

RabbitMQ 因凹凸减少内存使用而崩溃