[Catalyst] DBIx makes Catalyst startup painfully slow

Kieren Diment kieren at diment.org
Tue Feb 10 11:53:08 GMT 2009


On 10/02/2009, at 10:25 PM, Andrew Rodland wrote:

> On Tuesday 10 February 2009 04:53:32 am Neo [GC] wrote:
>> Hello people,
>>
>> I'm working on a rather big CRM system using Catalyst with all  
>> bells and
>> whistles. For database, we use DBIx::Class::Schema and this drives me
>> crazy...
>>
>> Apart from Catalyst being really resource hungry, the startup time  
>> for
>> the application (testserver oder fastcgi) is ok, about 4 seconds on  
>> my
>> development-system (CentOS on VMware Fusion on MacOS X Leopard,  
>> Core 2
>> Duo 2.2GHz). It's not perfect for developing, but it is completely
>> acceptable.
>> But as soon as I activate my DBIx schemas, the startup time  
>> multiplies:
>> 12 seconds with my first (and most important) schema, 25 seconds when
>> using all schemas.
>
> Just to be clear, since you mention startup time, are you using a  
> fixed
> DBIx::Class::Schema, or DBIx::Class::Schema::Loader at runtime? If the
> latter, a slow startup is to be expected, and the solution is  
> largely "don't
> do that then". If the former, then I suspect Nigel has you headed in  
> the
> right direction.


Yes, it's generally very bad practice to regenerate the schema with  
schema::loader at every startup.

You can use schema::loader to dump to disk and add components yourself  
(below the line that says "do not modify below this line".


Here's one I prepared earlier:

#!/usr/bin/perl
use warnings;
use strict;
use DBIx::Class::Schema::Loader qw/ make_schema_at /;

make_schema_at("Zotero::Schema",
                {
                    # components => ['InflateColumn::DateTime'],
                    debug => 1,
                    relationships => 1,
                    dump_directory => './lib' ,
                },
                ["dbi:SQLite:dbname=../zotero.sqlite", "",""]);





More information about the Catalyst mailing list