Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8440563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:19:38+00:00 2026-06-10T08:19:38+00:00

I keep hitting my connection limit, but http traffic has remained consistent. I used

  • 0

I keep hitting my connection limit, but http traffic has remained consistent. I used MMS to profile my mongod process and saw that the number of connections keeps rising:

mongod connections

I’m using the mongoskin wrapper for Node.js (Express). I have a piece of custom route middleware that connects to the mongo db before executing other routes:

var _connect = function(req, res, next) {
  res.db = mongoskin.db(_us.sprintf(
    '%s:%s@localhost:27017/%s?auto_reconnect',
    app.set('mongoDbUser'),
    app.set('mongoDbPw'),
    app.set('mongoDb')
  ));
  next();
};

Am I doing something wrong? How should I be opening and closing connections?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:19:39+00:00Added an answer on June 10, 2026 at 8:19 am

    mongoskin is a wrapper for the node-mongodb-native driver so options for the underlying native driver still apply.

    Some suggestions to reduce the number of connections used:

    1. Open your connection before starting the application (you don’t want to open a connection in each request):

       var db = new mongoskin.db(...) 
       db.open(function(err, db) { 
           // Application logic
       })
      
    2. Adjust the node-mongo-native connection poolSize. Connection pooling allows a set of connections to be shared in your application rather than always opening new connections. The default poolSize is 1 in older drivers and 5 as of the node-mongo-native 1.1.4 driver which was released Aug 16, 2012.

      So you could try something like:

       var mongoskin = require('mongoskin');
       var serverOptions = {
           'auto_reconnect': true,
           'poolSize': 5
       };
       var db = mongoskin.db('localhost:27017/test', serverOptions);
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to create a dynamically named JSON property but I keep hitting
I'm using Glade-3 for my GUI design, but I keep hitting this problem. I
I'm currently trying to optimize an database by combining queries. But I keep hitting
I'm trying to utilize Delayed Job in my Rails 3 app, but keep hitting
I want to insert html into a mysql longtext collumn but I keep hitting
I am following the: http://framework.zend.com/manual/en/learning.quickstart.create-model.html . Keep hitting wall after wall of issues. My
Been investigating for a while now and keep hitting a brick wall. I am
Keep going around circles, but I am still unclear about this. Have a feeling
I have been slowly learning iPhone development and seem to keep hitting walls where
I keep hitting brick walls trying to merge changes to the trunk with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.