Recommended configuration for MongoDB C# hosted on Azure app service

I’m aware of limits on azure app services, like max outbound tcp connections.

Are there recommended configuration settings for using the Mongo C# driver in a busy application hosted on an azure app service. Things like - min/max connection pool size, timeouts, wait queue multiple (although this seems set for deprecation)

Hi @Paul_Allington, thanks for your question!

There’s nothing specific to the driver that needs to be addressed; the limits on Azure App Services still apply.

One thing that is worth mentioning is to instantiate your MongoClient as a singleton in your application, as recommended by the docs. In this way, you can take advantage of connection pooling.

I have it as a singleton yeah. Occasionally we get a big spike in waitqueuefullexceptions. So I wondered what defaults are recommended based on the limits in azure. Like what should be the max connection pool size and the timeouts?

Just to add on, when doing same query with nodejs i send 1000 concurrent request with ramp up period 1 sec from Jmeter and less than 1% request errors out but the same query errors 30-35% request using net core 6, don’t know why

1 Like

Hi Paul, we have just started experiencing this ourselves on a similar set up. Did you get to the bottom of a sensible set of defaults?