Re: Measurements of htaccess processing penalty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The whole point of .htaccess files is that they aren't cached, it gives users who are not able to control the server the ability to make configuration changes. If you can control the server process, you should prut configuration in <Directory> sections that are loaded at start time which are then cached in memory by the server process.

- Y

On Mon, Mar 4, 2024 at 2:34 PM Marc <Marc@xxxxxxxxxxxxxxxxx> wrote:
If you are testing, can you do it again with putting the .htaccess in cache? I am just curious :)

https://hoytech.com/vmtouch/

>
> The HTTPD documentation says "You should avoid using .htaccess files
> completely if you have access to httpd main server config file. Using
> .htaccess files slows down your Apache http server. Any directive that you
> can include in a .htaccess file is better set in a Directory block, as it
> will have the same effect with better performance."
> I wanted to see if I could measure how much slower it is and boy does it
> make a difference. (This is actually part of my PhD research into how to
> better understand configuration management.)
>
> I built HTTPD from source with a lot of debugging features (i.e. symbols, no
> compiler optimization), so these specific numbers are only valid in the
> context of this test, but they are still interesting.
>
> I created a file DOCUMENT_ROOT/1.txt containing just the text "1" (Short
> URL) and a file
> DOCUMENT_ROOT/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21.txt
> containing the text "21" (Long URL).
> I used ab to run get requests, first 10,000, then 100,000, then 100,000
> again, just to check for variability (and it turns out there isn't any
> significant variability). I ran ab on the same machine as httpd.
> I ran the requests first with AllowOverride None, then with AllowOverride
> All but no .htaccess files, then with AllowOverride All and .htaccess files
> with a mix of "Require all denied" and "Require all granted".
> I also collected the number of instructions executed by the system using
> perf.
>
> Here is a quick summary of the results:
>
> AllowOverride None / Long URL:
> - 1.367 seconds
> - 13.637 seconds
> - 13.607\ seconds
>
> AllowOverride None / Short URL:
> - 1.283 seconds
> - 12.981 seconds
> - 12.989 seconds
>
> AllowOverride All / Long URL:
> - 2.002 seconds
> - 20.015 seconds
> - 20.032 seconds
>
> AllowOverride All / Short URL:
> - 1.370 seconds
> - 13.581 seconds
> - 13.590 seconds
>
> AllowOverride All / Long URL with `.htaccess` files:
> - 3.062 seconds
> - 31.042 seconds
> - 31.122 seconds
>
> AllowOverride All / Short URL with `.htaccess` files
> - 1.431 seconds
> - 14.487 seconds
> - 14.461 seconds
>
>
> The change in perf counters matched the changes in wall clock time.
> The only thing surprising about any of these results was the magnitude of
> the performance effects.
> I think it is most interesting that for this example of a path 20
> directories deep, having an extra .htaccess file nested in each directory
> actually doubled the amount of time it took to process the request.
>
> - Y

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux