Search this site


Metadata

Articles

Projects

Presentations

Curious me web stats.

I got bored and wanted to see how my new site compares against other things. These statistics are by no means thorough. The benchmarker I used is a very simple program called webbench. It simply sends request after request at whatever you point it at. The statistics were done using 5 concurrent clients over 30 seconds (-c 5 -t 30).

I think the results are pretty interesting.

http://www.google.com/ 7126 pages/min
http://www.amazon.com/ 8340 pages/min
http://www.csh.rit.edu/ 3690 pages/min
http://www.csh.rit.edu/~psionic/new 7066 pages/min
http://www.csh.rit.edu/~psionic/new?nocache 710 pages/min

A factor of 10 difference with caching than without. Sheesh. How easy is it to cache things in mason? Let me show you.
<%init>
return if (!exists($m->request_args()->{'nocache'}) && 
		$m->cache_self(key => $m->comp("/lib/cachename"), expires_in => '30 minutes'));
</%init>
Put that in the %init section of any component and poof, mason caches the output of that component for 30 minutes (as specified). According to this site, you can cache the return values of components too, which makes it a bit like Memoize in a way.
The /lib/cachename componenet is a little dohicky I wrote up to automatically generate a key name to cache by:
<%perl>
	my ($k,$v);
	my $args = scalar($m->caller_args(1));
	my $key = scalar($m->callers(1))->{"path"};
	$key .= ".$k=$v" while (($k,$v) = each(%$args));
	$key =~ s!s!_!g;
	return $key;
</%perl>
This component generates a key in the form of "compname.foo=bar.baz=fizz" or whatever. It takes the arguments passed to the component and makes a unique key out of it. This is so I can cache specific calls to each component (like Memoize!) with specific arguments rather than simply caching only one output and using that. This is slick.