<div class="gmail_quote">On Wed, Jun 10, 2009 at 6:13 PM, Tomas Doran <span dir="ltr">&lt;<a href="mailto:bobtfish@bobtfish.net">bobtfish@bobtfish.net</a>&gt;</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&#39;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 &#39;well enough&#39; 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&#39;t have time to do some tests until yesterday.<br>

<br>You were right and I was wrong: I couldn&#39;t find any measurable difference between serving files directly with apache or with Catalyst::Plugin::Static::Simple on the conditions we had discussed. I&#39;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&#39;m not concerned about smaller files since I don&#39;t have any privacy issues for things like CSS and icons.<br>

<br>Therefore I don&#39;t have any reason anymore to use HTTP auth, which will make my setup much simpler :)<br><br>I don&#39;t have any notes on how I tested last time, so I don&#39;t know what went wrong. I&#39;ll write what I did this time for future reference. It&#39;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__-&gt;config-&gt;{static}-&gt;{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&#39;t ignore it.<br><br>4) ln -s root/static root/public<br><br>

5) Edit apache&#39;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&#39;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>