New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
How does a load balancer work ?
Suppose i have a load balancer in front of 2 US servers.When a user visit my site example.com, does every request the user browser go through the load balancer or its only the first request that goes to a load balancer and once a server was allocated to the user , the user connects directly to the server?
If every requests goes through the load balancer won't that double the bandwidth and imply that the load balancer be as powerful as the server?
Comments
Depends on what you need and the type of load balancer.
If you do on-server load balancing, generally, the app itself will be much more CPU intensive than the actual public HTTP endpoint so technically two servers could load balance each other. This is the case even with static files where the SSL termination takes a much higher processing time than anything else. Of course there’s a slight overhead, but it really depends on what you do.
If you use DNS load balancing for example then there is very little overhead, but there is less control.
You can also announce the same IP from multiple servers, but then it gets even a bit more tricky to control the traffic.
Overall I’d say the overhead to be minimal in most cases no matter what you do, unless you run on really bad hardware. Nginx or haproxy can handle tens of thousands of requests per second or even hundreds of thousands on powerful hardware for example.
In regards to doubling the bandwidth, you would usually run the load balancer on internal network to avoid double bandwidth costs and improved security.
This seems to be an an example of DNS load balancing if i am not mistaken
https://www.ovh.com/sg/solutions/ip-load-balancing/
This one below is the on server load balancing
https://www.ovh.com/world/solutions/load-balancer/
Am I correct in my assumptions ?
Thanks @BunnySpeed for the explaination and @uptime for the laugh
There are several ways to do it, normally you have a proxy(the load balancer) that pings X amount of instances with that runs your application and the one responding the fastest gets the request, its a way of distributing high load. relayd(openbsd) and nginx is pretty good as load balancers play with that.
https://en.wikipedia.org/wiki/Round-robin_DNS
https://www.bsd.plumbing/
http://man.openbsd.org/relayd
The first one is what seems to be IP based load balancing, not sure how exactly it's set up but it doesn't seem like DNS.
The second one you are correct. It's a software load balancer, HAproxy if I'm not mistaken, but I would kind of suggest against this one. We used it for our dashboard for a while in the past but the stability was sometimes quite bad.
Thanks again @BunnySpeed
Do you have any info on how much the IP load balancing cost (https://www.ovh.com/sg/solutions/ip-load-balancing/ ) and if its available on Advance-3 dedis
https://www.ovh.com/world/dedicated-servers/advance/adv-3/
I know i should check it myself but for some weird reason my country of residence isn't available on ovh.com registration form but it is on SYS.
There is also Fastly. Not cheap, though.