[dev] Reducing persistent database connections

Eric Rostetter eric.rostetter at physics.utexas.edu
Thu Jun 5 11:34:26 PDT 2003


Quoting Jon Parise <jon at horde.org>:

> A large number of our applications now offer database backends.  A
> cursory examination of the various SQL-based drivers indicates that we
> almost always request a persistent database connection.

Yes, there was a large push towards this back in the Horde1 to Horde 2
conversion.

> 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?  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).

> 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?
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.

The article you quote states:

> Sure, if you have one webserver and one database, or both on the same machine,
> caching database connections may get you a 1-2% speed increase

This is probably the case for most Horde users.

> where we have so many different types of database servers and any given web
> process is very unlikely to need the same databases is just used in a
> subsequent request. It's best to just shut them down and waste a few
> microseconds.

I don't think this would be the case for many Horde users...

> 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.

> Comments on this?

When don't I have comments about something? :)

> [1] http://www.livejournal.com/community/lj_maintenance/60984.html

I don't think this supports your case much for the typical Horde site.
But it is an interesting read.

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

--
Eric Rostetter
The Department of Physics
The University of Texas at Austin

Why get even? Get odd!


More information about the dev mailing list