MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

MongoDB Replica Set Reconnects to Down Secondaries Too Fast

My first post here!

How can MongoDB 4.0.12 be configured to SLOW its rate of re-connecting to its replica members when they are responding with “connection refused”?

I had MongoDB replica members die. The online replica members get “connection refused” responses from the down members, then they re-attempt to connect as fast as the CPU and network allow, without any delay. This crushes the CPU and makes the log files grow huge, as Mongo retries so much.

Is there a way to configure MongoDB to wait for some seconds or minutes before attempting to reconnect to a down replica member? I can’t find any such setting in the server & replica settings, and this seems like it would be an important setting to avoid crushing the CPU and network.

Thank you!!

Unless anyone has another idea, I will try rate-limiting outbound connections on the OS-level.

Ran some tests by taking down a replica set member, rate-limiting outbound connections seems to work very well on the OS-level. CPU usage, log entries, and network traffic remain low when a replica member dies. Hope this helps someone who may experience the same issue I had.