Question

I'd like to have a tool in Perl to gather useful statistics for page loads (eg, download time/speed, CDN information, headers, dns lookups, compressions)

Does anyone know if one exists or if there's a place to learn about how to make one?

Was it helpful?

Solution

You might want to try WWW::Mechanize::Timed, which extends the WWW::Mechanize module. The ::Timed features will allow you to collect information on how long your requests take. The underlying ::Mechanize module, which is itself a subclass of LWP::UserAgent, would give you access to your response, including headers, body content, and images. From these you could compute total page "weight", number of requests, etc. This doesn't cover everything YSlow does (exposing the DNS internals underlying gethostbyname would be a good trick!) but I hope it's a place to start, if I've understood your question properly.

OTHER TIPS

You could have the perl CGI (or any perl program) run a few times under the profiler, and scan for commonalities. I haven't seen a web-based interface like this, but if you have control over the perl side of things, the documentation is here:

http://www.perl.com/pub/a/2004/06/25/profiling.html

It basically boils down to running your perl program with -d:DProf and then, after it finishes, running dprofpp in the same directory:

# perl -d:DProf ./foo.pl
# dprofpp

Update:

Yes, this is not the same thing as protocol profiling, as duly noted below, but there aren't may alternatives for perl. If you are trying to find where the perl portion of the slowness is coming from, profiling perl is a good place to start. Products like YSlow will track the pure protocol aspects of it, whether the CGI is perl or php or python.

Personally, I use it to profile my django site, which is in python and flash, and I profile those separately from the protocol portion of the system, which I also use YSlow for.

Also, there are perl plugins for "ddd" which will at least make it graphical:

http://www.gnu.org/software/ddd/

Sorry if this doesn't solve the exact problem, I would like to know if there's a perl interface to collate this as well, but I know this is where I would start looking...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top