Thanks for responding. We currently are cacheing DB connections
per-process. However, with 40-50 processes per server, and 4+ machines per
DB server, and 3-5 connections per process, you can see how the number of
connections per DB server gets rather large. I think the problem lies
with the CODE references. I'll check out IPC::Shareable some more.
Thanks,
-Saar Picker
On Tue, 8 Feb 2000, DeWitt Clinton wrote:
> On Tue, 8 Feb 2000, Saar Picker wrote:
>
> > I've been trying cache DBI database handles using IPC::Shareable and
> > IPC::Cache(based on ShareLite) without much luck. This is not necessarily
> > a mod-perl problem, but I figured someone on this list must have tried
> > this already.
>
> Hi Saar -- sorry I haven't replied yet to your earlier mail. I'm glad you
> wrote to this list.
>
> I don't think that either Shareable or Cache will allow for the storing of
> handles or sockets, due to the fact that they both rely on the Storable
> module for serialization. The Storable perldoc points out:
>
> You can't store GLOB, CODE, FORMLINE, etc... If you can
> define semantics for those operations, feel free to
> enhance Storable so that it can deal with them.
>
> I haven't tried this myself, but I think that the DBI handles will loose
> their internal references (such as file/socket descriptors) in the
> freezing process.
>
> Someone else recently wrote to me with an example of how they were using
> IPC::Cache to store the results of a SQL query, but no one I know of is
> using it for the database connections themselves. I imagine you are
> trying to create a connection pool, so as to not have to incur the over
> head of opening one each request. Perhaps you would consider just keeping
> the connection open for subsequent requests to the same process by keeping
> it global in the mod_perl instance? Check out this pointer:
>
> http://perl.apache.org/guide/performance.html#Persistent_DB_Connections
>
> Passing it between processes via IPC would be next to impossible, I
> believe.
>
> Hope this helps,
>
> -DeWitt
>
>