On Fri, 17 Aug 2012, Sagar Sonawane wrote:
> I am getting Too Many open sockets error even if i create instance with
> persists setting. When i debug the issue i came to know that after 912
> calls to Mongo constructor it gives this error. I am using MPM model with
> following configuration,
What is the exact error? And how are you calling this?
> # worker MPM
> <IfModule worker.c>
> StartServers 5
> MaxClients 2000
> MinSpareThreads 25
> MaxSpareThreads 75
> ThreadsPerChild 50
> ServerLimit 40
> MaxRequestsPerChild 100
> </IfModule>
>
> Please let me know if i am wrong thinking that persists feature in
> php-Mongo Client has some issues. Because,
>
> 1. If it makes only one connection, in case of persists, then there should
> not be any open connections exception,
There will always be one connection per thread - which means that if you
have 750 threads running PHP, then there will be atleast 750
connections. You *really* should avoid the worker MPM though. The
threaded MPM does not work optimally with PHP.
> 2. I am using Mongo 1.3.0dev version in my setup, i.e. > 1.2.0 version in
> which they claimed that persistent is default feature and one should only
> "Persistent connection in production!!! as per
>
http://www.php.net/manual/en/mongo.connecting.php"
How old is the 1.3.0dev version? Also, be aware that this is *not*
officially released!
> 3. I am calling Mongo constructor in loop from one PHP script, so i think
> my Apache Model doesn't matters here
No, but how are you calling this in a loop?
> Kindly tell me what to do with Mongo connection in production under heavy
> traffic (viz. 550 qps)
Let the driver manage it - if you're not trying to outsmart it it will
work as planned.
cheers,
Derick
--
{
website: [ "
http://mongodb.org", "
http://derickrethans.nl" ],
twitter: [ "@derickr", "@mongodb" ]
}