Lecture 182: Request Routing Algorithm
- 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
- 视频时长:02:38
- 来源:Udemy Lecture 28555983
- Slide 数量:3
- 画面切换:01:17、01:44
扫描说明
逐条读取了 Udemy 页面中的 68 条英文 Transcript cue,并按时间轴扫描全长约 02:38 的视频。依据 Least Outstanding Requests、Round Robin 与 NLB Flow Hash 三种 Request Routing Algorithm 划分为 3 个小节。截图均在 Transcript 侧栏关闭、播放器控件隐藏后复核,统一为 1364×770。
Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。
1. Least Outstanding Requests
时间范围:00:00–01:17
总结 / Summary
中文
Least Outstanding Requests 会选择 Pending 或 Unfinished Request 数量最少的 Instance。某个请求很快完成后,该 Instance 的 Outstanding Count 降低,下一次请求可能再次选中它;算法因此按实时繁忙程度分流。课程指出它用于 ALB,以及 CLB 的 HTTP/HTTPS Mode。
English
Least Outstanding Requests selects the instance with the fewest pending or unfinished requests. When a request finishes quickly, that instance's outstanding count drops and it may receive the next request again, so routing follows real-time load. The course states that this applies to ALB and CLB in HTTP/HTTPS mode.
Transcript
00:00 So let's talk about how requests
00:02 are being routed from the ALB or the load balancers
00:05 in general, to your backend EC2 instances.
00:08 So, we have different routing algorithms for your requests,
00:11 and one of them is the Least Outstanding Requests,
00:13 in which the next instance to be picked,
00:15 is going to be the one that has the lowest number
00:17 of pending or unfinished request.
00:20 So, if you take an example of a CLB,
00:21 and three EC2 instances, maybe the first user
00:25 is going to be do... going on onto the first EC2 instance,
00:27 the second, to the second EC2 instance, and a third,
00:29 while it has to go to the third EC2 instance,
00:31 because, guess what?
00:33 The first two requests are still pending and unfinished.
00:35 And, therefore the third EC2 instance
00:36 is the one that has the lowest number
00:38 of pending unfinished requests,
00:39 and so that's how this algorithm works.
00:41 And then, well depends on how these requests may go.
00:43 Okay, but for example, let's assume
00:45 that the orange request did finish very quickly.
00:48 In that case, well the next request will again,
00:50 go to EC2 instance number three,
00:52 because it still has the lowest number of unfinished or
00:55 pending requests and so on.
00:57 Okay. So it will...
00:58 the idea here is that you really want to balance,
01:01 based on how busy an EC2 instance is going to be.
01:04 And we assume that an EC2 instance is not busy,
01:06 if it has a low number of pending or unfinished requests.
01:11 Okay. Now this mode works for
01:12 the ALB and the CLB mode HTTP or HTTPS.
2. Round Robin
时间范围:01:17–01:44
总结 / Summary
中文
Round Robin 不关注当前请求处理时长,而是按固定顺序循环选择 Target,例如 1、2、3、1、2、3。它让请求在 Target Group 或 Registered Instance 之间平均轮转;课程指出它适用于 ALB 与 CLB TCP Mode。
English
Round robin ignores current request duration and cycles through targets in a fixed sequence such as 1, 2, 3, 1, 2, 3. It distributes requests evenly across target-group members or registered instances. The course states that it applies to ALB and CLB in TCP mode.
Transcript
01:17 Okay. The second one is very easy to reason about,
01:20 it is round-robin.
01:21 This is to equally choose the targets
01:23 from the target group one after the other.
01:25 So, let's take an example,
01:26 The first one goes to number one,
01:28 the second one goes to number two,
01:29 the third one goes to number three and then because it's
01:31 round-robin, the fourth one is again,
01:33 going to number one and so on. So 1, 2, 3, 1, 2, 3, 1, 2, 3.
01:38 This is going to work for the ALB again,
01:40 and the Classic Load Balancer (TCP) mode.
3. NLB Flow Hash
时间范围:01:44–02:38
总结 / Summary
中文
NLB 使用 Flow Hash,根据 Protocol、Source/Destination IP、Source/Destination Port 以及 TCP Sequence Number 的组合生成 Hash,并映射到某个 Target。这样同一 TCP 或 UDP Connection 在整个生命周期内都保持在同一 Backend Target。
English
NLB uses flow hash to combine protocol, source and destination IPs, source and destination ports, and the TCP sequence number into a hash that maps to a target. The same TCP or UDP connection therefore stays on one backend target for its full lifetime.
Transcript
01:44 The last request routing algorithm,
01:46 you need to know about is Flow Hash,
01:48 which is to select a target, based on the hashing of the
01:51 combination of parameters, such as the protocol,
01:55 the source destination, IP address,
01:57 the source destination port, and the TCP sequence number.
01:59 This guarantees that each TCP or UDP connection
02:02 is going to be routed to the single target
02:04 for the life of that connection,
02:06 and this is obviously something that is only applied
02:08 to the Network Load Balancer.
02:10 So, the idea is that your user
02:12 is going to connect to your NLB.
02:15 The NLB is going to look at all this information.
02:17 So the protocol, the IP, the port,
02:19 and the TCP sequence number.
02:21 Then it's going to apply the Flow Hash Algorithm,
02:23 and this hashing value is going to be attributed
02:25 to a specific EC2 instance,
02:27 and so on for all the other users
02:30 and assignments with all the backend EC2 instances, okay.
02:34 So, that's it for this lecture. I hope you liked it,
02:36 and I will see you in the next lecture.
整讲总结 / Overall Summary
中文
Load Balancer 的 Request Routing Algorithm 取决于协议与产品:Least Outstanding Requests 按未完成请求数选择较空闲 Target,适用于 ALB 与 CLB HTTP/HTTPS;Round Robin 依次轮转,适用于 ALB 与 CLB TCP;NLB 使用 Flow Hash,把同一 TCP/UDP Connection 固定到同一 Target。
English
The request routing algorithm depends on the protocol and load balancer. Least Outstanding Requests chooses the target with the fewest unfinished requests for ALB and CLB HTTP/HTTPS. Round robin cycles evenly for ALB and CLB TCP. NLB uses flow hash to keep each TCP/UDP connection on one target.
返回顶部 ↑