Mongo socketTimeoutMS不起作用

时间:2014-08-06 17:29:50

标签: php mongodb

我执行从PHP 5.4到Mongo 2.4.10的“findOne()”查询 PHP mongo驱动程序版本是1.5.5
Mongo DB是replicaset

要限制等待此“findOne()”查询的结果,我使用“socketTimeoutMS”选项
根据文件超过“socketTimeoutMS”函数“findOne()”必须抛出“MongoCursorTimeoutException”异常
但我没有在日志中看到任何异常

此外,我还测量了这个“findOne()”查询的执行时间 - 通常比“socketTimeoutMS”更多(有时是几次)

所以看起来“socketTimeoutMS”选项不起作用 需要提一下的是我们的mongo DB负载很高

还需要提一下,在我的本地机器上“socketTimeoutMS”工作正常

那么“socketTimeoutMS”选项对生产无知的原因是什么?

2 --- 4   Using 50 from default with
2 --- 4   found connection 192.168.2.172:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843 (looking for 192.168.2.172:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843)
2 --- 4   is_ping: skipping: last ran at 1407943807, now: 1407943807, time left: 5
2 --- 4   found connection 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843 (looking for 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843)
2 --- 4   is_ping: skipping: last ran at 1407943807, now: 1407943807, time left: 5
2 --- 4   found connection 192.168.2.94:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843 (looking for 192.168.2.94:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843)
2 --- 4   is_ping: skipping: last ran at 1407943807, now: 1407943807, time left: 5
2 --- 4   discover_topology: checking ismaster for 192.168.2.172:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843
2 --- 4   discover_topology: checking ismaster for 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843
2 --- 4   found connection 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843 (looking for 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843)
2 --- 4   ismaster: skipping: last ran at 1407943798, now: 1407943807, time left: 6
2 --- 4   discover_topology: ismaster got skipped
2 --- 4   discover_topology: checking ismaster for 192.168.2.94:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843
2 --- 4   found connection 192.168.2.94:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843 (looking for 192.168.2.94:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843)
2 --- 4   ismaster: skipping: last ran at 1407943798, now: 1407943807, time left: 6
2 --- 4   discover_topology: ismaster got skipped
2 --- 4   No timeout changes for 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843
2 --- 4   No timeout changes for 192.168.2.92:27017;gmt;admin/gmt/fb5f987e48d27c093e233d3cda7758e2;11843

0 个答案:

没有答案