[dev] Reducing persistent database connections

Jon Parise jon at horde.org
Thu Jun 5 18:33:38 PDT 2003


On Thu, Jun 05, 2003 at 01:34:26PM -0500, Eric Rostetter wrote:

> > Even on a
> > moderately busy Horde site with only a handful of active applications,
> > this will result in a large number connections remaining open in the
> > persisted pool of database handles.
> 
> Depends on how you define "moderately busy".  It really doesn't matter
> how many active applications you have, does it?

It does if you use different database (or, at the very least,
connection credentials) for each application.

> The persistence is
> between the web server process and the database.  Since all apps use
> the same database, number of apps doesn't matter.  (Would matter more for
> those people running multiple versions with multiple databases, but they
> are fairly rare I think).

Remember that the database pools are managed on a per-forked-instance
of the web server.  In short, that means that, for a pre-forked model,
you can end up pooling as many database connections as there are web
clients.  It's been a while since I worked with this, though, so I may
be missing some details.
 
> > Connecting to databases (especially a MySQL database) has become a
> > very cheap operation (as others are realizing[1]), so the performance
> > gain of reusing an existing connection is no longer outweighing the
> > cost of dedicating resources to the connection pool.
> 
> 1) Does this hold true for most of the supported databases, or just a few?

I don't have a good answer to that, unfortunately.

> 2) This depends very much also on whether the httpd and database are on
>    the same machine or separate machines, and whether using tcp or unix sockets.

Yes, that's true.  It also depends on things like SSL-based connections.
 
> > I'd like to alter all of our applications to _not_ request persistent
> > connections and make it a rule that persistent connections only be
> > requested by the Horde Framework itself and not by applications (at
> > least in the default configuration).
> 
> I think it would be way cool if there was a horde configuration setting
> to specify persistent/non-persistent connections, and that all apps used
> that setting (i.e. a global - horde wide - setting).  But I don't want
> to remove the persistent connections by default.
 
I think a "global" configuration option that controls persistent
connections is in order, based on the comments thus far.  It sounds
likes the consensus is to default this option to 'persistent'.  I
agree with that notion because that is how things are operating today,
so it won't actually affect any existing behavior.

-- 
Jon Parise (jon at horde.org) :: The Horde Project (http://horde.org/)


More information about the dev mailing list