MaxDequeueThread and MaxReceiveInterval in the adm_Service table

One of the questions we were recently asked for was about the MaxDequeueThread and MaxReceiveInterval settings. Unfortunately, there is no useful description on them in the BizTalk Server R2 RTM documentation, and the question was 1) how to adjust them, 2) what they are for, and 3) when they could be used .
Both of the switches are used to mainly control throttle of pumping messages from the MessageBox to the Message Agent for outbound processing in the following image:


1)      How to adjust them
You can customize the settings through the adm_Service table in the BizTalk management database. The table contains one record for each service type like Xlang, MSMQT, and “Messaging InProcess”.  So you should be careful when you change this setting because this is a service-type-wide change.

2)      What they are for
1.The MaxDequeueThread setting is used to limit the number of threads in the NT thread pool for the dequeuing operation.  The dequeuing operation calls a stored procedure, bts_DeQueueMesssages in the current implementation, to retrieve messages in a batch from the message box and pushes them into the in-flight message queue, which is an in-memory list.  The number of threads that a host instance uses won’t exceed the MaxDequeueThread setting. The default is 5, and the minimum value will be technically 1.
2.The MaxReceiveInterval setting is used
    a.To specify the time interval in millisecond for which the throttle controller checks the system status to decide whether a throttle controlling is needed.
    b.To specify the time interval in millisecond for which the throttle controller delays to dispatch messages to the services under certain throttling conditions where the batch containing the messages was already created before the throttling condition starts.  Throttle controller incrementally delays the message dispatch for this setting at a time up to for a time interval, which is dynamically adjusted depending on its stress condition.
    c.To specify the maximum time interval in millisecond for creating a thread for the dequeuing operation. In fact, if the MessageBox has remaining messages unprocessed, it starts new dequeuing operation thread right away without waiting. So, In high volume systems, this interval won’t be used at all.  Once this value is used, the time interval will be dynamically changed between MaxReceiveInterval/10 and MaxReceiveInterval. The default value is 500 and the minimum value is 0. 

3) When they could be used
They could be used for the low latency scenario, but if your SQL server can’t take the extra load from more frequent polling the server would cause then it would be negative impact.  We don’t recommend modifying these setting as far as possible.  But, if you have to, remember it would reduce latency only with the right deployment, solution, and hardware, and you have to test your solutions to make sure your assumptions.