Re: Runtime Database connections- one more time
[prev]
[thread]
[next]
[Date index for 2005/01/24]
Bo Strinnholm wrote:
> I have been using Class::DBI for some time now and it has been kind of
> disturbing not to get a real foundation for how to treat the case when I
> need to use separate databases for my clients though they are using the
> same application.
You can try Class::DBI::Factory, or else use the approach you have here.
> Is this the optimal way?
Looks okay, but db_Main() gets called very frequently, i.e. multiple
times per request. You might want to cache the database handle in
pnotes() after you fetch it, and grab it form there for the remainder of
the request.
> Many clients = many sleeping database processes?
That will mostly go away if you use a front-end proxy server. Also, you
could see how much of a hit you take from disabling persistent
connections. It's not that much slower with MySQL.
- Perrin