[Catalyst] Catalyst Performance issues

Perrin Harkins perrin at elem.com
Sat Oct 7 17:45:36 CEST 2006


Nilson Santos Figueiredo Junior wrote:
> 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.

How are you measuring those query times?  The DBI profiler is a good 
idea, if you haven't tried it yet.

> So, in my quest for optimization, I tried profiling my Catalyst
> application.

That was a good move, but I think your methodology needs to be changed a 
little to get useful results.

> 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).

I haven't used DBIC, but I understand that the Class::C3 hit is mostly 
during startup.  You don't want to profile that, since it doesn't affect 
the speed of your application.  With mod_perl, you can skip that part by 
looking at the profile of a child process rather than the parent.  I'm 
not sure how to do it with other server environments.

> 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 would think so.  Don't profile with a server different from the one 
you run with if you want useful results.

> Thanks for any help and just in case it might be useful in order to
> diagnose what I could've done wrong, here's the profiling output of
> "dprofpp -R -O 50" for my application:

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.

Re-run your profile on your real server, preferably without all the 
startup time, and sort it by real time with -r, then see what picture 
emerges.

- Perrin



More information about the Catalyst mailing list