Details
-
Task
-
Resolution: Won't Do
-
Minor
-
None
-
JBossAS-3.2.7 Final, JBossAS-4.0.1 Final
-
None
Description
Improving Message Selector Performance
It is a common anti-pattern for users to set up a contested queue
where multiple receivers try to take messages based on a message selector.
In most circumstances a Topic is what they should be using.
But there is a circumstance where a Topic does not work as required,
that is when a message matches many of the receiver's selector but you
only want one receiver to process the message (it doesn't matter which).
The problem is that when a receiver does not match a message towards
the top of a large Queue (or none at all). The operation to find a message
or discover there are no messages is very expensive. It is read and skip.
This can be even worse when the bottom of the queue has been moved out
to disk by the MessageCache.
The solution is to provide "an index" over a particular property,
e.g.
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=A">
<optimized-selector>JMSMessageID</optimized-selector>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
</mbean>
This configuration should be passed via the BasicQueueParameters to the BasicQueue.
NOTE: This is irrevelent for Topics. Topics run their selector before the message is added
to the subscription, anything not matching the selector is dropped.