亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

mongodb的參數理解

mongodb的參數理解

富國滬深 2018-08-16 15:27:35
求問大神,對于mongodb以下幾個參數我的理解對不對?maxWaitTime=120000 是指已經連接到mongodb,正在等待數據返回,這個等待的時間connectTimeout=10000 是指請求mongodb連接,還沒有連接上,正在等待連接的時間socketTimeout=0 是指已經連接上了,正在傳輸數據,傳輸數據過程中會有耗時,這里就是等數據傳遞結束的等待時間
查看完整描述

2 回答

?
眼眸繁星

TA貢獻1873條經驗 獲得超9個贊

MongoDB Client驅動設置中網絡相關的等待設置比較多,依次介紹如下:

1、Client找Server所需要等待的時間,在RS或者Shard環境下,Client需要找到它所需的Server

對應的參數:ServerSelctionTimeOut

2、找到Server之后就需要建立Connection

1)每次都創建Connection,對應的網絡等待的參數就是:connectTimeout
2)Connection pooling的話,從Connection Pool取得Connection,對應的網絡等待的參數:maxWaitTime.

3、找到Connection之后,就有了Socket通信,在客戶端和MonogoDB的Socket通信過程中的網絡等待時間的參數就是:socketTimeout

供參考。

Love MongoDB!Have Fun!


查看完整回答
反對 回復 2018-08-26
?
慕慕森

TA貢獻1856條經驗 獲得超17個贊

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).


查看完整回答
反對 回復 2018-08-26
  • 2 回答
  • 0 關注
  • 772 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號