activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TiredAndEmotional <>
Subject Blocking consumers not consuming immediately
Date Wed, 04 Jul 2007 10:50:47 GMT


A brief outline of my set up: 5 dual core machines, one running activemq and
a message producer communicating via a queue with 8 consumers spread across
the other 4 machines. 2 classes of message, 2 of the consumers have
selectors set so that they only select one class of message, the other 6
accept either class of message. Consumption of messages of the selected
class takes approximately 0.1 seconds, consumption of the other class takes
approximately 7 seconds. Message consumption is single threaded on each
consumer, and more or less completely chews up all of a single core's
processing time. 

The loop to consume and process messages is as follows, i.e. the consumer
blocks until it receives a message:

			}catch(JMSException e){
				logger.warn("Problem with Node MessageConsumer.receive().", e);
			//Check message isn't null
			if(message==null){//Can this ever occur?
			//Unwrap message
			}catch (Exception e){"Failed to extract ServerMessage from "+m+". Message
			//Process message
		}//end while(keepLooping)

My problem is that when I look at the status of the queue on jconsole, often
there will be a few (i.e. 1 to 5) messages on the queue whilst many of the
consumers aren't doing anything. Messages are small, on the order of 1-2kb
at most. I changed the prefetch value to 1 for the generic consumers and 3
for the selector consumers, but this does not seem to have fixed the
behaviour. The broker has enqueued/dequeued approximately 340000 messages at
this point in time. Consumers have been restarted a number of times,
including very recently, and this has not affected the behaviour. 

To give an idea of the size of delays, sometimes messages are received by a
consumer 2 minutes or more after they have been sent, when it is clear that
the total amount of processing time required for all messages sent is much,
much, much less than the consumer time available, i.e. there is no load
explanation for the delay. In particular the queue never grew to more than 4
or 5 pending messages in this 2 minute period, hence the greatest possible
load delay would have been 10 seconds rather than 2 minutes.

Does anyone have any ideas as to what might be causing this?

Many thanks for your responses in advance.

Best Regards,

Steve Siller
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message