[rabbitmq-discuss] creating connections to RMQ

Matthias Radestock matthias at rabbitmq.com
Thu Feb 14 12:00:29 GMT 2013


Rob,

On 13/02/13 16:26, Rob Woolfson wrote:
> We are looking at the best way to use only one connection and have only
> the channel created each time.  Bear in mind that its all happening on
> the same physical server and the servers that I refer to are actually
> software services as opposed to different physical machines.  So network
> latency shouldnt be a big problem here.

Connections, and, to a (much) lesser degree channels, are comparatively 
expensive, to create. And latency matters, even for local connections.

Anyway, I suggest you start by figuring out how to re-use the 
connection. As you say. That should make a massive difference and might 
be all you need to do in order to get sufficient performance for your 
use case.

> The application is for trading.
>
> S1 receives a signal to open a trade and sends the order to S2 which is
> responsible for sending the trade to the brokers.  When S1 receives a
> signal to open the trade it creates an object to manage all the
> communication back and forth between the broker.  So it creates a queue
> that will route all incoming messages to do with that specific trade
> back to the object.  For this reason the object (which is a new object
> for each trade) will create a new channel, queue and binding,
> specifically for the life of the trade.

That is actually quite reasonable. It's not the most efficient - as 
Simon says, queue creation is expensive - but fits your business domain 
well, so I'd stick with that design until other avenues for increasing 
performance have been exhausted.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list