You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christophe JAILLET <ch...@wanadoo.fr> on 2021/09/21 19:51:57 UTC

[users@httpd] Re: Redirects and rewrites and performance

Hi,

Le 20/09/2021 à 18:29, Dave Wreski a écrit :
> Hi,
> 
> At what point does it begin to affect performance with the number of 
> redirects and rewrites being used on a website? Have there been any 
> performance studies on this?

I've never seen such benchmark up to now.

> 
> We have a website (linuxsecurity.com) that's been around for decades, 
> through many migrations, and have collected many (~10k) redirects along 
> the way.
> 
> We've also gone through a Joomla migration from the old 
> /content/view/33/45 style links to the SEF/title alias format, and have 
> a script that translates those dynamically as requested.
> 
> Of course it depends on server load and other factors, but when does it 
> become a point where searching through thousands of links that Apache 
> has stored in memory results in some significant additional delay?
> 
> Are there other methods of doing these redirects?

Have a look at RewriteMap with dbm files [1], [2].
It looks like what you are looking for.
Your conf file will be much smaller using an indexed file format should 
highly reduce the overhead of thousands of redirections to check.

> Would implementing 
> them in Joomla directly make any difference, or only add another layer 
> of abstraction?

I think that it would add another layer of abstraction.

> 
> Here's one example of a rewrite we're currently using:
> RewriteRule 
> ^/features/features/verifying-linux-server-security-what-every-admin-needs-to-know$ 
> /features/features/verifying-linux-server-security [L,R=301]
> 
> RewriteRule 
> ^/advisories/fedora/fedora-25-rubygem-rmagick-security-update$ 
> /advisories/fedora/fedora-25-rubygem-rmagick-security-update-15-25-00-217101 
> [L,R=301]

If all your rules are like that (i.e. if you don't have regex), the 
above RewriteMap dbm should be just fine.

> Also, is there a way to trace a specific redirect? I've somehow created 
> a redirect loop with one of our articles, but enabling tracing on the 
> whole site will create a significant amount of data that makes it very 
> difficult to focus on just the one I'm interested in.

I don't think it is possible.

CJ

> LogLevel warn ssl:error auth_digest:error socache_shmcb:warn 
> mpm_worker:warn fcgid:info cache_disk:debug log_config:debug rewrite:trace3
> 
> Thanks,
> Dave

[1]: https://httpd.apache.org/docs/2.4/en/mod/mod_rewrite.html#rewritemap
[2]: https://httpd.apache.org/docs/2.4/en/rewrite/rewritemap.html#dbm

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Redirects and rewrites and performance

Posted by Darryl Philip Baker <da...@northwestern.edu>.
I have some virtual hosts with well over 100 redirects and I have not seen a user perceptible performance difference. I am sure there will be a machine measurable different between the time it takes for the first redirect versus the last but it doesn't affect the user experience.

Darryl Baker, GSEC  (he/him/his)
Sr. System Administrator
Distributed Application Platform Services
Northwestern University
1800 Sherman Ave.
Suite 6-600 – Box #39
Evanston, IL  60201-3715
darryl.baker@northwestern.edu
(847) 467-6674 <tel:+18474676674>
 

On 9/21/21, 2:52 PM, "Christophe JAILLET" <ch...@wanadoo.fr> wrote:

    Hi,

    Le 20/09/2021 à 18:29, Dave Wreski a écrit :
    > Hi,
    > 
    > At what point does it begin to affect performance with the number of 
    > redirects and rewrites being used on a website? Have there been any 
    > performance studies on this?

    I've never seen such benchmark up to now.

    > 
    > We have a website (linuxsecurity.com) that's been around for decades, 
    > through many migrations, and have collected many (~10k) redirects along 
    > the way.
    > 
    > We've also gone through a Joomla migration from the old 
    > /content/view/33/45 style links to the SEF/title alias format, and have 
    > a script that translates those dynamically as requested.
    > 
    > Of course it depends on server load and other factors, but when does it 
    > become a point where searching through thousands of links that Apache 
    > has stored in memory results in some significant additional delay?
    > 
    > Are there other methods of doing these redirects?

    Have a look at RewriteMap with dbm files [1], [2].
    It looks like what you are looking for.
    Your conf file will be much smaller using an indexed file format should 
    highly reduce the overhead of thousands of redirections to check.

    > Would implementing 
    > them in Joomla directly make any difference, or only add another layer 
    > of abstraction?

    I think that it would add another layer of abstraction.

    > 
    > Here's one example of a rewrite we're currently using:
    > RewriteRule 
    > ^/features/features/verifying-linux-server-security-what-every-admin-needs-to-know$ 
    > /features/features/verifying-linux-server-security [L,R=301]
    > 
    > RewriteRule 
    > ^/advisories/fedora/fedora-25-rubygem-rmagick-security-update$ 
    > /advisories/fedora/fedora-25-rubygem-rmagick-security-update-15-25-00-217101 
    > [L,R=301]

    If all your rules are like that (i.e. if you don't have regex), the 
    above RewriteMap dbm should be just fine.

    > Also, is there a way to trace a specific redirect? I've somehow created 
    > a redirect loop with one of our articles, but enabling tracing on the 
    > whole site will create a significant amount of data that makes it very 
    > difficult to focus on just the one I'm interested in.

    I don't think it is possible.

    CJ

    > LogLevel warn ssl:error auth_digest:error socache_shmcb:warn 
    > mpm_worker:warn fcgid:info cache_disk:debug log_config:debug rewrite:trace3
    > 
    > Thanks,
    > Dave

    [1]: https://urldefense.com/v3/__https://httpd.apache.org/docs/2.4/en/mod/mod_rewrite.html*rewritemap__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!H15NUmaqyz0QLEZUAATg9MxjKtmyxmho9SiQu1pzWSG6M2_fa1PFADcddd24gDngUhKjOD9KVw$ 
    [2]: https://urldefense.com/v3/__https://httpd.apache.org/docs/2.4/en/rewrite/rewritemap.html*dbm__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!H15NUmaqyz0QLEZUAATg9MxjKtmyxmho9SiQu1pzWSG6M2_fa1PFADcddd24gDngUhKC89x46Q$ 

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
    For additional commands, e-mail: users-help@httpd.apache.org