[Catalyst] Catalyst Performance issues

Matt S Trout dbix-class at trout.me.uk
Sat Oct 7 17:53:50 CEST 2006


Nilson Santos Figueiredo Junior wrote:
> Hi everyone,
> 
> Recently I've been facing some performance issues in my Catalyst
> application and the situation worries me a little bit.
> 
> The first optimization I tried was to start prefetching everything I
> could and it indeed improved the performance quite a bit (by a factor
> of 2 or so). But it still isn't enough.
> 
> I've got pages that take 3-4 seconds to render with a single user
> using the application while the database query takes something between
> 0.15-0.20s to complete. Whenever the application faces a moderate
> amount of usage, users start complaining.
> 
> So, in my quest for optimization, I tried profiling my Catalyst
> application. It saddened me a little bit to find out that, apparently,
> at least 60% of the time (probably more) is spent inside Catalyst, TT
> and DBIC internal routines (a big cycle eater is Class::C3).

The Class::C3::* methods you're seeing are startup overhead only; unless 
you're messing with class hierarchies at run-time that's a one-off hit.

> Particularly, URI handling seems to take a lot of time (maybe this was
> influenced by the fact that I profiled using the builtin server).

I think maybe uri_for isn't as efficient as it could be; you might find you're 
better off doing uri_for once to get a URI object and then just appending ids 
to the end.

> I'd like to know if there are any performance tips or really just how
> do you get acceptable performance from your Catalyst application in
> moderately complex or large pages (especially regarding pages where
> there might be hundreds or records fetched from the database).

The killer seems to be the Template::Stash::XS::get time; assuming it's 
basically a table that you're generating, perhaps adding a static routine to 
your code that chucks out the HTML for that in an efficient perl fashion might 
help?

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list