[Catalyst] dbic models and startup time server

Brandon Black blblack at gmail.com
Tue Aug 22 00:54:12 CEST 2006


On 8/21/06, Josef Chladek <j.chladek at wirtschaftsblatt.at> wrote:
>
>
> Am 21.08.2006 um 22:42 schrieb Brandon Black:
>
> > Are you using real schemas, or Schema::Loader? (If you're using
> > Schema::Loader at runtime, the advice would be to stop doing that).
> >
> > If you're not, then you'll just have to wait for future performance
> > improvements, a few of which are in the early development stages.
> >
> > -- Brandon
>
> hi brandon,
>
> the model:
>
> package XMLForm::Model::BElogs;
> use base qw/Catalyst::Model::DBIC::Schema/;
>
> __PACKAGE__->config(
>          schema_class => 'XMLForm::Schema::BElogs',
>          connect_info => [
>          "dbi:mysql:BElogs:localhost",
>          "xxxx",
>          "xxxx",
>          {AutoCommit => 1}
>          ]
>          );
>
> the schema:
>
> package XMLForm::Schema::BElogs;
> use base qw/DBIx::Class::Schema/;
>
> __PACKAGE__->load_classes();
>
> 1;
>
> so I guess we have to wait, right?


Yes, or take a stab at improving the performance yourself of course :)

Are all of your 20 models using the same schema, or is it 20 unique schemas
that are truly different? (You could probably shave considerable time by
reusing identical schema classes rather than duplicating them, for instance
- same goes for identical source classes referenced by multiple schemas).
Another trick that has helped others is modify your source classes to use a
common base which does the load_components part, such as:

lib/MyDBICStuff/SourceBase.pm:
package MyDBICStuff::SourceBase;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto Core/);
1;

lib/XMLForm/Schema/BElogs/SomeTable.pm:
package XMLForm::Schema::BElogs::SomeTable;
use base qw/MyDBICStuff::SourceBase/;
__PACKAGE__->table('sometable');
# ... other usual source definition stuff
1;

Of course you might need to make 2-3 seperate SourceBase type of classes
(one for each unique combination of load_components you have).

-- Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060821/4b475f8a/attachment.htm 


More information about the Catalyst mailing list