mongoose 数据库连接问题
发布于 8 年前 作者 dragonsknight 3663 次浏览 来自 问答

数据库连接(暂时写在app.js) var options = { server: { poolSize: 100, auto_reconnect: true, keepAlive: 10 } }

var db = mongoose.connect(settings.MONGODB_URL,options);

问题:

1.批量插入数据,一段时间后就会出现: MongoError: connection 95 to xxx.xxx.xxx timed out

2.当出现上面错误的时候,所有相关的数据库操作就不运行了,是程序与数据库的连接断了吗? 是数据库连接设置的不对,还是可能是数据库的问题?

3.当我进行高并发的ab测试后,也会出现上面2的现象,是什么原因呢?是连接池相关设置的不正确吗?

1 回复

我也遇到了, 不知道什么原因, 连接一会后就会出现timeout error 其他操作全都不行 connection xxx to xxxx.localhost:xxx timed out

回到顶部