In this lesson, we introduce load balancer service provided by the AWS. Compare the features provided by their classic load balancer and their new application load balancer, and present their pricing scheme. By the end of the lesson, you should be able to decide which load balancing options to choose and to calculate the price for your typical load balancing cluster configuration. Here we show the features supported by the two options AWS load balancers provide. AWS recently rolled out the new application load balancer dedicated to serve HTTP and HTTPS. So secure HTTP request, with better support for HTTP version 2, Oracle version 2 and WebSockets kind of support. They provide host-based routing referred as the load balancer that can route requests based on the host metafield in the HTTP protocol messages. And they also provide path-based routing, which refer to the routing based on the URI, right after the domain name is the paths of URI. And for example, the URI with /marketing will be routed to marketing target group kind of instance. Because they may be configured with special software and for processing or will connect to a special database. For /engineering kind of URI request, will be sent to engineering server for maybe additional computing or additional software. The other possibility would be /API, will be sent to compute optimized kind of imaging, with more memory, with more processor. /mobile will be sent into memory optimized kind of instance, on which maybe more memory, faster memory or maybe other type of memory. This is related to a subset of content switch feature we are talking about, and allow to route to multiple pool, even routed to multiple pool within the same instance. So that you don't have to duplicate multiple instance, each serves one pool, one service. You can actually have one instance, and serve multiple pool, pool 80, pool 8,000, if the traffic is light, and make it easier to peg certain service to an instance. Connection draining, which you show here, is one of the features. It refers to allow the request, remaining requests in a target instance, typically we call those outstanding kind of request, to complete before you shut it down, before you shut it down. And it is also call in the history, traditionally we call that gracefully shut down. So it is integrated as autoscaling AWS feature. So autoscaling allow you to add more instance to the load balancer. And why are you doing that if we have scaled back kind of situation, traffic get light, some of the instance we were able to release then, and so saving the cost for example. And in that case this connecting special feature will allow the request to complete before we terminate the instance. If you need the load balancer sustain other services, such as SSH, email, FTP, this new application load balancer doesn't take care of that, right? So you only take care of web, HTTP, HTTPS. For the traditional load balancing request to SSH computing traffic, email traffic, you should use the classic, the old classic load balancer. Here we show the architecture of AWS new application load balancer. It allow the designer to create multiple listener, I show it in the middle tier here. And which will interpret the rule, load balancing kind of rule for routing requests to the third tier here, which indicate their instance. Maybe they actually call it targets, and target is actually maybe easier to instance or database. In target group, they group this instance or target into a group, and here it show the two listener with three rules. And from left to right, the rule will be execute in sequential kind of order, in some priority. Their provided GUI allow user to create target groups. And then whenever the target instance you already configure and set it up can join to different group, and one target can join market group. There's a health check mechanism, as you see in the lower part here, every target group will have a health check module. The mechanism is to help check the health, whether the instant or target is still active, and the response sent to them is being replied, okay? So each of the target within the group, they can report whether that's active or not. If all the target wasn't good, they all fail, they will report that target group fail. It the whole web of its own with it hosting several target groups, they all fail, they will also make an indication. The load balancer will only distribute request to the healthy target, right? And also it will reply to target group that still at least has one healthy target, right? We have three target groups here. And you can see in the second one, in the middle target, which is the third one, indicates it was joined to different group. They can receive request based on different groups. Why don't we distribute request to one group, maybe so they can be receiving requests from different condition. Application load balancer pricing are slightly different in each region. And here we show you on the top the formula they use for US-WEST-2, which is Ohio. There is a base price of $0.0225 per application load balancing hour. So one load balancer, one hour, they charge you $0.0225, okay? You partial out the run data. And then they will add with $0.08 per LCU hours. And we are going to define what is LCU here, okay? And here we have a table show how to calculate this application load balancing cost, where the LCU is calculated based on a set of four factors. Any of the factors there, number divided by their base unit, will be calculated. And then, the maximum, the biggest one among those four will be picked to apply to a formula for the LCU cost. So let's look at those factor. First is new connection number per second, basically we're talking about the new request coming in over, let's say, a minute's period of time, how many there are. And then we divide by 60, so that's a per second number. The more connection request come in that put a demand on the load balancer, so the more they need to come up with better resources to handle that. So they charge you more based on that. The second factor to charge you more is how many active connection already exist, they're already serving, not the new one, existing kind of connections. So they also have number like 3,000 divided by the base unit. And the third one is how busy is those session actually generate a traffic. Bandwidth is a rare resources anyway, therefore they will charge you more. And the fourth one is the rule evaluation per second. If there are more rules need to be check in a particular load balancer, then that put a demand on the computing power and require memory on the rule evaluation, on the listener module we just talked about. And in this particular formula, they allow you to deduct 10 rules. 10 rules is free, above that they charging unique device some sort of number. And then they will charge you more as you evaluate more, incur more computation. Here I try to simplify these by providing you with a column, so that you can plug in any scenario for you to calculate these costs, LCU costs and the AW load balancing cost. And we will make it available on the Coursera website as a resource for you to download and make it easier. So in the first column is the name of the factor that contribute to the cost. The second column shows the base unit for each of the four factors. For example, the second one, the active connection number per second, they stat it to be 3,000, all right. So that's a ratio. The third column shows the data from specific applications of your load balance provided support, right? It predicts or estimates what kind of demand your load balancer is going to serve and collect all this new connection, active connection's bandwidth, that kind of information, so that we can fill in that third column. But make sure you compute to the equivalent unit, like second or the minutes, you need to be precise there. And once you finish filling this, the formula basically will compute. Take your number, divide by the second column, and then compute the number. And here we see 4 6 4, and then some fraction number, so it turned out 6 is the biggest one, so in the second row, which is active connection. And since they pick maximum number as a guide for you to compute the cost to charge you, okay. And here we show the active connection has larger use among the four factors, so it was picked for calculating the cost. And the maximum number is 6, so the LCU cost is 6 times $0.08 per LCU hour, okay. So 6 times $0.008, is 0.048, which is $0.048 an hour. There's a base cost we just talked about, the base cost is no matter what kind of traffic, they charge you $0.0225, right? So you add 0.48 we just compute on LCU, with this number. The total cost, if we multiply by the number of seconds within a month, it turns out to be 50.76. And so it's not a natural kind of cost, you need to charge that, and therefore, the number of rule matter, the number of traffic matter. Let's say if the active connections is 6,002, the new connection is 10, bandwidth is 1 megabit per second, rule evaluate is 500 rules per second, then, you can verify yourself, the LCU value will be 2.