photo
Jordan Sissel
geek

Sun, 06 Mar 2005

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.

Comments: 0 (view comments)
Tags:
Permalink: /geekery/152
posted at: 02:19

Search this site

Navigation

Metadata

Home About Resume My Code (SVN)

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)

Tag Cloud

Calendar

< March 2005 >
SuMoTuWeThFrSa
   1 2 3 4 5
6 7 8 9101112
13141516171819
20212223242526
2728293031  

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati