> On 16 Sep 2019, at 04:52, Dimitri Pekarovsky <
dimitri.p...@gmail.com> wrote:
>
> Thank you, Michael, for response.
>
> I wonder to clarify my question.
> I've read in docs, that rabbitmq don't like when clients makes multiple connections/disconnects many times (this is like my app will connect to rabbit for every http request and then disconnect).
> Sure this is not the best strategy, it's just a starting point for my assumptions.
> So I tought, will rabbit hurt from when making mutiple queues/deleting em for every http-request? You answered about temporary queues, thank you.
Well, declaring and explicitly deleting a queue, as well as every binding, is a network round trip, so if you can rely on a predeclared topology,
that’s a lot less wasteful. However, it is not always possible. Modern RabbitMQ provide metrics of queue and binding churn.
Opening new connections and channels is unnecessary as the docs explain. Opening a new connection is *multiple* round trips and a TLS
handshake if you use TLS. High connection churn is a problematic scenario for every tool, in particular those that assumes long lived connections [1].
>
> > The biggest hurdle with Rack, which was originally based on a synchronous request-response model, is how to await for a response
> in a way that is not terribly inefficient or makes error communication really hard
>
> I save env to global hash, then return [-1, {}, []], which means asynchronous and then I can call the env['async.callback'].call from the bunny consumer when response is ready. By such manner rack keeps the connection up until the call of the callback.
>
OK, assuming that works as advertised this sounds like a good option. Would you be interested in putting together an example app, publishing
it on GitHub and announcing it on rabbitmq-users? I’m sure many present and future Ruby users would appreciate that :)
1.
https://www.rabbitmq.com/networking.html#dealing-with-high-connection-churn