Nginx changing settings on the fly?

We’re currently using CrossRoads for our load balancing needs and are
evaluating a switch to Nginx. We are excited by the existence of a
pacemaker/heartbeat ocf script. But one of the needs that we have is
that
our web servers have somewhat volatile load averages. Some hits cause a
tremendous amount of processing, most others cause very little.

The nginx config option “weight” allows you to balance how much load to
preferentially give to which host, but can this option be changed in
value
without restarting nginx? I would want to default to “1” and then have
each
logic server announce to the load balancer what weight should be used,
in
short intervals.

Crossroads has a web-based admin interface that we use to set an
equivalent
value in crossroads so that busy servers are effectively “routed around”
until their load drops to a more normal value.

In Crossroads’ case it would look something like:

#! /bin/sh
loadbalancer=“crossroads.mycompany.com
servername=“alphabits”
weight=“4.5”
wget http://$loadbalancer/$servername/load/$weight

Does nginx have a feature like this?

Posted at Nginx Forum:

RTFM ^^

http://nginx.org/en/docs/beginners_guide.html#control
http://nginx.org/en/docs/control.html

The command described by the Beginner’s Guide are available on the
service
file installed by the official package from the nginx.org repository.

Have you even tried out Nginx properly before? That’s one of the 1st
question I have about configuration management…

B. R.

Hi,

On Fri, Jul 26, 2013 at 6:33 PM, YesThatGuy [email protected]
wrote:

B.R. thanks for not answering the question. Perhaps you’d do well to
RTFM(essage)?


No problem, you are welcome…​

Should I assume that that only way to set the weight parameter is by
updating the config file and reloading the config?

If you RTFM and got interested in Nginx design and the way it deals with
its configuration, you would have known that a master process loads the
configuration and spawns workers which only job is to deal with
requests.​

So… Changing configuration would mean signaling the master process in
some way…

You could write configuration in a conf.d directory where Nginx loads
*.conf files with a script and then automatically behind signal Nginx to
reload the conf with the same script.

Posted at Nginx Forum:
Re: Nginx changing settings on the fly?


nginx mailing list
[email protected]
nginx Info Page

I am deeply sorry to have provided you with a RTFM answer that outraged
you.
Please accept my apologies and rest assured that won’t occur anymore.
Sometimes silence is golden.


​​

B. R.

B.R. thanks for not answering the question. Perhaps you’d do well to
RTFM(essage)?

Should I assume that that only way to set the weight parameter is by
updating the config file and reloading the config?

Posted at Nginx Forum:

On 26 July 2013 22:18, YesThatGuy [email protected] wrote:

short intervals.
I’d be looking at HAProxy for this. You can update weights of existing
servers on the fly via a unix socket. Of course, your runtime state
then diverges from your on-disk startup state, but that sounds like
the mechanism you’re looking for.

J

So… Changing configuration would mean signaling the master process in
some way…

Sounds like it wouldn’t be a good environment for frequently updating
config
values, and it doesn’t seem like it would be a simple “bolt-on” feature
given the architecture involved.

I am deeply sorry to have provided you with a RTFM answer that outraged
you…
Please accept my apologies and rest assured that won’t occur anymore.
Sometimes silence is golden.

I’ve made the same mistake. My reply may have been un-necessarily short
as
well, and for that I apologize in kind.

Posted at Nginx Forum: