[Catalyst] DProf

Lars Balker Rasmussen lars at balker.dk
Sat Nov 3 02:05:54 GMT 2007


On Fri, Nov 02, 2007 at 08:59:48PM +0200, Octavian Rasnita wrote:
> I have tried to see which of the modules of my Catalyst application take so 
> much time, because at certain moments the processor is occupied 99.9%, then 
> goes down to 12%, then again at 99.9% and so on.
> 
> I've used the module Apache::DProf in httpd.conf, and the results are 
> below, but I don't know what can I do to solve the problem and to make the 
> application consume less processor time.
> 
> The processor of the machine is an Intel Core 2 Duo at 2.4 GHz, and the 
> computer has 8 GB of RAM, and the application isn't very big. It has just 
> 130 templates and 21 controller modules that have aproximately 400 KB.
> 
> It worked fine until I added Catalyst::Plugin::I18N and I've translated the 
> interface into 3 languages, but I don't know if this is the cause, or how 
> could I solve it in other way if I still want to have the interface in more 
> languages.
> 
> Isn't Catalyst able to handle big applications? Or what could I be doing 
> wrong?

Oh, Catalyst can handle mighty big apps (230 files in lib totalling 800KB -
don't get me started on templates).

But you left out the most important fact:  How much traffic are you seeing?
Apache (and mod_perl) doesn't use much cpu, if there's no traffic.

Fighting cpu usage in webapps really mostly comes down to: Don't do any work
you don't have to, i.e. cache cache cache.

Caching is relevant in several places:

* Have TT compile it's templates.
* Cache results from common database queries.
* Cache semi-static page-snippets (e.g. don't calculate the html for "10 most
  popular articles" every time you draw a page).
* Cache entire pages if possible.

How you break it down is mostly up to your specific application needs.
But cache.
-- 
Lars Balker Rasmussen                                        Consult::Perl



More information about the Catalyst mailing list