note 109145 deleted from mongo.construct by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 Jun 2012 13:50:09 +0000 |
| Subject: | note 109145 deleted from mongo.construct by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188824@lists.php.net to get a copy of this message | ||
Note Submitter: chris at mongohq dot com
----
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