On 1 May 2006, at 11:22, reza aliakbary wrote:
Hello,
Suppose this scenario: I have 10 queues in my application and I
want to consume their messages asynchronously. I want to know whether
1- it can slow down the server if I add alot of consumers to
this queues (event if they are idle) or not(For example 50 for
each queue).
There's always some overhead with adding more consumers - but it's
usually negligible. BTW you mean a queue consumer per Connection
right?
For connections, the overhead is an additional file descriptor, and
depending on your operating system, these are usually limited on a
per-process basis (free BSD is 1024), Linux (256) etc - though if
your an admin you can change these; and depending on the transport,
an additional thread.
2- What is your suggestion for adding consumers to the queues.
Should I add consumers at start of application and leave them to
consume messages or I should manage them during the life time of
application, for example removing idle consumers from the queues
that are not busy for a long time and adding consumers to the
queues that are busy.
Good question! - and really dependent on your architecture and
'weight' of consumers.
Usually it's good practice to have a few active consumers, and
monitor the depth of the Queue using JMX. You could raise JMX
notifications if the depth of a Queue exceeds a set limit and spawn
up another consumer or two, and remove consumers when there is less
load on the Queue.
Best Regards,
Reza
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for
just 2ยข/min with Yahoo! Messenger with Voice.
hope that helps,
cheers,
Rob
http://rajdavies.blogspot.com/