You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Graham Leggett <mi...@sharp.fm> on 2010/10/21 01:43:23 UTC

mod_proxy: optimising ProxyPass per directory

Hi all,

On sites with large numbers of ProxyPass directives, these directives  
are matched in turn on every request, and this can take a lot of time,  
especially when we've already done a location walk.

A simple optimisation is to allow this existing syntax:

<Location /foo>
   ProxyPass http://somewhere/foo
</Location>

to simply be a single mod_proxy alias in a per-directory context.

If this syntax is used, the need to walk the proxy alias list is  
eliminated, and a significant amount of time is saved.

This also has the side effect that ProxyPass inside LocationMatch  
starts working properly (it was broken before):

<LocationMatch ^/foo(.*)>
   ProxyPass http://somewhere/$1
</LocationMatch>

In theory, the "ProxyPass /foo http://somewhere/" and "ProxyPassMatch  
^/foo(.*) http://somewhere/$1" syntaxes can be deprecated, as Location/ 
LocationMatch is way simpler to handle.

Regards,
Graham
--

Re: mod_proxy: optimising ProxyPass per directory

Posted by Daniel Ruggeri <DR...@primary.net>.
On 10/20/2010 6:43 PM, Graham Leggett wrote:
> Hi all,
>
> On sites with large numbers of ProxyPass directives, these directives
> are matched in turn on every request, and this can take a lot of time,
> especially when we've already done a location walk.
>
> A simple optimisation is to allow this existing syntax:
>
> <Location /foo>
> ProxyPass http://somewhere/foo
> </Location>
>
> to simply be a single mod_proxy alias in a per-directory context.
>
> If this syntax is used, the need to walk the proxy alias list is
> eliminated, and a significant amount of time is saved.
>
> This also has the side effect that ProxyPass inside LocationMatch starts
> working properly (it was broken before):
>
> <LocationMatch ^/foo(.*)>
> ProxyPass http://somewhere/$1
> </LocationMatch>
>
> In theory, the "ProxyPass /foo http://somewhere/" and "ProxyPassMatch
> ^/foo(.*) http://somewhere/$1" syntaxes can be deprecated, as
> Location/LocationMatch is way simpler to handle.
>
> Regards,
> Graham
> --
>

I like this idea quite a bit. I am not able to look at the codebase 
right now, but could this work the same for ProxyPassReverse?
--
Daniel Ruggeri


Re: mod_proxy: optimising ProxyPass per directory

Posted by Jim Jagielski <ji...@jaguNET.com>.
+1.


On Oct 20, 2010, at 7:43 PM, Graham Leggett wrote:

> Hi all,
> 
> On sites with large numbers of ProxyPass directives, these directives are matched in turn on every request, and this can take a lot of time, especially when we've already done a location walk.
> 
> A simple optimisation is to allow this existing syntax:
> 
> <Location /foo>
>  ProxyPass http://somewhere/foo
> </Location>
> 
> to simply be a single mod_proxy alias in a per-directory context.
> 
> If this syntax is used, the need to walk the proxy alias list is eliminated, and a significant amount of time is saved.
> 
> This also has the side effect that ProxyPass inside LocationMatch starts working properly (it was broken before):
> 
> <LocationMatch ^/foo(.*)>
>  ProxyPass http://somewhere/$1
> </LocationMatch>
> 
> In theory, the "ProxyPass /foo http://somewhere/" and "ProxyPassMatch ^/foo(.*) http://somewhere/$1" syntaxes can be deprecated, as Location/LocationMatch is way simpler to handle.
> 
> Regards,
> Graham
> --
> <httpd-mod_proxy-perlocation.patch>


Re: mod_proxy: optimising ProxyPass per directory

Posted by Graham Leggett <mi...@sharp.fm>.
On 21 Oct 2010, at 3:11 PM, Igor Galić wrote:

>> <LocationMatch ^/foo(.*)>
>>   ProxyPass http://somewhere/$1
>> </LocationMatch>
>
>
> Many many many many people have been asking how to implement
> something like:
>
> <LocationMatch ^/projects/([^/]+)>
>   Require group well..that...stuff.
> </LocationMatch>
>
>
> Could your idea be extended to be usable elsewhere as well?

If the group stuff is defined per-directory, then it should Just  
Work(TM).

It is definitely worth smoking out these occurrences, as storing per- 
directory configs in the global per-server scope is very expensive.

Regards,
Graham
--


Re: mod_proxy: optimising ProxyPass per directory

Posted by Igor Galić <i....@brainsware.org>.

> <LocationMatch ^/foo(.*)>
>    ProxyPass http://somewhere/$1
> </LocationMatch>
 

Many many many many people have been asking how to implement
something like:

<LocationMatch ^/projects/([^/]+)>
   Require group well..that...stuff.
</LocationMatch>


Could your idea be extended to be usable elsewhere as well?

> Regards,
> Graham
> --

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/