0

I want to add a load balancer to my forge on digital ocean.

The configuration I would like it

Load Balancer (nginx) Web Servers @ 2-4 DB Server

I am wondering what configuration these instances need to be.

I have the web servers @ the smallest instance and stopping/uninstalling mariadb 512 MB / 20 GB

The DB server is 2GB / 40 GB

I have no idea what the configuration of the load balancer should be.

I know it depends on the traffic the site is going to get, but it would be great to get an idea of a starting point. If you have 100,000 hits a day or where the load balancers breaking points are.

I was thinking of using redis to manage session state. Do I need to set up a separate server to run that or can I run it on my load balancer?

whoacowboy
  • 103
  • 4

1 Answers1

2

I'm not completely certain what is being asked for, but I'll try to address each sections best I can.

Typically, a load balancing via nginx is setup like so: load balancer > web server > db server. That is, load balancer asks for the page from the web server and web server gets its data from the db server.

Logically, it would look like this (though it has more than you need)

enter image description here

But how it's physically set up, it would look like this

enter image description here

So, it would be under the same vlan. You can set it up differently, but it's just the most common setup.


To the question of how to set up the configuration, digital-ocean actually has a guide on it already. https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-load-balancing

The most important part is the upstream. It defines which web server it's going to and with the weights, how much of it is being directed somewhere.


To the question of how much load the load balancer can handle depends on how much you ask of the load balancer. The rules in nginx can get quite complex and lengthy. There may even be scenarios where you have to write ugly if statements. You may have many customized scenarios for certain IPs. All these things that the configuration needs to go over will increase the load per request.

At the very simplest of configurations though, 100,000 requests/day is a minuscule amount for most servers to handle. Load balancing alone isn't do a whole lot of work. So it's entirely possible the smallest instance can easily handle 100k requests (assuming no bandwidth bottleneck) but I'm not familiar with digital ocean's packages to say with certainty.

So if you feel that running load balancer alone on the server is waste of its resources, you could certainly put more work on to it like redis. But that's entirely up to you.

You could even deploy a single/fewer bigger instance (or dedicated server) and run all these logical servers under fewer physical server. It would probably save money since it sounds like it's viable (I don't know your application and could be wrong).

Grumpy
  • 2,979
  • 18
  • 23
  • Sorry my question wasn't clear, but you did answer it. I am curious, what kind of traffic does a load balancer need before you would need to get a bigger instance? – whoacowboy Sep 01 '17 at 18:23
  • @whoacowboy Again, I don't use digital ocean so I don't know of it's performance capabilities. But to give a really rough gauge, 10s of million hit/day doesn't even really phase a modern dedicated server. It increases load because it's waiting on backend servers. But its active work is just so minuscule. That's why services like cloudflare can afford to give so many basic hits for free but more costly on more expensive rules--the rules are more expensive than delivering content. – Grumpy Sep 01 '17 at 18:35
  • I figured, but I am new to Load Balancers so I just wanted to get an idea. Thanks again for your help. – whoacowboy Sep 01 '17 at 18:48