[Catalyst] Catalyst Performance issues

Perrin Harkins perrin at elem.com
Sat Oct 7 18:41:50 CEST 2006


Nilson Santos Figueiredo Junior wrote:
> Actually, next::method calls are somewhat expensive when you're using
> them for *everything* as it is on Catalyst / DBIC.

I don't think Catalyst uses Class::C3.

>> That will be mostly useless unless you add the -r flag.  The reason is
>> that this profile is sorted by CPU, so I/O intensive things like
>> database queries will never show up here.  You could spend 5 minutes
>> doing some disk action and you won't see it here because it didn't use
>> much CPU.
> 
> That's exactly what I don't want to measure: I/O intensive things like
> database queries.

Okay, so why don't you run dprofpp again with the -r flag?

> I just wanted to know where in Perl / Catalyst / DBIC land my
> cycles were being spent.

It doesn't really matter where the CPU is being spent if all the real 
time is spent waiting for I/O.  I recall profiling things in the past, 
being shocked to find TT at the top of the list, and then realizing I 
hadn't sorted by real time.  When I sort by real time, the picture 
changes dramatically.

> I ran these tests on the actual production server.
> 
> The only difference is that I used Catalyst's builtin server

I meant your real web server.

> honestly, I have no idea regarding how to profile a mod_perl
> application.

Maybe this will help: http://www.modperlbook.org/html/ch09_05.html

> As I've said the queries aren't the bottleneck.

How did you determine this?

> It's template rendering stuff.

There are some generic things you can do to speed up TT (use PROCESS 
instead of INCLUDE, use the support for constants if you have any, make 
sure you are using the template cache), but I'd do a profile sorted by 
real time before spending the effort on them.

> If I just issue the query and load the objects in a
> Perl array inside my Controller, without rendering the template, the
> time drops significantly. Out of those 3-4 seconds, usually at least
> 90% of it is spent inside the "end" action (i.e. in the template
> rendering stage) according to Catalyst's own debug output.

Does your template do anything that might cause DBIC to fetch more data?

- Perrin



More information about the Catalyst mailing list