http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15350 Bug ID: 15350 Summary: DBIx::Class Startup speed Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@bugs.koha-community.org Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org (This follows 15341 comment 5) From https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Manual/Cookb... There are some tips to follow to reduce the DBIx::Class startup delays. === 1 - Statically Define Your Schema If you are using DBIx::Class::Schema::Loader to build the classes dynamically based on the database schema then there will be a significant startup delay. For production use a statically defined schema (which can be generated using DBIx::Class::Schema::Loader to dump the database schema once - see make_schema_at and dump_directory for more details on creating static schemas from a database). 2 - Move Common Startup into a Base Class Typically DBIx::Class result classes start off with use base qw/DBIx::Class::Core/; __PACKAGE__->load_components(qw/InflateColumn::DateTime/); If this preamble is moved into a common base class:- package MyDBICbase; use base qw/DBIx::Class::Core/; __PACKAGE__->load_components(qw/InflateColumn::DateTime/); 1; and each result class then uses this as a base:- use base qw/MyDBICbase/; then the load_components is only performed once, which can result in a considerable startup speedup for schemas with many classes. 3 - Explicitly List Schema Result Classes The schema class will normally contain __PACKAGE__->load_classes(); to load the result classes. This will use Module::Find to find and load the appropriate modules. Explicitly defining the classes you wish to load will remove the overhead of Module::Find and the related directory operations: __PACKAGE__->load_classes(qw/ CD Artist Track /); If you are instead using the load_namespaces syntax to load the appropriate classes there is not a direct alternative avoiding Module::Find. 4 - MEMORY USAGE Cached statements DBIx::Class normally caches all statements with prepare_cached(). This is normally a good idea, but if too many statements are cached, the database may use too much memory and may eventually run out and fail entirely. -- You are receiving this mail because: You are watching all bug changes.