We've been bitten by this with firewalls that close connections after idle timeouts. Best solution I can come up with is to use TCP keepalives.<div><br></div><div>If you client supports setting TCP options during the connection, that's all you need to do for the client side part. For the server side, I couldn't find any options for this in the rabbit config, so we implemented libkeepalive to force the server to use keepalives. </div>
<div><br></div><div>Rabbit folks, please add this as an option to the server.</div><div><br></div><div>Cheers,<br><div><br clear="all">Mark Steele, CISSP, CSM<br>Bering Media Inc.<br><div><br></div><div class="gmail_quote">
On Tue, Jan 3, 2012 at 9:41 AM, Alexandru Scvorţov <span dir="ltr"><<a href="mailto:alexandru@rabbitmq.com">alexandru@rabbitmq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> With 100's of computers connected to rabbitmq with persistent connections,<br>
> would this pose any problems?<br>
<br>
Not unless you run out of free file handles. On normal installations,<br>
it should handle up to thousands of connections without difficulty. You<br>
could further configure it to support more connections.<br>
<br>
> Does it time-out by default?<br>
<br>
No. Connections are not timed out.<br>
<br>
> Why use a heartbeat? Is it to re-establish if the heartbeat fails?<br>
<br>
If the network fails between a client and the broker, and there's no<br>
traffic between them at that point, both will think the connection is<br>
still open, even though it isn't. Heartbeats ensure that both broker<br>
and client are notified fairly quickly if the connection fails.<br>
<br>
> Would it be better for clients to close connections and only open a<br>
> connection when necessary?<br>
<br>
It depends on your use case.<br>
<br>
> For reading messages we need persistent connections.<br>
> But for writing, and I can see how we could potentially only open a<br>
> connection to write a message when required.<br>
<br>
For consuming messages *efficiently*, you need persistent connections.<br>
If you only get messages very rarely, you could open a connection, poll<br>
the broker with basic.get and then close the connection. But, if you<br>
need to consume a lot of messages, you probably want persistent<br>
connections anyway.<br>
<br>
Hope this helps.<br>
<br>
Cheers,<br>
Alex<br>
<br>
On Thu, Dec 29, 2011 at 05:21:26PM -0500, S Ahmed wrote:<br>
> With 100's of computers connected to rabbitmq with persistent connections,<br>
> would this pose any problems?<br>
><br>
> Does it time-out by default?<br>
><br>
> Why use a heartbeat? Is it to re-establish if the heartbeat fails?<br>
><br>
> Would it be better for clients to close connections and only open a<br>
> connection when necessary?<br>
><br>
> For reading messages we need persistent connections.<br>
><br>
> But for writing, and I can see how we could potentially only open a<br>
> connection to write a message when required.<br>
<br>
> _______________________________________________<br>
> rabbitmq-discuss mailing list<br>
> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div></div>