[Catalyst] How to share a database connection across multiple Catalyst apps?

Jason L. Froebe jason.froebe at gmail.com
Wed Sep 8 02:02:11 GMT 2010


Hi Simon,

Reducing the number of connections to the database from three to one =

will reduce the responsiveness and will definitely hurt when trying to =

debug issues (performance, etc).  My recommendation is that each =

application have at least one unique connection to the database.

jason


On 09/07/2010 12:59 PM, Simon Miner wrote:
> Hi,
>
> I am running 3 separate Catalyst (version '5.80022) apps that use a =

> common (Oracle 11g) database. Each app has a model class which wraps =

> around a common DBIC schema class, like so.
>
> -----
>
> package App1::Model::DB;
>
> use strict;
>
> use base 'Catalyst::Model::DBIC::Schema';
>
> __PACKAGE__->config(
>
> schema_class =3D> Common::DB::Schema',
>
> );
>
> 1;
>
>
> -----
>
> package App2::Model::DB;
>
> use strict;
>
> use base 'Catalyst::Model::DBIC::Schema';
>
> __PACKAGE__->config(
>
> schema_class =3D> Common::DB::Schema',
>
> );
>
> 1;
>
> -----
>
> package App3::Model::DB;
>
> use strict;
>
> use base 'Catalyst::Model::DBIC::Schema';
>
> __PACKAGE__->config(
>
> schema_class =3D> Common::DB::Schema',
>
> );
>
> 1;
>
> -----
>
> This setup passes changes to the Common::DB::Schema class on to the =

> Catalyst app model classes.
>
> All three of these apps run under a single Apache 1.3.42/mod_perl 1.31 =

> server. It appears that each server process creates a unique database =

> connection variable for each of these apps. Although these database =

> connections get reused from request to request, I would like to make =

> things even more efficient by having a single database connection =

> variable per server process which gets shared across all 3 Catalyst =

> apps. How do I update my model to accomplish this?
>
> Thanks.
>
>
> -- =

> -- Simon
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.u=
k/
> Dev site: http://dev.catalyst.perl.org/
>    =


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100907/3f769=
c60/attachment.htm


More information about the Catalyst mailing list