Adding timeout for mongoDB

We have some microservices which are using C# mongo driver and Node.js mongo driver. I found online (https://docs.mongodb.com/drivers/node/faq/) that we can set socketTimeoutMS and connectTimeoutMS.

Is it good idea to set these two for both .NET and node applications ? I am just concerned that if we don’t set those, the connections can stay there for a long time and number of connections might increase over the time which might cause the performance issues.

Please help!

Thanks
JW

Hi @Jason_Widener1,

Usually the defaults on the driver side should be good for most workloads.

However, if you see issues with connections while using latest driver you can test changing those.

A healthy connection pool according to our best practices should reuse connections and therefore connections are expected to be mostly stable

Thanks
Pavel

Sounds good. Thank you.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.