[jboss-user] [JBoss Messaging] - Re: Best practices question

timfox do-not-reply at jboss.com
Sat Jul 22 15:45:17 EDT 2006


Hello Todd-

There are a couple of things to bear in mind here.

Firstly, having a large number of selectors on a queue which select few of the messages is generally an anti-pattern and will always have poor performance since, since for every receive() the queue needs to be iterated through until a selected message is obtained for each consumer.

The performance of this could be improved by using indexes but it will never be great and should be avoided.

See http://jira.jboss.com/jira/browse/JBAS-1348 for a discussion of this in JBoss MQ - the same theory more or less applies in JBoss Messaging.

Secondly there is a known bug in JBoss Messaging http://jira.jboss.com/jira/browse/JBMESSAGING-275 which means only the first consumer will get the message, as you have found out.

This bug is due to be fixed in 1.0.2.

In the mean-time if you can use a topic instead of a queue this won't exhibit the problems you have been seeing and the performance will always be much better. This is because a topic subscription will not accept  any messages that don't match the selector, but a queue will since it cannot know in advance any selectors that consumers might use.

Finally, the "correct" solution to this problem would be to use a new feature which allows consumers to group themselves according to JMSXGroupId.

JBoss Messaging will then ensure that any messages with a particular value of JMSXGroupId is only consumed by consumers in that group. Users can configure how many consumers in each group.

This task is discussed here: http://jira.jboss.com/jira/browse/JBMESSAGING-375

This allows partitioning of load and this feature is currently scheduled for 1.0.6 (hmmm I'll see if we can get this done sooner)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960127#3960127

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960127



More information about the jboss-user mailing list