mongodb的参数理解

查看:144
本文介绍了mongodb的参数理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

求问大神,对于mongodb以下几个参数我的理解对不对?

maxWaitTime=120000 是指已经连接到mongodb,正在等待数据返回,这个等待的时间

connectTimeout=10000 是指请求mongodb连接,还没有连接上,正在等待连接的时间

socketTimeout=0 是指已经连接上了,正在传输数据,传输数据过程中会有耗时,这里就是等数据传递结束的等待时间

解决方案

Stackoverflow上有一个有140次赞的回答:How to configure MongoDB Java driver MongoOptions for production use?

  • connectTimeout. As the name suggest number of milliseconds the driver will wait before a connection attempt is aborted. Set timeout to something long (15-30 seconds) unless there's a realistic, expected chance this will be in the way of otherwise succesful connection attempts. Normally if a connection attempt takes longer than a couple of seconds your network infrastructure isn't capable of high throughput.

  • maxWaitTime. Number of ms a thread will wait for a connection to become available on the connection pool, and raises an exception if this does not happen in time. Keep default.

  • socketTimeout. Standard socket timeout value. Set to 60 seconds (60000).

这篇关于mongodb的参数理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆