Tuesday, June 12, 2012

use Devel::NYTProf to profile perl cgi

Recently, we are bitten by the venomous performance issues, our web site users are keeping complaining about the speed, so i tried to find some tools to profile our web site. And finally got a awesome perl module, yep, that is Devel::NYTProf, it can generate well formatted report such as html, csv, etc.

Since our website is perl-cgi powered(LAMP), so it cost me some time to configure profile environment, tried lots of methods provided by enthusiastic people, e.g. SetEnv in Apache config file. But those all failed, it really frustrated.

At the end, i found a post, it says, we can just append -d:NYTProf to the specific cgi after the shebang
'#!/usr/bin/perl -wT -d:NYTProf', then, we can request that cgi, there will be one file namely nytp.out in your cgi directory, with this file we can generate good-looking report.


ps:
http://blip.tv/timbunce/devel-nytprof-v4-oscon-201007-3932242
http://search.cpan.org/dist/Devel-NYTProf/

No comments:

Post a Comment