httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: [users@httpd] How much backend connections with mod_proxy and multiple VirtualHost
Date Tue, 07 Sep 2010 07:45:21 GMT
On 07.09.2010 08:04, Christian Wittwer wrote:
> Hi,
> We're currently using a setup with a tomcat application server and an
> apache in front. The configuration looked like this.
> Apache/2.2.3 with prefork model and 7 virtualhosts. Each virtualhost
> had the following proxypass to the tomcat ajp connector.
> ProxyPass / ajp://localhost:8009/
> Now we changed the setup a bit and encountered massive problems. The
> configuration now looks like this.
> Apache/2.2.3 with prefork model and 40 virtualhosts. Each virtualhost
> has the same proxypass as defined above.
> After running this setup for some hours, we saw a lot of the following
> messages in the apache error_log.
> [Wed Aug 25 07:41:48 2010] [error] (70007)The timeout specified has
> expired: ajp_ilink_receive() can't receive header
> [Wed Aug 25 07:41:48 2010] [error] ajp_read_header: ajp_ilink_receive failed
> [Wed Aug 25 07:41:48 2010] [error] (120006)APR does not understand
> this error code: proxy: read response failed from (null) (localhost)
> I guess it's somehow related to the topic, how much backend
> connections mod_proxy opens. I know I can limit the connections using
> max, smax (
> But how do I calculate that?

Each worker uses a connection pool, which is local to the individual 
processes. Since prefork is single-threaded, the pool has maximum size 1 
(unless configured otherwise, but there's no sense it making it bigger).

> I have a ServerLimit of 1024. Does this mean that apache opens 1024 x
> 40 (virtualhosts, each has a proxypass) = 40960 connections to my
> tomcat?

At least it means each process has at most 1 connection per worker. Why 
"at most"? Since idle connections can be closed, depending on your 
worker attributes.

Now how many workers do we have? Actually without explicitely checking 
in the source I'm not sure, whether the above ProxyPass used per VHost 
actually creates a worker per VHost, or only a global one. Maybe you can 

- using "lsof" or "netstat -anp" to check, whether there is an Apache 
cild process having more than one connection to 8009. Then it is quite 
likely, that workers are per vhost.

- move the ProxyPass from the vhosts to the global host if this is 
possible for your config, test whether that actually works and makes 
things better.

- switch to worker, because then the reuse frequency for backend 
connections typically gets better and thus you need fewer connections 
(e.g. although you might configure 50 threads per child process, the 
typical pool size might be 10; YMMV).



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message