note 109145 added to mongo.construct
| From: | chris at mongohq dot com | Date: | Fri, 22 Jun 2012 21:52:57 +0000 |
| Subject: | note 109145 added to mongo.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188763@lists.php.net to get a copy of this message | ||
When deployment with persistent connections to an Apache system, please note your MPM settings.
Without proper MPM settings, your application does not effectively use persistent connections.
When starting up and tearing down workers, you will create a connection for each build up and tear
down. Each connection in MongoDB has a small memory overhead; however we have seen massive
connections result in detrimental performance.
Every environment is different, but the following Apache settings create truly persistent
connections (assuming prefork.c):
StartServers 50
MinSpareServers 50
MaxClients 50
MaxRequestsPerChild 0
With the the settings above, 50 workers are started and initialize database connections. Those
workers will run until an Apache restart.
With the following settings, every 2nd worker creates a new MongoDB connection, and can ruin
performance (assuming prefork.c):
StartServers 1
MinSpareServers 1
MaxSpareServers 1
ServerLimit 256
MaxClients 50
MaxRequestsPerChild 100
WIth the settings above 1 worker maintains a persistent connection. However, you are dynamically
starting and tearing down workers. On a site with high load, you will ruin your database
performance.
The two settings above are on both ends of the spectrum, and the real answer all depends on your
environment. Please toy with your proper settings, and consult the Apache MPM prefork settings
(http://httpd.apache.org/docs/2.0/mod/prefork.html) for more information.
Chris
MongoHQ
----
Server IP: 69.147.83.197
Probable Submitter: 68.113.101.41
----
Manual Page -- http://www.php.net/manual/en/mongo.construct.php
Edit -- https://master.php.net/note/edit/109145
Del: integrated -- https://master.php.net/note/delete/109145/integrated
Del: useless -- https://master.php.net/note/delete/109145/useless
Del: bad code -- https://master.php.net/note/delete/109145/bad+code
Del: spam -- https://master.php.net/note/delete/109145/spam
Del: non-english -- https://master.php.net/note/delete/109145/non-english
Del: in docs -- https://master.php.net/note/delete/109145/in+docs
Del: other reasons-- https://master.php.net/note/delete/109145
Reject -- https://master.php.net/note/reject/109145
Search -- https://master.php.net/manage/user-notes.php