I'm really excited because I've got myself a web server serving something cool whatever it is you know
the new Mike web app or whatever it might be. So I'm real happy with my web server.
In fact I'm just going to put w w w up here to remind us it's a web server.
I'm so happy with my web server because more and more people are accessing my web server and after a
while I need some help because I've got so many people accessing my web server that it's slowing this
guy down.
So what I need to do is come up with a way to have lots and lots of web servers but if I have lots and
lots of web servers they have to be giving out the same thing and they have to be doing it at the same
time and there could be a lot of challenges.
So what we're going to talk about in this episode is load balancing. Load balancing
simply means to be able to have lots of servers giving out the same thing and to do it in a nice even
way.
We're going to be using web servers here but it's not limited to web servers, there's all kinds of stuff that
uses load balancing.
But let's stick with the web because everybody is comfortable with that.
So the first thing is going to be happening here is I'm going to start adding more servers.
Now as I add more servers,
these servers are passing out the exact same thing the exact same web pages now.
Let's assume for a moment that these web servers are physically in the same room.
OK now what I want to do is I want to have the ability to not overload any one of these. To space out
the requests across the three servers.
Now there's a lot of different ways to do this.
Load balancing.
The first way I want to talk about is kind of an old fashioned way but it's on the exam so it's worth mentioning.
And that's using a DNS server.
So I've got a DNS server someplace else.
That's actually the authoritative server for this particular domain.
And what we're going to do is we're going to put stuff inside the DNS server to kind of fool people.
So I'm going to call this www1, www2, and www3. And what I can create is a lookup zone that does
something very very interesting called round robin. With a round robin what I'll do is
I'm going to have all three of these guys in a lookup zone and I'm going to have a kind of a special
DNS server. And what this DNS server does is when a request comes in
first he gives it to number one, the next request comes in then he gives it to number two, next request comes
in
he gives it to number three.
This is by about the first generation of load balancing called round robin and it worked OK but there
were some problems with it. For example,
remember that if I as a client access this website I'm going to cache the IP address.
So what will happen is next time I try to get to this particular site I'm not going to use this DNS
server.
I've already got say this guy's IP address. So round robin load balancing was kind of the first generation
had a few problems but they worked on it.
The other big issue that comes into play with load balancing is what if all these computers are on different
continents?
Now this is a big thing that a lot of us do because it's a lot faster to get to a physically close
server than one that's far away.
So the other thing we'll do is another DNS feature called delegation.
Here's my eraser.
With delegation what we'll do is we'll set up another zone,
but it's going to have sub zones for each of these and most importantly it's going to have a reverse
lookup zone with different PTR records for each of these.
Now this does something really interesting to the world of DNS. What will start taking place is if I have some
client over here when he comes in and tries to query to this guy, he might,
he's going to try to get to the zone that's closest to him and what will happen is you'll have this
DNS server and another DNS server someplace else and they'll actually compete for resolving to that particular
DNS and what will happen is based on the amount of time to get on the pointer value you really end up
going with the closest one.
And this is a very common way to handle load balancing just using DNS.
The problem with DNS load balancing is that you're counting on a third tool, DNS, to do what you need
to do.
So a lot of times what will happen is that we will dump DNS completely and instead do what's known as
Server Side Load Balancing. Server side load balancing usually involves some kind of very very smart
device running very very smart software that is physically at the location of your servers.
There are some real benefits to having your web servers or whatever servers you might have at the same
physical location.
One big benefit is we can take advantage of something called clustering. With clustering what we'll do
is we will have separate machines, or at least separate virtual machines,
but what they'll do is they will actually talk to each other on the back end. They will have their own
little private network and what this little back end private network does, separate network cards and
everything, is
make sure that all three of these systems are absolutely identical at all times.
For example if you have a database involved or something like that these guys can all update each other.
Even more interesting when you're using clustering you can usually offload all of your data to a separate
device and all three of these will simply just read off that.
So if you add a new game or if you add a new customer record you're not trying to add it to three different
machines you're just adding it to one database. So clustering is a huge benefit.
So when we're doing the server side like this we get some other really cool features.
First of all this smart box this load balancer can actually talk to these guys individually and by talking
to them individually we can do some cool things.
Cool thing number one he can actually query and go:
Are you busy right now?
He can see who's the least busy and then send that data over to that particular machine.
If the machine goes down he can automatically reroute without any problems whatsoever.
This guy can even act as a proxy server. For example,
this box right here can handle all the SSL if you're on an HTTPS Web site he can be a certificate server and
handle all this and take that load off of these individual machines.
So load balancing is an incredibly powerful tool.
Now right here you'll notice I'm showing this as a box.
What's fascinating in today's world is that most people if you have a website anymore it's probably
going to be on the cloud.
So what will happen is you'll have three or four instances of your particular web app, your web page,
or whatever it might be and even the load balancer these days is virtualized.
So all of this is really nothing more than software and where it's running we don't care because the
beautiful part about it is that load balancing works.
Now there are some features about load balancing you need be careful about.
Let's just say for example I'm a client and I get assigned to this machine.
Well if I'm assigned to this machine I might have some certain things going on at any given moment that
I want to get back to that machine.
And even though the load says oh he's the slow one now.
A good load balancer will sit there go out you have a session with this particular client as long as
your session lasts
I'm not going to move you to another machine.
I'll keep you on that machine until your particular session is done.
So this is just a real basic idea of load balancing.
It's a fascinating world and you get to add all kinds of interesting boxes to your network to take care
of these things.
But do keep in mind that there's really two big chunks to load balancing at least for the exam.
There's going to be DNS solutions and then server side solutions.
Make sure you're comfortable with those two.