Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Profiling Catalyst

by holli (Abbot)
on Jul 21, 2007 at 13:22 UTC ( #627982=perlquestion: print w/replies, xml ) Need Help??

holli has asked for the wisdom of the Perl Monks concerning the following question:

Fellows,

I'm currently writing a bigger application that uses the Catalyst engine. As it seems there is one or more bottleneck, and so i want to use a Profiler to find out about that. The question is how to so? A quick search on CPAN didn't dig out an appropriate plugin, a Super Search failed too, Devel::DProf is for scripts only and so I have to ask you.

Any suggestions?


holli, /regexed monk/

Replies are listed 'Best First'.
Re: Profiling Catalyst
by perrin (Chancellor) on Jul 21, 2007 at 19:16 UTC
Re: Profiling Catalyst
by CountZero (Bishop) on Jul 21, 2007 at 21:25 UTC
    If you cannot find an answer here, perhaps the Catalyst Mailinglist might be a good place to ask.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Profiling Catalyst
by jplindstrom (Monsignor) on Jul 21, 2007 at 23:38 UTC
    You could start the stand-alone server ./script/YOURAPP_server.pl with the profiler loaded.

    This would accept one request at a time though, but that sounds perfectly fine for what you want to use it for.

    /J

      ... but that sounds perfectly fine for what you want to use it for.
      Indeed, it is. But how to do so?


      holli, /regexed monk/
Re: Profiling Catalyst
by bennymack (Pilgrim) on Jul 23, 2007 at 01:00 UTC

    What have you tried so far?

    Devel::DProf should work just fine. I prefer Devel::SmallProf myself but they should both do the job.

    First, start your Catalyst app with "perl -d:DProf script/myapp_server.pl" then hit it repetitively with something like ab '/usr/sbin/ab -n 1000 "http://127.0.0.1:3000/"'. Then you'll just need to kill the development server with CTRL+C. This should at the very least identify the hotspots on the slow pages you're concerned with.

      I've just tried that and it segfaults (Win32, ActivePerl 5.8.8)


      holli, /regexed monk/
        Yeah, that has happened to me too under win32.

        See if you can get any of these to work.

        /J

Re: Profiling Catalyst
by mojotoad (Monsignor) on Jul 22, 2007 at 04:04 UTC
    Hi holli,

    Does your larger application hammer on the system much via overwhelming db locking (table? row?), IO, threading, forking, etc? Just curious, as these things, if they are an issue, might not show up in the profiling.

    Cheers,
    Matt

Re: Profiling Catalyst
by andreas1234567 (Vicar) on Jul 22, 2007 at 18:12 UTC
    You may find tools like sar and vmstat useful if you are on a linux/unix platform.
    --
    Andreas
Re: Profiling Catalyst
by mattr (Curate) on Jul 24, 2007 at 06:12 UTC
    It may not be obvious if you are on Win32 but you are already using the built-in profiling per subroutine, correct? That is, if you open a command line shell in linux and run the scripts/xx_server.pl http daemon it will for each request tell you precisely how much time each routine/phase takes. At least it does when I run from a linux shell, with Debug on. I didn't catch exactly what is segfaulting for you but you might try to run the http daemon from a cygwin shell for instance. I think the same output (with Debug on) is shown in the apache error log, at least it is with my FastCGI server.

    Also here is a post about using Time::HiRes with Debug in Catalyst for some simple profiling, it lets you start and stop a timer. This module (which ought to be added to CPAN perhaps) might do what you want.

    I recommend joining the Catalyst ML.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://627982]
Approved by dsheroh
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-05-26 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (93 votes). Check out past polls.

    Notices?