Too many open connection to MongoDB

I have 4027 CPEs with 3500 simultaneously online.
The problem is that I have an average of 200 open connections to MongoDB.
And the question is: Is that normal? Am I doing something wrong?
image

This amount of opened connection to MongoDB causes to consume a huge amount of memory RAM. At that moment the MongoDB service is consuming 2.23GB of RAM.

What is your inform interval?

I’ve also seen MongoDB log entries that show a lot of connections are open. Our inform interval is pretty low for various reasons, but this still seemed iffy to me.

I’m not a MongoDB expert, is this normal? In my experience with other databases the application normally opens a single connection and reuses it.

I am using a inform interval of 10 minutes.

I think that’s normal. The default max connection pool size in MongoDB driver is 10 connections (or was it 100?). Multiply that by the number of services running (genieacs-cwmp, etc.) and the number of CPU cores available (one process per core). Though with the exception of genieacs-cwmp, I don’t see why other services would need to max out their connection pool.

But I agree it sounds like a lot. It looks like you can configure the pool size from the MongoDB connection string: https://docs.mongodb.com/manual/reference/connection-string/#connection-pool-options