[mythtv-users] Re: mythweb2 having some more problems

Omer Shenker mail at omershenker.net
Thu Aug 7 23:58:10 EDT 2003


On 07 Aug 2003 16:48:33 -0700 Chris Petersen wrote:
> I've been getting this a lot, too.  unfortunately, I have no 
> idea what's
> going on with this.  the mysql_pconnect() routine is specifically
> supposed to AVOID this error, by only opening as many 
> connections as it
> needs, and keeping them open, rather than opening one connection for
> each page served.
> 
> I'm wondering if it has something to do with my moving the sessions
> directory into the local tree (though I don't see why it 
> would do that),
> though it might also be something weird going on in 
> mythbackend cvs (any
> help guys?).

Chris,

I think you're mistaken on mysql_pconnect. When you use mysql_connect, the
connection is automatically closed when the script ends. The raison d'etre
of mysql_pconnect is the time it takes to build up and tear down a
connection, especially one over TCP. By caching connections indefinitely,
mysql_pconnect eliminates this overhead. No matter what the vaguely worded
PHP docs might imply, this is done on a per-child basis when using Apache.
(Apache children really have minimal communication with each other, and if
mysql_pconnect were smart enough to share cached connections over multiple
httpd processes, there'd be a configuration option for a semid or shmid, and
it would show up in /proc/sysvipc/*.)

The situation where you really want mysql_pconnect is a dedicated webserver
running a specific app. Since every request will be using the same type of
database connection, it makes sense to use mysql_pconnect. You'll end up
with the same number of PHP-initiated MySQL connections as you have Apache
children. Of course, this assumes that speed matters.

Although I don't think mythweb should use mysql_pconnect by default, it
shouldn't be causing problems like this for average myth users. It does
sound like some bug is causing another myth app to open numerous db
connections and not close them. The SHOW PROCESS statement should let you
know what process opened each connection.

Cheers,
-- 
Omer Shenker                          http://omershenker.net/





More information about the mythtv-users mailing list