Skip to content

MongoDB connection pool size #92

Description

@jim3692

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
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions