Severe performance drop with MongoDB Change Streams

前端 未结 1 1077
猫巷女王i
猫巷女王i 2020-12-08 02:02

I want to get real-time updates about MongoDB database changes in Node.js.

A single MongoDB change stream sends update notifications almost instantly. But when I ope

相关标签:
1条回答
  • 2020-12-08 02:55

    The default connection pool size in the Node.js client for MongoDB is 5. Since each change stream cursor opens a new connection, the connection pool needs to be at least as large as the number of cursors.

    const mongoConnection = await MongoClient.connect(URL, {poolSize: 100});
    

    (Thanks to MongoDB Inc. for investigating this issue.)

    0 讨论(0)
提交回复
热议问题