I was stress testing the app in a local server and I discovered that the responses are sent in batches of 5. After some research I found that mongoose uses its default connection pool size, which is 5 (documentation). However, MongoDB's native driver has a default of 100 connections (documentation).
I would recommend changing mongoose.connect call in app.js to:
mongoose.connect(config.MONGO[process.env.NODE_ENV], {
connectTimeoutMS: 120000,
socketTimeoutMS: 120000,
poolSize: 100 // MongoDB's default
})
I was stress testing the app in a local server and I discovered that the responses are sent in batches of 5. After some research I found that mongoose uses its default connection pool size, which is 5 (documentation). However, MongoDB's native driver has a default of 100 connections (documentation).
I would recommend changing
mongoose.connectcall in app.js to: