In the JMS client we use the prefetch value in determining two
important heuristics in addition to using it for flow control.
1. We use the prefetch value to determine the batch size for message acks.
Ex. if ack mode is auto-ack or dups-ok-ack and if unackedCount >=
prefetch/2 then we flush the acks.
The above is done to ensure that the credits doesn't dry up while
still not incurring a penalty due to frequent acking.
2. In transacted mode we use the prefetch value to determine if we
need to send completions to ensure that credits don't dry up.
Or else applications could potentially endup in a deadlock if
prefetch was incorrectly configured.
Ex. Prefetch is set at 10, but the application logic maybe waiting
for some control message to commit, but that message may not be in the
first 10 messages.
However the above situation becomes a bit complicated when we
introduce per destination flow control (QPID-2515) as the above are
determined at session level.
(Perhaps the proper solution here is per session flow control, instead
of per destination ? )
Therefore when capacity is specified at the destination level (which
overrides the connection default) the above calculations may cause
undesired behaviour.
Possible solutions that comes to mind,
1. We allow these two heuristics to be explicitly configured. Ex
qpid.ack-batch-size and qpid.tx-ack-batch-size.
Pros: This may allow the application developer/admin to tune the
client based on the applications behaviour.
Cons: If the application deviates from the predicted behaviour
this could affect performance or worse.
2. We use some sort of mathematical formula that will use the
capacity specified in the destinations of the consumers attached to
that session, to determine the batch sizes.
Pros: Puts less burden on the end users
Cons: Creating such a formula may not be straightforward.
Your comments and suggestions are most appreciated !
Regards,
Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]