2

I run apache2 on Ubuntu as a caching load-balancing reverse proxy in front of a group of application servers. I have noticed that the balancer maintains some state for some of the attributes visible in /balancer-manager such as whether an IP is enabled/disabled, load factor, etc.

My site has periods of high (and low) usage, and recently as I added a new server to the working group I noticed that the load balancer picked up the new server but had it set to Disabled. I'm curious where that data is stored, and/or how it is initialized.

Balancer config (names changed to protect the innocent:

SSLProxyEngine On
<Proxy balancer://main>
    BalancerMember https://10.10.1.1
    BalancerMember https://10.10.1.2
    BalancerMember https://10.10.1.3
</Proxy>

ProxyRequests Off
ProxyPass /balancer-manager !
ProxyPass /  balancer://main/
ProxyPassReverse /  balancer://main/

UPDATE: code spelunking shows the balancer status stored in-memory only in v2.2.0 as the struct ap_scoreboard and reinitialized on startup. There's no way the thing I think I'm seeing is happening. Kudos to @ShaneMadden for the insights into v2.4.

4
  • Do you mean that changes that are made via the balancer manager (and not in the config files) are persisting across restarts of the apache service? Sep 17, 2012 at 20:04
  • So it would seem. It is unclear what Enabled state will be when I add a server IP into the rotation, if that server was once a part of the balancer group.
    – khoxsey
    Sep 17, 2012 at 20:07
  • @ShaneMadden Persistence of managed balancer-manager state is a new feature in Apache 2.4.
    – user207421
    Sep 17, 2012 at 21:33
  • @EJP So it is, I had missed that one! The changes doc says "can be persistent", but I'm not seeing any directive that governs whether persistence is used? Sep 17, 2012 at 21:34

1 Answer 1

2

This feature seems to be a bit of a mess.. the idea seems to be to use mod_slotmem_shm to persist balancer configs, which has an option to make its storage persistent.

To that end, the .shm files in your logs directory (location does not seem to be configurable) are where the configurations are stored, which seems to only happen on 2.4.2 and later. The file will be named slotmem-shm-<identifier>_balancername.shm for a balancer defined as <Proxy balancer://balancername>, for example.

However, in my testing the .shm file isn't created at all in 2.4.1, and doesn't persist through a service restart in 2.4.2 and 2.4.3. Can you clarify what conditions you have that are causing persistence - what modules are in use, what config, etc? Are the .shm files staying put when the service is stopped?

It looks like a change was committed today to do some logging relating to persistence. I tried to compile trunk to test out whether that would help clarify what's going on, and couldn't compile due to errors related to slotmem (go figure).

3
  • Running v2.2.20 (Ubuntu), so not using the new features in 2.4, and not loading the slotmem module. The issue seems to persist beyond just reboots; the LB/RP runs in Amazon EC2 and the "remembered state" exists in my stored AMI. It may be time for me to do some code spelunking, as I am curious where the init values come from if you don't provide them in proxy_balancer.conf.
    – khoxsey
    Sep 18, 2012 at 16:32
  • @khoxsey Hmm.. there shouldn't be any state storage, then - I wonder if something else strange is at work. What's the config for your balancer look like? Sep 18, 2012 at 18:25
  • Agreed about the state storage, I was surprised the first time I noticed it, and more curious each time it happens. Posted the config for review.
    – khoxsey
    Sep 18, 2012 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .