Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

[PATCH] mod_proxy Unix domain socket support

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


blaise.tarr at gmail

Jul 31, 2012, 1:06 PM

Post #1 of 4 (2026 views)
Permalink
[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
Attachments: proxy-uds.patch (14.7 KB)


jim at jaguNET

Aug 2, 2012, 7:07 AM

Post #2 of 4 (1988 views)
Permalink
Re: [PATCH] mod_proxy Unix domain socket support [In reply to]

Thx for the patch... I'll take a look.

On Jul 31, 2012, at 4:06 PM, Blaise Tarr <blaise.tarr [at] gmail> 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>


blaise.tarr at gmail

Feb 26, 2013, 2:00 PM

Post #3 of 4 (1682 views)
Permalink
Re: [PATCH] mod_proxy Unix domain socket support [In reply to]

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


jim at jaguNET

Mar 1, 2013, 7:04 AM

Post #4 of 4 (1679 views)
Permalink
Re: [PATCH] mod_proxy Unix domain socket support [In reply to]

Thx!
On Feb 26, 2013, at 5:00 PM, Blaise Tarr <blaise.tarr [at] gmail> 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
>

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.