gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 10:05:56 26 4
gpt4 key购买 nike

我正在编写一个小程序,用于抓取从 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com