1 通过查询currentOp函数,可以获取数据库当前的操作列表。

例如,msg:index build,progress:{done:1,total:20}.

2 构建长连接时,需对连接的可用状态进行检查,如不可用,需重建。

例如,并发数超过数据库设置的连接上限时,mongodb数据库服务器会主动关闭连接。

3 构建长连接时,应根据操作设置超时时间。

例如,长时间读取,应在find操作中添加findoption选项,设置maxtime/maxawaittime和nocursortimeout。

client设置maxconnectionlifetime/maxconnectionidletime/sockettimeout/waitqueuetimeout/connecttimeout等。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-07-06
  • 2021-09-06
猜你喜欢
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-02-19
  • 2021-07-01
相关资源
相似解决方案