mongodb 启用用户扩展 连接数成倍问题
产生问题前的动作, mongodb 从2.6 升级到3.0 同时mongodb 由原先不需要用户认证到启用用户认证
php 升级到了新扩展
问题描述: php 升级新扩展后, 一个 php 进程 对同一个mongod同时产生了2个连接
问题结果:导致长连接占用了大量的内存,造成大量的内存资源浪费
问题原因分析: 产生这种情况一般是应用程序问题, 花了好几天时间,终于查出 是 connectTimeoutMS 引起的
官方文档解释
uri.connectTimeoutMS:
The time in milliseconds to attempt a connection before timing out.
The default is never to timeout, though different drivers might vary.
See the driver documentation.
将 connectTimeoutMS 由1000 改为2000