Learning Library

← Back to Library

Network Load Balancer Explained

Full Transcript

# Network Load Balancer Explained **Source:** [https://www.youtube.com/watch?v=sCR3SAVdyCc](https://www.youtube.com/watch?v=sCR3SAVdyCc) **Duration:** 00:08:23 ## Sections - [00:00:00](https://www.youtube.com/watch?v=sCR3SAVdyCc&t=0s) **Explaining Network Load Balancing** - Bradley Nap illustrates how a surge of concurrent website visitors can overwhelm a single application server and introduces a network load balancer as the solution to distribute traffic across multiple servers for scalable performance. - [00:03:05](https://www.youtube.com/watch?v=sCR3SAVdyCc&t=185s) **Load Balancer Drives Autoscaling Decisions** - The excerpt explains how a load balancer monitors app‑server utilization, triggers the autoscaling service to add capacity, routes traffic to multiple servers, avoids database split‑brain issues, and outlines three common load‑balancing scenarios in cloud‑native architectures. - [00:06:53](https://www.youtube.com/watch?v=sCR3SAVdyCc&t=413s) **Random vs Round Robin Load Balancing** - The speaker outlines intermediate load‑balancing options—specifically a random selection algorithm among nine choices—as a simpler alternative to full smart‑load‑balancer configurations while offering more control than basic round robin. ## Full Transcript
0:00Hi there and thanks so much for stopping 0:02by today. My name is Bradley Nap with 0:03IBM cloud and the question that I wanted 0:06to go over with you guys today is what 0:08is a network load balancer. And so I 0:11want you to imagine a scenario, right? 0:14You have decided that you are going to 0:16run a website and this website is going 0:18to be immensely popular. You need to 0:20build it to scale to serve millions of 0:23users all of whom are accessing it at 0:25the same time. So imagine that single 0:28user and what is his experience going to 0:31be? Right? So you've got your guy, he's 0:34out here and he's got a laptop, right? 0:38And so on his laptop, he wants to open 0:40your awesome new website. So he's going 0:43to send that traffic out into the 0:45internet, which we're going to put a 0:48little cloud in there for the internet. 0:50And then as it transmits through the 0:52internet to the actual servers where the 0:54data is hosted, it's going to get down 0:56here and it's going to get to an 0:59application server. And that application 1:01server is going to be what actually 1:02serves all of the data back via the 1:05internet to his laptop so that he can 1:08view what's going on on your on your 1:10website. Now, that's fine if you've just 1:13got one person who accesses your website 1:15at a time. What if you have 10 people at 1:18once? Well, that app server is probably 1:20going to be fine to do that. What if you 1:21have 10,000 people who are accessing it 1:24at once? And so that's when you get into 1:26this interesting scenario where you can 1:30saturate out this application server. 1:32And so if you think about an 1:34infrastructure level definition of an 1:35app server, you can scale them up to a 1:37certain size, but you've got limits in 1:40how big these application servers can 1:42be. So what do you do? All right. Well, 1:44you need to scale them out, right? 1:46Instead of having one app server, you 1:48might have three or you might have four 1:51or you might have five or you might have 1:5210 or you might have 10,000. You are 1:55going to horizontally scale those 1:57application servers so that you have 1:59enough to satisfy your customer load. 2:03But how do you know how much scaling you 2:05need? And more importantly, how does 2:07this guy with his laptop get to the 2:10application server that he needs in 2:12order to be successful? And the answer 2:14to that is in between 2:17your customer and all of your app 2:19servers, you are going to put a load 2:22balancer. What is a load balancer? It's 2:24a hardware device or it could be a 2:26softwaredefined device. And that load 2:28balancer is going to intercept all of 2:31the traffic that's coming in from the 2:33internet. And it's going to decide what 2:35goes to this server, what goes to this 2:37server, what goes to this server, and so 2:40on and so forth. It's also going to 2:42provide and collect information. So your 2:45application servers down here, they can 2:46be talking to this load balancer. They 2:48can be saying, "Hey, I'm only being used 2:5120% of the time. Maybe you don't need me 2:53right now." And that load balancer can 2:55then dynamically scale or autoscale and 2:59turn that application server off if you 3:01don't need it. Helps drive down costs. 3:03Likewise, if all of your app servers are 3:05checking in and they're saying, "Hey, 3:06I'm super busy. I'm running at 85 90% 3:09utilization. It's time to bring in 3:11help." Then that load balancer can hit 3:14that autoscale service again and it can 3:15say, "Hey, look, I need another one. I 3:18need another app server to try and 3:19decrease my load." And so when folks 3:22talk about cloudnative architectures, 3:24this is a key component. The load 3:26balancer is a key component because that 3:28load balancer is going to assign out 3:30that traffic to all of the different 3:32application servers. And then the app 3:34servers, they're all going to go down 3:35here, right? They're going to talk to a 3:36common database tier because you don't 3:38want to get into a goofy split brain 3:40scenario with your database. 3:42but they're going to get the data that 3:45they need and they're going to serve 3:46that back up to the end customer 3:48directly. So that's how you split up the 3:50data. That's how you serve it up. But so 3:53now that we're in load balancers, we 3:55said it's going to decide which 3:57application server gets the traffic, 3:59right? How does it decide what to do? 4:02And so let's get our three most common 4:04scenarios, right? So, we're going to go 4:06over here and we're going to have 4:08scenario one, scenario two, 4:13and then scenario three. 4:17So, scenario one, our load balancer 4:20right here, right? It's got all its app 4:23servers. 4:24And we're going to call this one a 4:26relatively dumb load balancer, right? We 4:29don't need a lot of complexity in it. 4:31It's serving a fairly basic purpose. And 4:33so it's going to use an algorithm called 4:36roundroin in order to sign assign the 4:39traffic. And so what does roundroin 4:41means? It means that for the first user 4:44that connects, it's going to send that 4:46person to app server one. For the second 4:48person who connects, it's going to send 4:50them to app server two. The third person 4:52who connects is going to go to app 4:54server 3. And then when a fourth one 4:56comes in, it's just going to start back 4:57over again. Roundrobin literally means 5:00just going sequentially through it. Now, 5:02round robin is not a perfect scenario. 5:04If you have user sessions that last a 5:07long time, some people log in and run 5:09for 5 minutes, some people log in and 5:11run for 2 hours, your app servers can 5:14get out of balance with one another when 5:16you're using that roundroin scenario. 5:19And so then you need to think about 5:21things like smart load balancing. Smart 5:24load balancing is going to be our second 5:25piece here, right? And this is an 5:27application server load load balancer. 5:31So again, just like before, we've got 5:33our load balancer here and we've got our 5:35app servers. 5:37But this scenario, this smart load 5:40balancing scenario rather than the load 5:43balancer just acting as king and 5:46directing what all happens, the load 5:49balancer works in cooperation with the 5:51application server. So the app servers 5:52are constantly transmitting data back 5:55and forth to that load balancer, letting 5:57them know how busy it is. And that load 6:02balancer is then going to make the 6:03decisions to send the incoming 6:05connection. So your guy over here, if he 6:08comes in and he starts a user session, 6:10that load balancer is going to say, 6:11"Look, server 3 has the least load on it 6:13right now. I'm going to assign him over 6:14here." And it's constantly monitoring 6:17that. Now, obviously, you're going to 6:18look at that and you're going to say, 6:19"Well, why wouldn't you always use this 6:21kind of setup?" Well, it is more complex 6:24to get set up initially, right? It takes 6:26more configuration. Also, the load 6:28balancer software or the hardware device 6:30that you use to set this kind of a 6:32scenario up, it is more expensive. And 6:34so, while technologically it's probably 6:37always the best choice, for your 6:39specific scenario, it might not be. And 6:42then the third the third scenario that 6:44we've got down here, right? So, we've 6:46got our load balancer and all of our app 6:48servers. 6:50This is a scenario where you want a 6:53little bit more control than you do in 6:56just a straight round robin, but you 6:57don't want to go all the way through the 6:59setup and config and everything like 7:00that that you need with a with a smart 7:02load balancing scenario. And so there 7:05are actually like nine different 7:07algorithms that you can pick from that 7:09split the difference between these two. 7:11Uh the one that I'm going to use right 7:13now as an example is a a random select, 7:16right? So the load balancer rather than 7:18sequentially working through application 7:20server 1 2 3 1 2 3 1 2 3 over and over 7:24again, it's just going to run a 7:26randomizing function and it's going to 7:28decide that maybe the first two go to 7:30one and the third connection goes to two 7:32and connections four through six are 7:34going to go to three and so on and so 7:36forth. Again, it's just it's different 7:38kinds of algorithms to decide where you 7:41need to go, where you need to send that 7:43traffic. And if you want to get into 7:46specifics, there's tons of information 7:48out there. Be happy to to share that 7:50with you. Let us know in the comments. 7:52If you want to know specific advice, uh 7:54please feel free to reach out to to 7:56anybody in the channel or anybody at 7:58IBM. We'll be glad to help you design 8:00and architect a load balancing solution 8:02that is going to work to help you solve 8:05the needs of your customers. Thank you 8:07so much for stopping by the channel 8:09today. If you have any questions or 8:11comments, please feel free to share them 8:12with us below. If you enjoyed this video 8:15and you would like to see more like it 8:16in the future, please do like the video 8:18and subscribe to us so that we'll know 8:20to keep creating for