0

We're currently using OVH Load Balancers to serve our LAMP stack webapplication.

The problem is, that OVH LB services are really not that great and is down too much. The servers are also located with OVH, but they got a great uptime percentage, and we're therefore happy about those services.

So at the moment I'm trying to find a better solution to load balance our LAMP stack and also having the new load balancing handle fail-over if one of the servers are down.

I'm thinking about setting up nginx on a single server to act as a software load balancer, but need to know if I can manage cookies which that setup or if there is a more suitable setup.

Ours clients got their own subdomain as an entrance to their portal, and we can setup a domain per server if needed, so the setup would be something like:

Entry-point: https://client.brandname.com
Application server 1: https://client.brandname1.com
Application server 1: https://client.brandname2.com
Application server 1: https://client.brandname3.com

But we hold a sesson-key and a token within 2 sets up cookies named

session|client=xxx
token|client=xxx

We need those cookies to be created, read, modified and deleted by the application servers, so they need to be passed through the Load Balancer proxy, is this a possibility with the nginx load balancer setup?

So basically, can this be done via the nginx load balancer or is there a more suitable approach?

  • Cookies are part of the reply from the application sever, Nginx will pass them through as part of the stream. I don't see any issue using Nginx. A single load balancer is a single point of failure. You could set up two servers and using DNS load balancing - basically you create multiple A records and the client should (in theory) use a random record. You can get DNS servers that randomize the order of the records returned, which mitigates the situation where the first record is always used. – Tim Sep 21 '18 at 8:22
  • @Tim Awesome! I'm gonna try and set up the nginx load balancers then, and then use 2 dns records for the fail-over part. Thanks! Write your comment as an answer and i'll accept it :) – Behrens Sep 21 '18 at 10:36
0

Cookies

Cookies are part of the reply from the application sever, Nginx will pass them through just like any other part of the page. I don't see any issue using Nginx.

Single Point of Failure / DNS Load Balancing

A warning: a single load balancer is a single point of failure. You could set up two servers and using DNS load balancing - basically you create multiple A records and the client should (in theory) use a random record. However, I believe many just use the first record, which puts most or all of the load on one server.

To get around this you can get DNS servers that randomize the order of the records returned, which mitigates the situation where the first record is always used.

Multivalue Name Servers

CloudFlare will do round robin DNS for you, changing the order of the A records, according to this article. This should distribute the requests across your two load balancers.

AWS Route53 will also randomise the order of the records returned.

I've used both platforms. CloudFlare tends to be simpler, AWS tens to be more powerful and more complex.

Sticky Load Balancing

This setup will not provide you with sticky load balancing. If you need that you're going to need a more advanced load balancer. CloudFlare has a load balancer that can do this, as does AWS Route53.

0

In Terms of having two Loadbalancers and doing DNS Roundrobin to route traffic onto the balancers AWS with Route53 and enabled healthchecks included already at the DNS level can be a great solution.

As Loadbalancers there are many approaches, one can use Haorox, NGinx, Apache (mod_proxy_balancer), ...

In case you don't want to rely on external DNS providers keepalived can also help resolving the DNS/IP issue. In combination with haproxy this is a often used stack. There is also corosync/pacemaker for IP failover.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.