|Keep It Simple, Stupid|
Speeding up Apache RewriteMap script.by graq (Curate)
|on Apr 25, 2007 at 11:12 UTC||Need Help??|
graq has asked for the
wisdom of the Perl Monks concerning the following question:
I have the requirement that I need to map the start of (what is effectively) PATH_INFO to an int (PK on some table). I had a look at Apache RewriteMap and chose to go down that route. I'm not sure what go-faster techniques are valid in this environment, or whether they would have any impact (e.g. memoize).
Using files to lookup the values, RewriteMap only handles simple string comparisons, which does not cater for my need.These are my test URLs:
This is my mapfile:
Consider using the following mapping:
Because Apache uses a simple text match, the '/'s (slashes) in the URLs break the mapping. Which led me to use a program.Apache Config: RewriteMap mapping prg:/my/dir/mapper.pl
As this script is going to be hit so many times by the webserver, I wondered if anyone had ideas on speeding it up?
-=( Graq )=-