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 6591697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:27:30+00:00 2026-05-25T17:27:30+00:00

I have a mongodb server in production serving on an EC2 instance. According to

  • 0

I have a mongodb server in production serving on an EC2 instance. According to the mongodb official documentation, persistent DB connections should ALWAYS be used in production. I’ve been experimenting with about 50 persistent connections and was getting frequent connection errors (approx 33% of the time) while testing. I’m using this code:

$pid = 'db_'.rand(1,50);
$mongo = new Mongo("mongodb://{$user}:{$pass}@{$host}", array('persist' => $pid) );

Some background on the application, it’s a link tracking application that is still ramping up – and is in the range of 500 – 1k writes per hour, nothing too crazy… yet.

I’m wondering if I simply need to allow more persistent connections? How does one determine the right balance of persistent connections versus server resources available?

Thanks in advance everyone.

  • 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-05-25T17:27:31+00:00Added an answer on May 25, 2026 at 5:27 pm

    The persist value is no longer supported as of the most recent driver (1.2.0).

    Truth is, it was never really clear what it did in typical Apache+PHP setups. There are several comments on the Google Groups and elsewhere asking for detail, but I did not any evidence that persist or persistent was ever tested with any depth.

    Instead, it’s all been replaced by connection pooling “out of the box”. The connection pooling has obviously been through some changes within the 1.2 line with the addition of the MongoPool class.

    There is still no detailed explanation of how the pooling works with Apache, but at least you don’t have to worry about persist.

    Now despite all of this mess, I have handled 1000 times that traffic on a single MongoDB server via the PHP driver without lots of connection problems.

    Are you catching the exceptions?

    Can you provide more details about the exact exception?

    There may be a code solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have launch mongodb server: [demas@arch.local.net][~]% mongod --dbpatmongod --dbpath /home/demas/temp/ Mon Apr 19 09:44:18
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I have a Mongo server running on an Ubuntu box, and I am trying
Recently I stumbled across mongoDB, couchDB etc. I am hoping to have a play
I'm trying to use mongodb with PHP. For that, I have created a MongoHQ
I am working with Node.js to build a web socket server that uses mongodb.
I currently have a RoR application set up in a (semi-)production environment on a
I have trouble with MongoDB on Windows 7 (32 bit). I make some tests
Using MongoDB I'm trying to copy a database from one server to another. My

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.