httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Blaise Tarr <blaise.t...@gmail.com>
Subject [PATCH] mod_proxy Unix domain socket support
Date Tue, 31 Jul 2012 20:06:03 GMT
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

Mime
View raw message