CPU vs I/O-bound processing
The following settings are used in order to tune performance:
MaximumConcurrencyLevel
BatchSize
LockDuration
MaxDeliveryCount
In scenarios where handlers perform CPU intensive and not I/O intensive work (such as in-memory computations), it is recommended to lower the number of threads to one and increase the BatchSize
. LockDuration
and MaxDeliveryCount
might require an adjustment to match the batch size, taking into account the number of messages that end up in the dead letter queue.
In scenarios where handlers perform I/O intensive work, it is recommended to set the number of threads to 12 threads per logical core using MaximumConcurrencyLevel
setting and set the BatchSize
to a number of messages that takes to process. Take into account the expected (or measured) processing time and I/O latency of a single message. Start with a small BatchSize
and through adjustment and measurement gradually increase it, while adjusting accordingly LockDuration
and MaxDeliveryCount
.
For more information on those settings, refer to the Tuning endpoint message processing, ASB Batching, ASB Message lock renewal and ASB Retry behavior articles.