Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Speeding up Apache RewriteMap script.

by Moron (Curate)
on Apr 25, 2007 at 11:39 UTC ( #611971=note: print w/replies, xml ) Need Help??


in reply to Speeding up Apache RewriteMap script.

I agree with merlyn, but if for some reason you are stuck with this approach, then the most obvious optimisation that stares back at me would be to put configuration values as assignments in httpd.conf (loaded once per server startup) instead of having a full cycle of file i/o to read that separate config file occurring once per rewrite.
__________________________________________________________________________________

^M Free your mind!

  • Comment on Re: Speeding up Apache RewriteMap script.

Replies are listed 'Best First'.
Re^2: Speeding up Apache RewriteMap script.
by graq (Curate) on Apr 25, 2007 at 12:52 UTC

    The mapper script only reads the file once for each VirtualHost (when Apache starts). It then sits in memory.

    configuration values as assignments in httpd.conf

    I'm not sure how this will solve my problem (perhaps I have not explained the problem well enough). Do you have a snippet example?

    -=( Graq )=-

      In your OP you said "As this script is going to be hit so many times by the webserver, I wondered if anyone had ideas on speeding it up?"

      So if that is no longer perceived to be the case, I guess we can close this issue now?

      __________________________________________________________________________________

      ^M Free your mind!

      Key to hats: ^I=white ^B=black ^P=yellow ^E=red ^C=green ^M=blue - see Moron's scratchpad for fuller explanation.

        Apologies for not being clear.

        Apache opens the script and holds it open for its lifetime. RewriteMap writes to it (hence the while(<STDIN>){..} loop) and waits for output from STDOUT.

        For every such mapping (read: every http request), the lookup method is called. I assumed that that is where the main speed up could be attained.

        Although I'm not sure how moot this is with merlyn's reply in play

        -=( Graq )=-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://611971]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2022-10-02 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (11 votes). Check out past polls.

    Notices?