[Catalyst] 5.80005: $c->req->remote_user and apache: excluding actions from authentication

Francesc Romà i Frigolé francesc.roma+catalyst at gmail.com
Fri Jun 19 15:12:56 GMT 2009


On Wed, Jun 10, 2009 at 6:13 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:

>
>  Both perceptually and numerically. Since the deployment documentation
>> recommends not serving static files with catalyst I assumed it was norma=
l.
>>
>
> I'd still recommend serving your CSS/JS/icons directly through apache, it
> is more efficient.
>
> But for things like document downloads with access control etc, then just
> using:
>
>
> http://search.cpan.org/~flora/Catalyst-Plugin-Static-Simple-0.21/lib/Cata=
lyst/Plugin/Static/Simple.pm#serve_static_file_$file_path<http://search.cpa=
n.org/%7Eflora/Catalyst-Plugin-Static-Simple-0.21/lib/Catalyst/Plugin/Stati=
c/Simple.pm#serve_static_file_$file_path>
>
> very much works 'well enough' until you have lots (10s) of concurrent
> downloads.
>


t0m,

Sorry for taking so long to reply. I didn't have time to do some tests until
yesterday.

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.

Therefore I don't have any reason anymore to use HTTP auth, which will make
my setup much simpler :)

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

1) created application TestDownload with catalyst 5.8005

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} =3D 1;

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.

4) ln -s root/static root/public

5) Edit apache's .htaccess to send to catalyst the contents of the static
directory but not the public directory

AddHandler fastcgi-script .pl
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} /static/
RewriteRule ^(.*)$ script/testdownload_fastcgi.pl/$1 [QSA,L]

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/ .

Measured network statistics with firebug.

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.

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.

I hope this can be useful for somebody else.

Thanks again to all who replied.

Francesc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090619/83a02=
f9f/attachment.htm


More information about the Catalyst mailing list