Gossamer Forum
Home : General : Internet Technologies :

mod_rewrite efficiency

Quote Reply
mod_rewrite efficiency
Hi

I'm just wondering how efficent mod_rewrite really is, and if there is a way to measure it's impact on the server?

The motivation behind this is to 'hide' the Perl script that drives the bookshop. There are multiple reasons for this, one of which is to make URLs much more user-friendly and indexible for search engines.

Here's what I have in my .htaccess file in the root directory:

Code:
memphis% cat .htaccess

# Rewrite rules for /bookshop.
#
RewriteEngine On
RewriteRule ^bookshop$ /bookshop/perl/bookshop.pl [L]
RewriteRule ^bookshop/$ /bookshop/perl/bookshop.pl [L]
RewriteRule ^bookshop/browse/([a-z]+)/$ /bookshop/perl/bookshop.pl?do=vc;c=$1;l=e [L]
RewriteRule ^bookshop/browse/([a-z]+)/([a-z]+)/$ /bookshop/perl/bookshop.pl?do=vc;c=$1;fi=$2;l=e [L]
RewriteRule ^bookshop/view/([a-z0-9A-Z]+)/$ /bookshop/perl/bookshop.pl?do=vb;isbn=$1;l=e [L]
RewriteRule ^bookshop/do/basket/$ /bookshop/perl/bookshop.pl?do=view_cart;l=e [L]
RewriteRule ^bookshop/do/order/$ /bookshop/perl/bookshop.pl?do=co;l=e [L]
RewriteRule ^bookshop/do/delete/([a-z0-9A-Z]+)/$ /bookshop/perl/bookshop.pl?do=rb;isbn=$1;l=e [L]

The server is an Athlon 1.6 with a gig of RAM, running Debian and under mod_perl. The site is expected to get around a thousand hits per day.

Is this mod_rewrite going to put considerably extra strain on the server? Do you think it will be a bottleneck? If so, how can I make it more efficent? Has anyone experienced similar performance gain or losses with the search engine templates that are provided on this forum software, maybe?

- wil
Quote Reply
Re: [Wil] mod_rewrite efficiency In reply to
I use mod_rewrite quite a lot these days, and generally the performance hit seems to be minimal, if even noticeable. Granted, I haven't the expertise to do any kind of real benchmark testing, but I do maintain a few highly trafficked sites which manage just fine even though almost every url is "mod_rewritten".

Glancing at your rewrite rules, the only thing that jumps out at me as an opportunity for consolidation is:

Code:
RewriteRule ^bookshop$ /bookshop/perl/bookshop.pl [L]
RewriteRule ^bookshop/$ /bookshop/perl/bookshop.pl [L]


which could be consolidated as:

RewriteRule ^bookshop/?$ /bookshop/perl/bookshop.pl [L]


That's obviously quite minor, but it's just something I noticed.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [Wil] mod_rewrite efficiency In reply to
Hi,

mod_rewrite won't have any kind of impact with that level of traffic.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] mod_rewrite efficiency In reply to
Good to know.

Thanks

- wil