Re: "Dynamic" database handles?

[prev] [thread] [next] [Date index for 2005/01/24]

From: Michael Graham
Subject: Re: "Dynamic" database handles?
Date: 21:39 on 24 Jan 2005
Hey Jason,

> The other alternative to using pnotes is to have something like an ENV
> var that won't be corrupted across apache children and use that to key
> into a config module, returning already generated configs if they exist.
> That cuts out 99% of your inefficiencies.  Apache::DBI will be doing
> something similar for your actual database handles, so "reconnecting" is
> a pretty cheap operation.

This is more or less what my config module does behind the scenes - an
environment variable is set for each virtual host and the config is
keyed by this.  But my config module also does some other ugly (and
probably expensive) stuff behind the scenes when retrieving a
configuration variable.

Also I just did a test to find out exactly how frequently db_Main is
called.  On a Class::DBI-intensive page I have, db_Main was called more
than 600 times!  So tweaking db_Main does seem like the low-hanging
fruit of optimizations.

But I probably should actually profile things before getting too 
excited :)

(Side note:  600 calls to db_Main in a single request!  That means 600
queries, right?  Wow.)


Michael




--
Michael Graham <magog@xxxxxxxx.xxx>


(message missing)

"Dynamic" database handles?
Daniel Collis Puro 23:44 on 22 Jan 2005

Re: "Dynamic" database handles?
Matt S Trout 00:20 on 23 Jan 2005

Re: "Dynamic" database handles?
Daniel Collis Puro 00:39 on 23 Jan 2005

Re: "Dynamic" database handles?
Jason Gessner 00:47 on 23 Jan 2005

Re: "Dynamic" database handles?
Perrin Harkins 01:04 on 23 Jan 2005

Re: "Dynamic" database handles?
William McKee 16:03 on 24 Jan 2005

Re: "Dynamic" database handles?
Dana Hudes 16:17 on 24 Jan 2005

Re: "Dynamic" database handles?
jason 18:59 on 24 Jan 2005

Re: "Dynamic" database handles?
Michael Graham 19:01 on 24 Jan 2005

Re: "Dynamic" database handles?
Perrin Harkins 00:50 on 23 Jan 2005

Re: "Dynamic" database handles?
jason 19:24 on 24 Jan 2005

Re: "Dynamic" database handles?
Michael Graham 21:39 on 24 Jan 2005

Generated at 17:42 on 27 Jan 2005 by mariachi v0.52