Producers are very slow when message queue becomes very large - Java Client

669 views
Skip to first unread message

Phill Tomlinson

unread,
Mar 9, 2015, 9:25:11 AM3/9/15
to rabbitm...@googlegroups.com
Hi,

I am trying to simulate a backlogged queue with millions of messages. When I do this and attach producers and consumers I notice the consumers are taking 1000's messages per second performing well, while the producers are being limited to around 5 messages per second.

If there some setting in rabbit that is preventing the producers from writing to the queue at a reasonable way?

If the queue is not backlogged I get producer writes at around 100msg/s (queue is mirrored, full acks and is durable to disk) so there must be something throttling them when the queue is large.

Thanks,
Phill

Alvaro Videla

unread,
Mar 9, 2015, 9:35:13 AM3/9/15
to Phill Tomlinson, rabbitm...@googlegroups.com
Perhaps your publishers are experiencing flow-control? See http://www.rabbitmq.com/flow-control.html
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phill Tomlinson

unread,
Mar 9, 2015, 9:37:56 AM3/9/15
to rabbitm...@googlegroups.com
Had a play with the prefetch count:

channel.basicQos(20, true);

However I've tried raising this to 1000 and now my consumers seem to get throttled (70-80 msg/s). My producers seem to have better throughput with this setting.

Is there a magic number for this to balance between consumer and producer throughput?

Simon MacMullen

unread,
Mar 9, 2015, 9:39:14 AM3/9/15
to Phill Tomlinson, rabbitm...@googlegroups.com
Which version of RabbitMQ are you running?

Cheers, Simon
> --
> You received this message because you are subscribed to the Google
> Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rabbitmq-user...@googlegroups.com
> <mailto:rabbitmq-user...@googlegroups.com>.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.

Phill Tomlinson

unread,
Mar 9, 2015, 9:48:43 AM3/9/15
to rabbitm...@googlegroups.com, p.g.to...@gmail.com
Hi,

Thanks Simon and Alvaro for getting back to me.

Version 3.4.4

Actually I had been artificially throttling my consumers with a thread sleep to try solve the issue earlier. I've removed that and my consumers are processing messages as expected.

Is there a magic number for:
channel.basicQos(5, true);

I've set it to 5 as this appears to allow the producers to continue at around 1/2 the rate. Or is it just a case of fine tuning this setting?

Alvaro Videla

unread,
Mar 9, 2015, 10:14:39 AM3/9/15
to Phill Tomlinson, rabbitm...@googlegroups.com
About basic.qos please see this blog post: http://www.rabbitmq.com/blog/2012/05/11/some-queuing-theory-throughput-latency-and-bandwidth/
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

Phill Tomlinson

unread,
Mar 9, 2015, 2:02:37 PM3/9/15
to rabbitm...@googlegroups.com, p.g.to...@gmail.com
Thank you. That was very useful. Looks like there are various tweaks I need to configure when a queue becomes backlogged.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages