Allow apache to ignore .htaccess for increased performance

RESOLVED FIXED

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: dylan, Assigned: dylan)

Tracking

Production

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 2 obsolete attachments)

if you run strace on httpd during normal operation, you'll see we make thousands of stat() calls to .htaccess files.
One request for a file under /data/assets is three calls to stat(), and if NFS is involved those calls can take a decent amount of time.

We don't need to do this, we already send configuration directives to apache from mod_perl.

I intend to make mod_perl.pl read in the .htaccess file, and send the configuration to apache and also send AllowOverride None, which will prevent apache from looking for .htaccess files.
(Assignee)

Comment 1

2 years ago
Posted patch 1351695_1.patch (obsolete) — Splinter Review
Attachment #8852524 - Flags: review?(glob)
Comment on attachment 8852524 [details] [diff] [review]
1351695_1.patch

Review of attachment 8852524 [details] [diff] [review]:
-----------------------------------------------------------------

as per irc, there's multiple .htaccess files to accommodate:
https://github.com/mozilla-bteam/bmo/blob/master/Bugzilla/Install/Filesystem.pm#L340
Attachment #8852524 - Flags: review?(glob) → review-
(Assignee)

Comment 3

2 years ago
Posted patch 1351695_2.patch (obsolete) — Splinter Review
I moved this to its own file as it is easier to validate outside of apache:

perl -T -I. -MBugzilla::ModPerl -E 'say Bugzilla::ModPerl->apache_config(".")'

and it now looks for all .htaccess files.
Attachment #8852524 - Attachment is obsolete: true
Attachment #8852591 - Flags: review?(glob)
(Assignee)

Comment 4

2 years ago
sans Alive logging code.
Attachment #8852591 - Attachment is obsolete: true
Attachment #8852591 - Flags: review?(glob)
Attachment #8852593 - Flags: review?(glob)
Comment on attachment 8852593 [details] [diff] [review]
1351695_3.patch

Review of attachment 8852593 [details] [diff] [review]:
-----------------------------------------------------------------

r=glob

::: Bugzilla/ModPerl.pm
@@ +5,5 @@
> +#
> +# This Source Code Form is "Incompatible With Secondary Licenses", as
> +# defined by the Mozilla Public License, v. 2.0.
> +
> +package Bugzilla::ModPerl;

a package so good it was declared twice.

this may be better named Bugzilla::ModPerlConfig as that's all it does.

@@ +17,5 @@
> +
> +# We don't need (or want) to use Bugzilla's template subclass.
> +use Template ();
> +
> +sub apache_config {

a comment about why this is necessary would be helpful here.

@@ +28,5 @@
> +    my $wanted = sub {
> +        package File::Find;
> +        our ( $name, $dir );
> +
> +        if ( $name =~ /\.htaccess$/ ) {

$name =~ m#/\.htaccess$#
Attachment #8852593 - Flags: review?(glob) → review+
(Assignee)

Comment 6

2 years ago
With corrections

To git@github.com:mozilla-bteam/bmo.git
   b2744a5..30c35b3  master -> master
(Assignee)

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.