note 13982 deleted from function.mysql-pconnect by jimw
| From: | jimw@php.net | Date: | Fri, 07 Dec 2001 01:46:33 +0000 |
| Subject: | note 13982 deleted from function.mysql-pconnect by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21777@lists.php.net to get a copy of this message | ||
The reason why there are many people not understanding why mysql_pconnect causes problems on heavy
load is that they do not understand how the function works in conjunction with apache.
mysql_pconnect is a _PER CHILD_ persistant connection. This means each child has one persistant
connection per host/user/pass combo. Thus if apache has a max of 200 children, there is going to be
a max of 200 connections to mysql, even if only 10 are used at any one time. The reason the php
people probably did it this way is that if done any other way it would be a lot more complicated to
make sure connections aren't used on multiple childs at once. Just imagine one child doing a
mysql_db_query selecting something from a specific db after another child did a mysql_select_db to
another db and tries doing an UPDATE or INSERT after the db_query of the other child is finished,
it'll use a totally wrong database... Worse things can happen with data changing in the middle
of processing results and such things.