After updating mongoDB node js driver from 3.5.11 to 6.5.0 I have memory problems with mongoDB
From 20:00 to 22:15 there were some requests to DB using old driver (3.5.11) and from 01:30 there were some requests with new driver (6.5.0). The memory was not released after requests finished (in new driver) unlike old one.
I thought memory was not released because of some query did not finish. I did some debug after all requests done using
db.currentOp( { "active" : true, "secs_running" : { "$gt" : 0 } } )
In both cases (old and new driver) it was empty, except information about DB listeners ($changeStream)
In the big scale (in production) this chart has higher spikes up to 100% of memory usage and I need to add SWAP or even restart docker container with mongod instance.
Probably, the problem could be connected with this issue Why do Mongoose v6 and v7 cause a significant increase in garbage collections and event loop latency compared to v5? · Issue #13456 · Automattic/mongoose · GitHub
But https://jira.mongodb.org/browse/NODE-5792 not implemeted yet
my setup:
mongoDB: 4.0.23
node js: 20.9.0