Help - Search - Members - Calendar
Full Version: Dummies Guide to Load Balancing
The Planet Forums > System Administration > Load Balancing
cellularnews
I could do with one !

I am about to set up a new site that is expected to be high load - and am considering my first load balanced server package.

However, I honestly have no idea how they work !

Can I treat them as just one box - or do all my programs have to duplicate the content on both boxes and roughly how would a program on one box understand to send an update to the other box ?

Just mulling the idea of a load balanced server as I will (hopefully) need to consider it in the future anyway.
Gary Simat
Load balanced server cluster you will get IPs that are virtual IP's. These IP's point at the load balancer. You will configure domain.com to goto one of these virtual ip's which will distribute the traffic among the 2 servers in the load balanced cluster. thats pretty much all there is to it... just make sure the content is on both servers for each service thats running...
2005
I also don't understand how it works.
I can make the same content on 2 servers if I use static html pages...
If it's a discussion board, the content changes every second...
alex.davies
2005 - there are several different ways of doing it. A common way is to have a third database server, but if you have a lot of money and need redundency you can set up a MySQL cluster (a lot of money because you need a lot of RAM). You can replicate the files very easilly using rsync or unison - see the links in my sig.

cellularnews - I have set up many loadbalanced setups; please feel free to pm/email me with any specific questions that you may have about loadbalancers. I am afraid that I am not aware of any one particular dummies guide.

Alex
Brad-ev1
Here is the link to our load-balancing FAQ. It does a good job of explaining how requests are directed by the load balancer. http://ev1servers.net/english/services/clu...ers_details.asp

As alex.davies pointed out, using a third MYSQL server that both load-balanced servers access is a common configuration for message boards and other types of sites(you can even connect to it via PNET so that there are no bandwidth charges.) Be sure to search these forums for a additonal examples of how customers have synchronized dynamic content.
alex.davies
Just to add that running MySQL over PNET is a bad idea unless you have hardly any traffic. 10mb/sec is not enough for most high-load sites. Of course, if you get a private rack you can have your own web cluster, database cluster and gigabit switch which is the ideal configuration for many users.
AaronC
And if you are interested in any of that, please contact us at custom.orders@ev1servers.net.
2005
Thank you for your answers.

Brad-ev1, I looked at: http://ev1servers.net/english/services/clu...ers_details.asp
and still don't understand how it works with non-static html sites.

alex.davies, I have 2 servers:
first one for php scripts and images
second for mysql database.

In January I started a dating website (very php and mysql intensive) with profiles, private messaging, interest clubs, chat, forum, personal ads etc. It became popular very soon and the number of visitors grows every day. In peak times I have ~1000 visitors online and server load sometimes grows to 9-10 and to 5-6 for database server. So, I have to do something. I see solution for mysql - if load will be very high I can set up separate servers even for each large table.

The problem is first server which stores images and php scripts. Sure, I can upload the same php scripts to 2 servers, it's not a problem. But visitors upload pictures to their profiles and they can delete pictures. So, for example, I am redirected to physical server A and upload pictures to my profile. Pictures are being saved to server's A hard disk. Server A connects to database server where writes information about uploaded pictures. Next time when I log in I am redirected to physical server B. When I open my album, server B connects to database server and collects information about my pictures. Server B can not find any pictures on it's hard disk and displays just broken images (images exist, but they are saved on A server's hard disk).
That's the problem. Sure, I can set up a different server for images, but if I do so, visitors will be forced to log in one more time if they want to upload/delete their pictures.

Maybe I am stupid, but I can not understand how 2 servers can show the same images if images are being uploaded and deleted non-stop.

Sorry for my English.
alex.davies
There are several ways of sorting out the images problem; I have used both on EV1 LB pairs before. The first is to use unison to sync between the servers every few minutes (works very nicely), the second is to host all the images on one server and connect to it via NFS . You can either do this on one of the two servers in the pair, or the third database server if you have one.

Alex
shashank
2 servers for webservers and 1 for mysql is a good load balancing model.
eth00
What are you using for the images webserver? Run something like thttpd which is going to scale a lot better and be able to run a lot more efficiently then say apache. If you do that you should be able to milk a lot more performance out of the server. After you hit a bottleneck with that server I would suggest doing a cluster situation where it the images are synced constantly. I would not suggest doing a NFS server on one and have the other connect to it for all of the images, this is going to use way too much IO on the disks.

What may be possible, coming from a non-coder, is have the images uploaded to 2 seperate places when they are uploaded by the user. The first one is the location on the server, the second place is a NFS mounted drive that goes to the 2nd server. That way the images are uploaded in real time to both servers icon_biggrin.gif
Brad-ev1
QUOTE (alex.davies)
Just to add that running MySQL over PNET is a bad idea unless you have hardly any traffic. 10mb/sec is not enough for most high-load sites. Of course, if you get a private rack you can have your own web cluster, database cluster and gigabit switch which is the ideal configuration for many users.


Hmm this comment surprises me, I see PNet as an ideal topology for having several front-end http/ftp/ssl servers with a single DB server behind them. The only point at which a 10Mb connection is less effective than a 100Mb connection is when the link becomes saturated (ie. using more than 10mbs).

Given our standard per-server bandwidth allowances, I would find it highly unusual for 2-3 front end http/ftp/ssl servers to pull more than 10Mbs of SQL traffic without delivering an incredible amount of traffic through the public connection.

This is a guess, but I would expect front-end servers to push at an absolute minimum 5mb:1mb of traffic with regards to the DB server. If that is true, that would mean two front end-servers would have to push 25Mbs each to fully utilize a 10Mb connection to the DB server, and the monthly public transfer for that setup would be upwards of 15 TB.
alex.davies
QUOTE (Brad-ev1)
Given our standard per-server bandwidth allowances, I would find it highly unusual for 2-3 front end http/ftp/ssl servers to pull more than 10Mbs of SQL traffic without delivering an incredible amount of traffic through the public connection.
I would expect Dual Xeon 3.2 GHz with 4GB of RAM to peak at pushing a lot more than 25mbit!

Clearly, if could not average even close to this for the reasons you mentioned.

I remember in January when I ran a script that acted as a loadbalancer for the distribution of Tsunami Videos. The script just opened up a database connection, selected a random mirror and then updated the daily count of that mirror by one, then issued a header ("Location:") to the client.

I reckon there was probably three of four times as much DB traffic as there was incomming traffic - with the SELECT query and then the UPDATE query.

This server was shifting well over 50mbit of PHP traffic. If I had MySQL on another server over a PNET there is no chance that I would have been able to handle that. (the mysql server was on localhost). I forget the statistics that the MySQL server was giving me but it was a crazy amount of traffic and would have required a gigabit switch if I had had a seperate DB server.

Clearly it gets worse if you have two or three servers in front of a DB server on the PNET because they would all be limited by the 10mbit in of the MySQL server.

Of course this is an extreme example but I always recommend to people who have high-load sites that are prone to occasional peaks that they do not have a 10mbit limit between their DB and web servers if possible.

With best wishes,

Alex
scotsman
QUOTE (Brad-ev1)
Here is the link to our load-balancing FAQ.  It does a good job of explaining how requests are directed by the load balancer.  http://ev1servers.net/english/services/clu...ers_details.asp


I'm getting a 404 on that link. Anywhere else I can find the load-balancing FAQ?
AaronC
The new link for the new website is http://www.ev1servers.net/hosting/load_bal...ced_details.asp
scotsman
QUOTE (WebSales_Aaron)


That was quick Aaron, thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.