NServiceBus uses defaults that ensure good performance in common cases. While this is usually the preferred mode of operation there are situations where tuning might be desired.
Tuning concurrency
max(Number of logical processors, 2)
.Limit maximum concurrency so that no more messages than the specified value are ever being processed at the same time. Set this value to 1
to process messages sequentially. If not specified the transport will choose an optimal value that is a balance between throughput and effective ressource usage.
Examples where concurrency tuning might be relevant are
- Non thread safe code that needs to run sequentially
- Databases that might deadlock when getting too many concurrent requests
Throttling
Throughput throttling options have been deprecated. To enable throttling on Version 6 and higher, a custom behavior should be used. The throttling sample demonstrates how such a behavior can be implemented.