Nginx as loadbalancer (Round Robin)

Hi all

I have a strange problem with Nginx.

As long as I only have 2 frontend nodes all is fine and Nginx will toggle between the 2. If I decide to add another node then the toggling stops and only 1 node is hit and used. From the loadbalancer node I can curl (192.xxx.xxx.xxx:80) the local private IPs of the frontend nodes so they are reachable. I can also ping them.

Anyone who knows why Nginx behaves like this?

4 Replies

It seems to be a problem with caching. The server where the loadbalancer resides must be caching a page I guess… strange I have really not noticed before. I can see the data fetched from DB (set and get on the same page request) is not renewed but old data shown.

If I type different chars after ? in the url I get new data so the caching is avoided.

Am I not right in assuming the it must be the loadbalancer that caches the result?

I have a correction as to the caching comment. I installed Varnish as loadbalancer to see if the problem persisted and it did - and with Varnish pages also got cached (even the db fetch did not happen) and only if adding ?newsign could I remove caching eg the different nodes was all used and db fetch happened.

With Nginx db fetches are done so no caching there only the Round Robin logic do not happen. Again if applying ?newsign the Round Robin logic is working.

Any help will be greatly appreciated

Check that your browser isn't the one caching them ;)

Not to sound like an advertisement, but you might want to check out Linode's new managed load balancer service, NodeBalancer instead of doing it yourself.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct