How to optimize my mongodb connection pool when i am using nodejs in cluster mode

In the above picture, you see I have more than 100 connections open. i am using mongoose ORM for connection and apply clustering in my nodejs project and also apply mazPollsize to 1

Hello, welcome to the MongoDB community

Can you share how you are configuring the pool?

mongoose.connect(process.env.MONGODB_CONNECTION, {
useNewUrlParser: true,
maxPoolSize: 1
//useFindAndModify: false,
// useUnifiedTopology: true
})
mongoose.connection
.once(‘open’, () => console.log(‘mongoose connected’))
.on(‘error’, (error) => {
console.log(‘your error’, error)
})

Make sure mongoose.connect is only called once in your application. Multiple calls to mongoose.connect may result in multiple connections being established.

Can you see that all connections come from the same user?

Do you close the connection after entering the data or do you keep it open?