You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Colin Murtaugh <cm...@gmail.com> on 2012/09/13 20:02:18 UTC

[users@httpd] mod_proxy_balancer, balancer_manager questions

Hi --

I'm trying to set up a pair of tomcat servers behind apache using
mod_proxy_balancer.  I'm using Apache 2.4.3 that I built a couple of days
ago on Solaris.

I see in the 2.4 docs that balancer settings can now be persistent after
restarts.  I assume that this refers to changes to settings made via the
balancer-manager UI, but I can't seem to get it to work.

Here's my config:

<Proxy balancer://testcluster growth=5>
    BalancerMember http://localhost:8861 timeout=5 keepalive=on
    BalancerMember http://localhost:8871 timeout=5 keepalive=on
</Proxy>

ProxyPass /test balancer://testcluster
ProxyPassReverse /test balancer://testcluster

<Location /balancer-manager>
    SetHandler balancer-manager
</Location>


Load-balancing works as expected, but if I edit one of the two nodes via
balancer-manager to set its status to 'disabled', the status returns to Ok
after I restart apache.

Similarly, if I add a new worker to the cluster via balancer-manager, it's
gone after a restart.  In both of these cases, I expected the settings to
be as I left them before the restart.

Am I misunderstanding how the settings persistence is supposed to work, or
is there something else I need to do in order to get the settings to be
saved?

Additional question:

I have the timeout set to 5 seconds; if the back-end service takes longer
than 5 seconds to finish, the proxy does abandon the request as expected,
and I get an error in the browser.  Is there any way to have the proxy,
when the back-end times out, retry the request against another one of the
nodes?

Failing that, is there a way to have the occurrence of a timeout put the
node into the Err state?

Let me know if there are any other details that would be helpful.

Thanks!

--Colin

Re: [users@httpd] mod_proxy_balancer, balancer_manager questions

Posted by Colin Murtaugh <cm...@gmail.com>.
On Thu, Sep 13, 2012 at 7:33 PM, Daniel Ruggeri <DR...@primary.net>wrote:

>
> Does it give a unique failure code? This is actually the use case that
> drove me to add the failonstatus option for ProxySet. For example, some
> containers return a 503 when the app is not yet initialized but the
> container is up. Granted, you will still have one failed connection per
> every X retry seconds, but in high-volume sites a few failures is much
> more appetizing than hundreds.


I don't think it does, but maybe that's something I can change.

I'm still curious to understand what the new  "persistent after restart"
feature is supposed to do, and how I can get mod_proxy to write its
configuration state out to a file.

Re: [users@httpd] mod_proxy_balancer, balancer_manager questions

Posted by Daniel Ruggeri <DR...@primary.net>.
On 9/13/2012 4:10 PM, Colin Murtaugh wrote:
> I figured that might be the case; in this situation, the timeout is
> due to the backend being slow.  In particular, when I start up this
> tomcat server, it starts accepting connections quite quickly, but it
> may be 30-40 seconds before the app is fully loaded. It'd be great if
> the proxy could recognize that it's not really ready yet and put the
> node into the error state.  

Does it give a unique failure code? This is actually the use case that
drove me to add the failonstatus option for ProxySet. For example, some
containers return a 503 when the app is not yet initialized but the
container is up. Granted, you will still have one failed connection per
every X retry seconds, but in high-volume sites a few failures is much
more appetizing than hundreds.

-- 
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_proxy_balancer, balancer_manager questions

Posted by Colin Murtaugh <cm...@gmail.com>.
On Thu, Sep 13, 2012 at 2:51 PM, Jim Jagielski <ji...@jagunet.com> wrote:

>
> because these settings are stored in shared memory, post config,
> and changes made won't persist a restart or reboot since Apache
> goes back the honoring the httpd.conf file settings.
>
> If you need the updates to persist, you'll need to tell
> mod_proxy to write out the shared memory data to a file, which
> is then read and honored during the restart.
>
>
Ok - is that something I can do via configuration, or would this involve
modifying the mod_proxy code?

What is meant by the "balancer settings can be persistent after restart"
enhancement that was added in 2.3/2.4?


> > Additional question:
> >
> > I have the timeout set to 5 seconds; if the back-end service takes
> longer than 5 seconds to finish, the proxy does abandon the request as
> expected, and I get an error in the browser.  Is there any way to have the
> proxy, when the back-end times out, retry the request against another one
> of the nodes?
>
> If the back-end has started a reply, then there's no way to
> retry against someone else. Is the timeout due to the backend
> being slow or because it's down?
>

I figured that might be the case; in this situation, the timeout is due to
the backend being slow.  In particular, when I start up this tomcat server,
it starts accepting connections quite quickly, but it may be 30-40 seconds
before the app is fully loaded. It'd be great if the proxy could recognize
that it's not really ready yet and put the node into the error state.

Thanks --
Colin

Re: [users@httpd] mod_proxy_balancer, balancer_manager questions

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 13, 2012, at 2:02 PM, Colin Murtaugh <cm...@gmail.com> wrote:

> Hi --
> 
> I'm trying to set up a pair of tomcat servers behind apache using mod_proxy_balancer.  I'm using Apache 2.4.3 that I built a couple of days ago on Solaris. 
> 
> I see in the 2.4 docs that balancer settings can now be persistent after restarts.  I assume that this refers to changes to settings made via the balancer-manager UI, but I can't seem to get it to work.
> 
> Here's my config: 
> 
> <Proxy balancer://testcluster growth=5>
>     BalancerMember http://localhost:8861 timeout=5 keepalive=on
>     BalancerMember http://localhost:8871 timeout=5 keepalive=on
> </Proxy>
> 
> ProxyPass /test balancer://testcluster
> ProxyPassReverse /test balancer://testcluster
> 
> <Location /balancer-manager>
>     SetHandler balancer-manager
> </Location>
> 
> Load-balancing works as expected, but if I edit one of the two nodes via balancer-manager to set its status to 'disabled', the status returns to Ok after I restart apache. 
> 
> Similarly, if I add a new worker to the cluster via balancer-manager, it's gone after a restart.  In both of these cases, I expected the settings to be as I left them before the restart. 
> 
> Am I misunderstanding how the settings persistence is supposed to work, or is there something else I need to do in order to get the settings to be saved?
> 

because these settings are stored in shared memory, post config,
and changes made won't persist a restart or reboot since Apache
goes back the honoring the httpd.conf file settings.

If you need the updates to persist, you'll need to tell
mod_proxy to write out the shared memory data to a file, which
is then read and honored during the restart.

> Additional question:
> 
> I have the timeout set to 5 seconds; if the back-end service takes longer than 5 seconds to finish, the proxy does abandon the request as expected, and I get an error in the browser.  Is there any way to have the proxy, when the back-end times out, retry the request against another one of the nodes? 

If the back-end has started a reply, then there's no way to
retry against someone else. Is the timeout due to the backend
being slow or because it's down?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org