You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Blaise Tarr <bl...@gmail.com> on 2012/07/31 22:06:03 UTC

[PATCH] mod_proxy Unix domain socket support

Hi,

The attached patch adds support for Unix domain sockets (UDS) to
mod_proxy. This is very beneficial when configuring a reverse proxy
using mod_proxy_fcgi to connect to PHP-FPM. In some tests with ab
there was over 20% improvement in the request rate when using a UDS
instead of TCP.

Since remote servers in mod_proxy are configured with a URL, I took
the idea from this page on how to represent a UDS as a URL:
http://daniel.haxx.se/blog/2008/04/14/http-over-unix-domain-sockets/

So the host portion of the URL contains "socket=" followed by the URI
encoded socket path (upper case characters must be encoded too). Below
are a couple of examples where PHP-FPM's socket is /tmp/php-fpm.sock
and the document root is /local/htdocs:

ProxyPass fcgi://socket=%2ftmp%2fphp-fpm.sock/local/htdocs/

RewriteRule (.*\.php) fcgi://socket=\%2ftmp\%2fphp-fpm.sock/local/htdocs/$1 [P,L]

The following are not contained in the patch:
* bump MMN due to mod_proxy.h changes
* assign APLOGNO numbers
* detection of AF_UNIX support in configure

Thanks for your consideration,
Blaise

Re: [PATCH] mod_proxy Unix domain socket support

Posted by Jim Jagielski <ji...@jaguNET.com>.
Thx!
On Feb 26, 2013, at 5:00 PM, Blaise Tarr <bl...@gmail.com> wrote:

> Hello,
> 
> I updated my patch which adds Unix domain socket support to mod_proxy
> to resolves a problem on BSD systems. The patch is against Apache
> 2.4.4. Please see this bugzilla for the details:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=54101#c1
> 
> Thanks,
> Blaise
> 


Re: [PATCH] mod_proxy Unix domain socket support

Posted by Blaise Tarr <bl...@gmail.com>.
Hello,

I updated my patch which adds Unix domain socket support to mod_proxy
to resolves a problem on BSD systems. The patch is against Apache
2.4.4. Please see this bugzilla for the details:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54101#c1

Thanks,
Blaise

Re: [PATCH] mod_proxy Unix domain socket support

Posted by Jim Jagielski <ji...@jaguNET.com>.
Thx for the patch... I'll take a look.

On Jul 31, 2012, at 4:06 PM, Blaise Tarr <bl...@gmail.com> wrote:

> Hi,
> 
> The attached patch adds support for Unix domain sockets (UDS) to
> mod_proxy. This is very beneficial when configuring a reverse proxy
> using mod_proxy_fcgi to connect to PHP-FPM. In some tests with ab
> there was over 20% improvement in the request rate when using a UDS
> instead of TCP.
> 
> Since remote servers in mod_proxy are configured with a URL, I took
> the idea from this page on how to represent a UDS as a URL:
> http://daniel.haxx.se/blog/2008/04/14/http-over-unix-domain-sockets/
> 
> So the host portion of the URL contains "socket=" followed by the URI
> encoded socket path (upper case characters must be encoded too). Below
> are a couple of examples where PHP-FPM's socket is /tmp/php-fpm.sock
> and the document root is /local/htdocs:
> 
> ProxyPass fcgi://socket=%2ftmp%2fphp-fpm.sock/local/htdocs/
> 
> RewriteRule (.*\.php) fcgi://socket=\%2ftmp\%2fphp-fpm.sock/local/htdocs/$1 [P,L]
> 
> The following are not contained in the patch:
> * bump MMN due to mod_proxy.h changes
> * assign APLOGNO numbers
> * detection of AF_UNIX support in configure
> 
> Thanks for your consideration,
> Blaise
> <proxy-uds.patch>