My mongodb deployment is swamped with thousands of connections from my Meteor apps, which enter a state where they create a new connection every few seconds.
More details on:
Please advise, if possible
My mongodb deployment is swamped with thousands of connections from my Meteor apps, which enter a state where they create a new connection every few seconds.
More details on:
Please advise, if possible
Are you opening db connections while the server is running? Are you spawning Meteor sub-processes? How many Meteor servers are you running?
See my reply inline.
There is a total of 11 meteor app instances of different/same bundle which connect to the same mongodb deployment.
All the apps using the deployment are based on meteor
btw, thatās our staging deployment. On the production deployment we have only 5 instances.
If you mean that we use Fibers/Future, then yes. 2 apps make use of fibers. Altogether, 5 instances.
We use it to wait for (server-side) Meteor.call and other async ops (i.e. http REST calls to other services).
Yes, we do - at times. In addition to the ānormalā Meteor collections (declared at app start), we occasionally run batch operations upon server start i.e. migrations.
For that we use meteor-native-mongo. Itās done via only one type of app on dedicated instances. These instances are not necessarily those which end up with 5k mongodb connections (confirmed via lsof). Furthermore, Iāve already double-checked the instances which do use meteor-native-mongo; right after such a āmigrationā takes place, the number of connections on the Meteor server is back to a single digit. Almost randomly, it starts growing slowly on different apps/instances.
meteor-native-mongo is the only way we create connections directly to the db, and only on startup. The scope for those calls is destroyed and the connections seem to disappear at that point. In any case, Iād like to reiterate that instances which doenāt use meteor-native-mongo are accumulating connections as well (they donāt even have the meteor-native-mongo package installed)
Lastly, Iād like to add:
Update: rcvd reply from Compose:
For some users the connection count issues appears to be caused by a bug in the node native driver which has been fixed with the
v3.1.3
release (it is only about 2 weeks old).
Can anyone tell how to update my Meteor project to use the newer version of the mongodb driver?