activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Snyder <>
Subject Re: ActiveMQ consumer performance and scalability
Date Wed, 15 Dec 2010 16:29:19 GMT
On Wed, Dec 15, 2010 at 7:41 AM, Stanislaw Kogut <> wrote:
> Hello.
> I'm currently evaluating ActiveMQ as a message broker for our service. We
> need scalable, transacted, low-latency message broker, but ActiveMQ shows
> not very good results to me.
> Config: ActiveMQ 5.4.2 with nio:// transport, KahaDB persistence adapter and
> data directory on tmpfs filesystem (to get rid of disk performance impact).
> In details: With persistence enabled and commiting every message sent to
> broker we have about 2k messages/s on producer side, and similar consuming
> speed with one producing thread.
> It also has good latency - about 5 milliseconds to deliver message, but 2k
> msg/s can be slow in future, so I'm trying to commit messages after some
> count of them sent, for example after every 100 messages. This shows better
> throughput, about 10k messages/s, but now consumer side looks slow. Also,
> latency is increased because time to fill this "100 messages" cap.
> Also, consumer side is not able to consume all these messages on this rate
> and queue length grows.
> It is very possible also, I will have more than one producer for one queue
> because of application design. I also test this scenario and producers are
> relatively fast, but consumer become very slow, receiving 1-2 messages per
> second. With enabled producer flow-control broker can stop producers and
> serve consumer better, but it has very bad impact on latency as producer
> should wait for broker to acknowledge messages, preventing new data from
> being sent.
> Is there is a way to consume messages from queue faster? I'm tried both
> implementing MessageListener and MessageConsumer.receive(), but both show
> same result. Usage of vmCursor or prefetching in broker makes no changes to
> situation.
> Also, is there any topology for distirbuting one ActiveMQ queue to more than
> one machine without big latency impact to increase it's throughput?

First thing to do is use many consumers that are concurrently
receiving messages from the queue. A single consumer will not be able
to keep up simply due to the JMS message consumption model. I tend to
use many more consumers than producers. Also, I generally prefer a
message listener for most scenarios. Here are a few more tips:

perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"

ActiveMQ in Action:

View raw message