Node mongodb native performance

Over time I noted down performance timings while using different versions of node-mongodb-native driver.

I noticed that performance goes down badly. For example, I run a simple get query on the same database, same collection having 9 records, with the same version of node (16.6.0) and same version of mongodb (5.x.x).

  • In the begginning of the year I used node-mongodb-native 4.3.0 andI had initial connection on localhost in 200ms, and the fstest subsequent requests at 4-5ms.
  • In the summer I used node-mongodb-native 4.6.0 andI had initial connection on localhost in 360-400ms, and the fstest subsequent requests at 9-10ms.
  • now I use node-mongodb-native 4.12.0 andI had initial connection on localhost in 800-900ms, and the fstest subsequent requests at 20-22ms.

It looks like folks are just keep adding things and nobody cares about performance.

I don’t expect any answer, I just wanted to express my sadness…

Hello @Sorin_GFS, Welcome again to the MongoDB community forum,

I have tested the connection and a find query in each version (4.3.0, 4.6.0, 4.12.0) of the node-mongodb-native and same configuration as yours, I did not found any performance issues in connection or a find query.

You can check and execute the same code from the GitHub repository,

I checked there are no major updates specific in DB connection from the 4.3.0 to 4.12.0 versions, you can also check in the release notes:

Secondly, there are many possibilities why it is taking more execution time that is not related to node-mongodb-native driver, check the similar question that may help you,



Thank you for this work. It gave me a starting point because indeed using the driver directly there are no visible performance differences between this three versions of driver.

Here I saw a guy having similar problem while using nodemon for hot reloading, which is also my case. I hope this is the problem because there is no nodemon in production. I need to create a test that works in production and if there I can’t find this delay the problem is solved. Anyway, thanks for pointing me in the right direction.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.