# Apache mod_proxy slowness?



## rambetter (Oct 16, 2009)

Hiya folks.  This post is probably more for the people who are really familiar with Apache web server.

I am running apache-2.2.13 (from ports) on FreeBSD 7.1.  I have a "main" Apache process listening on port 80 and serving up multiple virtual hosts.  One of those virtual host entries is this one:


```
LoadModule proxy_module libexec/apache22/mod_proxy.so
LoadModule proxy_http_module libexec/apache22/mod_proxy_http.so

...

NameVirtualHost *:80

...

<VirtualHost *:80>
    ServerAlias test.clanwtf.net
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8082/
</VirtualHost>
```

I have another "mini" Apache process running as a different UNIX user listening on port 8082, only on the 127.0.0.1 interface.

So, I am proxying the URL http://test.clanwtf.net/ to an Apache process listening on port 8082 on the same box.  I am doing this to be able to have virtual hosts running as different processes, without having multiple IP addresses assigned to the server, and without having a port other than 80 show up in the end-user browser's location bar (if you have other brilliant ideas on how to do this, please let me know).

Now the problem seems to be that my website behind the proxy is loading rather slow.  It seems that the pages (which have many image resources, PHP scripts, and such) load rather quickly, but the "hourglass" on the web browser stays active for 10 seconds or more.  So, something on the client side is thinking it's still loading the page, when in fact it has already probably received all the data it's going to receive.

I am going to perform some serious diagnostic experiments tomorrow.  But in the meantime, does anyone know of any problems with mod_proxy that wouod be causing this slow behavior?  Just a wild guess, but could a lack of a content-length header and/or keep-alive be related?  I have not taken a close look at the HTTP headers yet.

Out of curiosity, do web hosting companies ever have multiple processes running for different virtual host websites, and if so, do they ue the mod_proxy technique to serve these virtual hosts, just like I am attempting to do here?


----------



## rambetter (Oct 19, 2009)

mod_proxy is working very well for me now, there were some slowdowns due to wrong config parameters in my httpd.conf, related to number of processes/threads and so on.  I now have:

StartServers 14
MaxClients 128
MinSpareServers 7
MaxSpareServers 14
MaxRequestsPerChild 10000

... with the prefork module.

mod_proxy for reverse proxy configuration is wonderful!


----------

