You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christian Wittwer <wi...@gmail.com> on 2010/09/07 08:04:57 UTC

[users@httpd] How much backend connections with mod_proxy and multiple VirtualHost

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 (http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass).
But how do I calculate that?
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?

Regards,
Christian

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How much backend connections with mod_proxy and multiple VirtualHost

Posted by Rainer Jung <ra...@kippdata.de>.
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 (http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass).
> 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 
try:

- 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).

Regards,

Rainer

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org