Reputation: 850
To limit the number of open connections to our database I need to limit the number of simultaneous function calls.
MassTransit has the UseConcurrentMessageLimit
which apparently restricts the number of messages each host instance will process simultaneously, is this the same as maxConcurrentCalls
from host.json?
The Azure portal has the App Scale Out -> Maximum Scale Out Limit which restricts the number of hosts that will be created.
To limit the number of simultaneous function calls to n should I set Maximum Scale Out Limit * UseConcurrentMessageLimit or maxCurrentCalls
= n?
Can I achieve this with one parameter in MassTransit or the Azure Functions configuration?
Upvotes: 1
Views: 583
Reputation: 33278
With MassTransit, for a given receive endpoint, ConcurrentMessageLimit
should be used to limit the number of concurrent consumers executing on that particular receive endpoint. This setting only affects the receive endpoint on that service instance.
If you have multiple instances, and a hard limit of say 100 connections to your back-end database, and each instance has a ConcurrentMessageLimit
of 20, then you could have a maximum number of 5 instances to stay within that 100 connection limit (assuming each consumer uses a single connection to the database).
Both
UseConcurrentMessageLimit
andMaxConcurrentCalls
are deprecated and retained only for backwards compatibility. The only configuration value that should be used for current applications isConcurrentMessageLimit
. This is covered in this video.
Oi, you're talking about Azure Functions. MassTransit has no control over the receiver used to pull messages and deliver them to consumers. I think host.json
is where you need to configure it, and it's probably maxConcurrentCalls
that would be similar.
Upvotes: 1