I’m currently using mongoDB in my development server. Using PHP 1.1.4 driver and connecting to mongoDB with persist command.
But somehow my db connection number is gradually increasing but never seems to end those connections perhaps no timeout?
I’m worried that if I deploy my source, it might cause some problem that full of connection pool won’t let people to use mongoDB at all.
How can I set timeout shorter or somehow resolve gradually increasing connection problem though there is only one user.
Each instance of your running code uses its own pool of persistant connections.
Are the operations assigned to each connection getting finished fast ? There might be slow queries in your code. Do share the snapshot of
mongostatfrom your running instance. That would help. Itmongostatshows everything is fine, then it might be PHP mongodb driver bug.See :
http://groups.google.com/group/mongodb-user/browse_thread/thread/ac005be798b6adea?pli=1
What I would suggest is, use non-persistant connections and explicitly close them at the end of your script.
http://php.net/manual/en/mongo.close.php
Though there is a little performance hit as persistant connections are better, but that can be ignored for moderate traffic.