On 8 July 2015 at 12:00:45, Rambabu (
rambabu...@gmail.com) wrote:
> 1. Do every producer/consumer need to maintain connection
> always? ( for incoming messages)
Yes, all protocols that RabbitMQ supports assume long lived connections.
> 2. Every consumer and producer should have queue?
Producers don't use queues but some may argue that having a reply queue (see Tutorial 6)
is pattern when producers temporarily do. Not sure if this answers your question.
> 3. Do we need to create exchange for each chat group and one to one
> chat?
You can publish "directly" to a queue using default exchange but for
better isolation of chat rooms it's a good idea.
> 4. What could be the maximum limits of connections, exchanges
> and queues?
For connections and queues, amount of RAM: see
http://www.rabbitmq.com/networking.html.
For exchanges, I honestly can't remember anybody to running into
an issue because of too many exchanges.
> I observered each empty queue is taking around 8k of memory, each
> connection is taking 60k, exchanges are taking very little memory.
The amount of RAM used by connections is directly related to TCP buffer
configuration. 60K sounds too low (with stock Linux and OS X settings
on 64 bit machines).
> If each produer/consumer has one connection and one queue it
> will be huge memory consumption. Please suggest me better ways.
You can greatly reduce amount of RAM used by connections at the cost
of throughput, as described on
http://www.rabbitmq.com/networking.html.
You can (and probably will) run more than one node and distribute connections
between them. This should help distribute queue masters (currently a queue is hosted
on the node it was declared on).
Depending on your requirements, having queue or message TTL (or queue size limit)
may be appropriate and it can help you reduce peak RAM use.
If I was building a chat app today, I'd look into XMPP first (e.g. ejabberd),
not RabbitMQ.
--
MK
Staff Software Engineer, Pivotal/RabbitMQ