<div class="gmail_quote">On Wed, Jun 10, 2009 at 6:13 PM, Tomas Doran <span dir="ltr"><<a href="mailto:bobtfish@bobtfish.net">bobtfish@bobtfish.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Both perceptually and numerically. Since the deployment documentation recommends not serving static files with catalyst I assumed it was normal.<br>
</blockquote>
<br></div>
I'd still recommend serving your CSS/JS/icons directly through apache, it is more efficient.<br>
<br>
But for things like document downloads with access control etc, then just using:<br>
<br>
<a href="http://search.cpan.org/%7Eflora/Catalyst-Plugin-Static-Simple-0.21/lib/Catalyst/Plugin/Static/Simple.pm#serve_static_file_$file_path" target="_blank">http://search.cpan.org/~flora/Catalyst-Plugin-Static-Simple-0.21/lib/Catalyst/Plugin/Static/Simple.pm#serve_static_file_$file_path</a><br>
<br>
very much works 'well enough' until you have lots (10s) of concurrent downloads.<div><div></div><div class="h5"></div></div></blockquote><div><br><br>t0m,<br><br></div></div>Sorry for taking so long to reply. I didn't have time to do some tests until yesterday.<br>
<br>You were right and I was wrong: I couldn't find any measurable difference between serving files directly with apache or with Catalyst::Plugin::Static::Simple on the conditions we had discussed. I've been repeating the test during last 24h to see if there where any differences depending on server conditions, but results have remained consistent. I tested with relatively small files (around 1MB) because the impact of tcp slow start should be more noticeable. I'm not concerned about smaller files since I don't have any privacy issues for things like CSS and icons.<br>
<br>Therefore I don't have any reason anymore to use HTTP auth, which will make my setup much simpler :)<br><br>I don't have any notes on how I tested last time, so I don't know what went wrong. I'll write what I did this time for future reference. It's a really simple test<br>
<br>1) created application TestDownload with catalyst 5.8005<br><br>2) set logging for Catalyst::Plugin::Static::Simple in lib/TestDownload.pm, to be able to verify whether files are being served by catalyst or apache. Added line __PACKAGE__->config->{static}->{logging} = 1;<br>
<br>3) put a few images and an html file that displays the images in root/static. I called the html file test.htm (not html) so that C:P:Static::Simple doesn't ignore it.<br><br>4) ln -s root/static root/public<br><br>
5) Edit apache's .htaccess to send to catalyst the contents of the static directory but not the public directory<br><br>AddHandler fastcgi-script .pl<br>RewriteEngine On<br>RewriteCond %{REQUEST_FILENAME} /static/<br>
RewriteRule ^(.*)$ script/testdownload_fastcgi.pl/$1 [QSA,L]<br><br>6) with Firefox 3, open the uri static/test.htm and public/test.htm. Check in the logs that I get the traces from C:P:Static:Simple for the files under static/ but not for the files under public/ . <br>
<br>Measured network statistics with firebug.<br><br>Results: On a 6MB cable connection across the Atlantic, for downloading the html and 5 images of about 5MB total, it takes about 11s +/- 2s. The results are distributed randomly in this range, they are highly correlated for both scenarios. Sometimes the files served by catalyst arrive a few 100 ms faster than the ones served by apache, sometimes is the other way around. The 5 images are downloaded in parallel, which is relevant for my usage scenario.<br>
<br>Sometimes the application is not running, and it needs to be restarted, which takes about 5s extra, but that's not relevant for this test.<br><br>I hope this can be useful for somebody else.<br><br>Thanks again to all who replied.<br>
<br>Francesc<br><br><br><br><br>