How to prevent your connection from dropping with hosted MongoDB instances

If you are connected to a hosted instance of MongoDB, you may experience odd connection drops or timeouts that manifest themselves like this:

After a relatively short period of inactivity, you try to run a query from within MongoChef, but you are presented with a server error message box. If you try again, the query will work properly again.

The reason is that in some configurations, the connection can get dropped by a firewall or a load balancer. This issue is common with MongoDBs hosted on Azure. The folks over at MongoLab have some interesting details on this matter: The solution is to manually set the max connection idle time to 60s (60000ms) in the Connection Manager:

MongoChef set connection idle timeout

After that, your connection should no longer drop.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *