Okay.
Hello loggers and welcome to this lecture and this lecture we're going to look at some advance load
balance theory and really going into the exams you're going to need to understand the difference between
cross zone load balancing sticky sessions as well as what path patterns are.
So why don't we start with sticky sessions and we'll look at both classic load balances and application
load balances so classic load balances routes each request independently to the registered easy to instance
with the smallest load and what's sticky sessions allows you to do is to bind a user's session to a
specific easy to instance you're going to stick a user's session to a particular easy to instance and
this ensures that all requests from the user during the session are sent to the same instance.
So why might you actually do this or what happens if your application is saving something locally on
your easy to instance.
Perhaps it's writing a file or something and you always would then want that user to use the same easy
to instance and you can also enable sticky sessions for application load balances as well.
But this time the traffic will be sent at the target group level rather than at the individual easy
to instance.
So that's all that sticky sessions are.
You might wonder where it comes up in an exam.
Well this is a pretty common exam scenario.
So you've got your user trying to visit your website is behind let's say a classic load balancer and
essentially what's happening is it's just sending all of that traffic to one easy to instance and maybe
you're an admin and you log in and you notice that no traffic is going to a second easy to instance.
How can you fix that.
Well you disabled sticky sessions so it could be testing whether or not you're going to enable sticky
sessions or disable sticky sessions.
Just look at the individual scenario but essentially if you've got an easy to instance that's not receiving
any traffic.
You want to go in and disable sticky sessions.
If you've got an easy to instance or an application where you're writing to an easy two instances like
local disk then of course you would want to enable sticky sessions because you would need to have access
to that file so that's all it's sticky sessions are.
Let's go on to cross zone load balancing and we'll start with a scenario where we don't have cross zone
load balancing enabled so got our user.
We're using Route 53 for our DNS and Route 53 is splitting our traffic 50/50 to two different Availability
Zones us e one A and W E one B and in each of those Availability Zones we've got a load balancer and
we can say it's a classic load balancer just for this example.
So what happens then.
Well let's say in us e 1 A We have 4 easy two instances and in us e one B we only have one easy two
instances now because we don't have crosses zone load balancing enabled our load balancers cannot send
traffic from one availability zone to another.
So essentially what will happen is used E 1 A will take its 50 per cent of the traffic and send it to
its for easy two instances and w e one B will take its 50 percent of the traffic and send it to its
one easy to instance.
So this means that you're for easy two instances are going to get 12 and a half per cent of the traffic
each and us e 1 a annual poor easy to instance in us e one B is own is going to get 50 percent of the
traffic and so the reason for this is that your elastic load balances cannot send traffic to another
availability zone so that is what happens when we've got no cross a zone load balancing enabled with
cross zone load balancing however we've got our user they're sending traffic to route 53 we've got a
weighted reading of 50/50 across to different availability zones we've got our load balances in here
and we've got our four easy two instances in one availability zone and one easy to instance in another
availability zone and our load balancer and US S1 a can send all of or can send 50 percent of the traffic
across those four instances and our load balancer in USB Aswan be sends its traffic to the instance
in its own availability zone but then they can also do it across zones and it gets very very messy but
essentially what this means is that each of your easy two instances is going to get to 20 percent of
the traffic because Euro application or elastic load balances are sending your traffic across five instances
evenly so common exam scenario will be you've got a user they're using route 53 100 percent at the traffic
being sent to a load balancer in US Easter 1.
And that load balancer is sending that traffic on to its for instances which are in the same availability
zone as it and then you log into USB e one B and you notice that this easy to instance is not getting
any traffic at all what should you do well you should enable cross a zone load balancing and that way
it will get traffic because it's in another availability zone and you haven't enabled cross zone load
balancing so that's all across zone load balancing is and those are the common Mario questions that
you'll see.
And then finally we've got path patterns so what a path patterns where you can create a listener with
rules to forward request based on the U.R.L. path.
And this is known as pass base rooting.
So if you are running micros services you can reroute traffic to multiple backend services using path
based rooting for example you could route a general request to one target group and request to render
images to another target group.
So again let's have a look at a common exam scenario.
We've got our user sending traffic to route 53 100 percent of this traffic is being sent to a load balancer
in USB e 1A.
This would be a application load balancer because it's reading the U.R.L. path and essentially it's
sending its traffic over to two different availability zones.
So let's say in USD 1 a we've just got all the traffic that goes to WWE WD up my U.R.L. dot com.
But what you want to do is you want to configure it so that traffic that is going to my U.R.L. dot com
forward slash images is going to go over to your media easy to instances which is in a separate availability
zone.
So in order to do this all you'd need to do is go and enable path patterns that will then send just
the normal path.
My U.R.L. dot com to your for easy two instances which may just be web servers but all the image traffic
will go to a separate availability zone.
Whenever you're requesting that WW WD up my your arrow dot com forward slash images.
So that's all path patterns.
So that is it for this lecture everyone we've just explored the three different things we've explored
sticky sessions cross zone load balancing and then path patterns sticky sessions enables your users
to stick to the same easy to instance can be useful if you're storing information locally to that instance
cross zone load balancing enables you to load balance across multiple Availability Zones and then path
patterns allows you to direct traffic to different easy to instances based on the U.R.L. contained in
the request.
So that is it for this lecture if you have any questions please let me know if not feel free to move
on to the next lecture.
Thank you.