MongoDB TimeOuts

271 views
Skip to first unread message

Paulo

unread,
Jan 6, 2016, 4:58:01 AM1/6/16
to mongodb-user
Hi,

My MongoDB database is running in a Azure Ubuntu Server. 

The first time I hit the database I get a socket timeout. Same from mongochef or from my application. I read that the reason can be the connection get dropped by a firewall or load balancer. This issue is common with MonogDBs hosted in azure. ->  http://3t.io/blog/how-to-prevent-your-connection-from-dropping-with-hosted-mongodb-instances/

How can I prevent this from happening?

Thanks in advance, beste regards

Paulo

Stephen Steneker

unread,
Jan 6, 2016, 6:01:37 PM1/6/16
to mongodb-user
Hi Paulo,

For Azure VM deployments we recommend lowering the TCP keepalive values to prevent tiimeouts:

Regards,
Stephen

Paulo

unread,
Jan 7, 2016, 5:55:00 AM1/7/16
to mongodb-user

Hi Stephen, 

Thanks for your answer, but, I already made these changes, in Linux environment this configuration works well, but in Windows don't. the problem persist. I get timeout first time I hit the database after a time of inactivity...

Best Regards 

Paulo

Stephen Steneker

unread,
Jan 7, 2016, 8:31:03 PM1/7/16
to mongodb-user
On Thursday, 7 January 2016 21:55:00 UTC+11, Paulo wrote:
Thanks for your answer, but, I already made these changes, in Linux environment this configuration works well, but in Windows don't. the problem persist. I get timeout first time I hit the database after a time of inactivity...

Hi Paulo,

You mentioned you were running your database on an Ubuntu server on Azure, so the keepalive setting should definitely apply. This setting controls keeping the connection alive from the server point of view.

With Windows, are you referring to timeouts from a Windows client/application connecting to your server? Setting a lower idle timeout in your client (as per the blog post you originally referenced) should keep the client connection from timing out.

Can you clarify where you are seeing the timeouts? How long is your connection idle before it times out, and what application/driver and version are you using to connect to MongoDB?

Regards,
Stephen

Paulo

unread,
Jan 12, 2016, 10:49:50 AM1/12/16
to mongodb-user
Hi again Stephen,

We had all infrastructure in Windows, but we are migrating all DB servers to Ubuntu. 

At this time we still have some DB servers running Windows.

In Ubuntu, the problem was solved, but not in Windows.

We add this setting to the connection string "maxIdleTimeMS=45000" and the problem was solved in Windows environment, for now at least.

Thanks and Best Regards

Paulo  
Reply all
Reply to author
Forward
0 new messages