Lecture 186: Connection Draining
- 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
- 视频时长:02:22
- 来源:Udemy Lecture 28555993
- Slide 数量:4
- 画面切换:00:39、01:18、01:36
扫描说明
逐条读取了 Udemy 页面中的 60 条英文 Transcript cue,并按时间轴扫描全长约 02:22 的视频。依据命名与基本语义、现有与新连接的分流、可配置范围、短请求和长请求的取舍划分为 4 个小节。截图均在 Transcript 侧栏关闭、播放器控件隐藏后复核,统一为 1364×770。
Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。
1. CLB 称 Connection Draining,ALB/NLB 称 Deregistration Delay
时间范围:00:00–00:39
总结 / Summary
中文
同一机制在 Classic Load Balancer 中叫 Connection Draining,在 Application Load Balancer 与 Network Load Balancer 中叫 Deregistration Delay。它让正在注销或已被判定 Unhealthy 的 Instance 获得一段时间完成 In-flight Request;一旦进入 Draining,ELB 不再把新请求发给该 Instance。
English
The same mechanism is called connection draining on a Classic Load Balancer and deregistration delay on Application and Network Load Balancers. It gives a deregistering or unhealthy instance time to complete in-flight requests. Once draining begins, the ELB stops sending new requests to that instance.
Transcript
00:00 So now let's talk about a feature
00:01 that can come up in the exam,
00:02 which is called Connection Draining.
00:04 So it has two names, actually.
00:06 If you're using a Classic Load Balancer,
00:08 it is called Connection Draining,
00:09 but if you're using an Application Balancer
00:11 or a Network Load Balancer,
00:13 this is called a Deregistration Delay.
00:16 And the idea behind this concept is that
00:18 it will give some time for your instances
00:21 to complete the inflight request or the active request
00:24 while the instance is being deregistered
00:26 or marked unhealthy.
00:28 And once a connection is being drained,
00:30 so once an instance is being drained,
00:32 then the ELB will stop sending your request
00:35 to the EC2 instance that is being drained
00:37 while being deregistered.
2. 保留现有连接,同时把新连接分配给其他 Target
时间范围:00:39–01:18
总结 / Summary
中文
进入 Draining 的 EC2 仍可服务已经建立连接的用户,直到这些连接或请求完成、Draining Period 到期或被关闭;新用户到达 ELB 时,Load Balancer 会跳过 Draining Target,只在其余健康 Instance 上建立新连接。这避免了扩缩容或维护时直接中断活跃请求。
English
A draining EC2 instance continues serving users with established connections until those requests finish, the draining period expires, or the connections close. For new users, the load balancer skips the draining target and establishes connections only with the remaining healthy instances. This avoids abruptly interrupting active requests during scaling or maintenance.
Transcript
00:39 So let's have a look at a diagram to understand better.
00:41 So we have three EC2 instances
00:44 and in one of them we'll set it in draining mode.
00:46 So the users that are already connected to that EC2 instance
00:50 are going to be given enough time,
00:52 which is the draining period, okay,
00:54 to complete their existing connection
00:56 and to complete their existing request.
00:58 And then once everything's done,
01:00 then all the connections will be shut down.
01:02 Now, if new users try to connect to our ELB,
01:05 our ELB is smart enough to know
01:06 that because our EC2 instance is in draining state,
01:09 then it will only establish new connections
01:12 with other EC2 instances, for example,
01:14 my second EC2 instance or my third EC2 instance.
3. 范围 1–3600 秒,默认 300 秒,也可设为 0
时间范围:01:18–01:36
总结 / Summary
中文
Draining/Deregistration Delay 可配置为 1 到 3600 秒,默认 300 秒(5 分钟)。将值设为 0 可完全禁用 Draining,表示不会等待现有请求自然完成。配置值应与应用请求持续时间和 Instance 下线速度要求匹配。
English
Draining or deregistration delay can be configured from 1 to 3,600 seconds, with a 300-second (five-minute) default. Setting it to zero disables draining entirely, meaning the load balancer does not wait for active requests to finish. Choose a value that matches request duration and the required instance removal speed.
Transcript
01:18 Now you can parametrize
01:19 these Connection Draining parameters.
01:21 So you can set it anywhere between 1 to 3,600 seconds.
01:26 By default, it is 300 seconds, so five minutes,
01:29 and you can disable it altogether
01:31 if you set the value to zero,
01:33 which means that there's no draining happening.
4. 短请求用较低值,上传与长连接需要较高值
时间范围:01:36–02:22
总结 / Summary
中文
请求很短时可选择较低值,例如 30 秒,让 Instance 更快被替换或下线。若应用包含 Upload、长事务或 Long-lived Request,则应提高延迟,给请求更多完成时间;代价是 Instance 会保持更久,不能立即离开服务。核心是在用户请求完整性与资源回收速度之间取舍。
English
For very short requests, a lower value such as 30 seconds lets an instance be replaced or removed quickly. Applications with uploads, long transactions, or long-lived requests should use a higher delay to give work time to finish. The trade-off is that the instance remains longer instead of leaving service immediately, balancing request integrity against resource-removal speed.
Transcript
01:36 Now, if you set it to low value, okay, this is good
01:39 if your requests are short, for example, if there were very,
01:42 very short requests for, let's say, less than one second,
01:45 well, it's a good idea to set
01:46 the draining connection parameter to maybe 30 seconds, okay,
01:50 because then this will allow your EC2 instance
01:52 to be drained really fast and then be taken offline,
01:56 maybe to be replaced or something like this.
01:58 If your request can be quite long, for example,
02:00 if you have uploads or long lived requests,
02:03 then you want to set it to something pretty high,
02:06 but the trade-off is that's your EC2 instance
02:08 is not going to go away as soon as soon as possible, okay,
02:11 it's going to have to wait
02:12 until this Connection Draining period is done, okay?
02:15 So this is what you need to know about this setting
02:18 at a high level.
02:19 I hope you liked it and I will see you in the next lecture.
整讲总结 / Overall Summary
中文
Connection Draining(CLB)或 Deregistration Delay(ALB/NLB)用于平滑摘除 Target:允许现有 In-flight Request 完成,同时拒绝该 Target 的新连接。范围 1–3600 秒,默认 300 秒,0 表示禁用;短请求适合较低值,Upload 与 Long-lived Request 适合较高值。
English
Connection draining on CLB, or deregistration delay on ALB/NLB, removes targets gracefully: existing in-flight requests may complete while new connections avoid the target. The range is 1–3,600 seconds, the default is 300 seconds, and zero disables the feature. Short requests suit a low value, while uploads and long-lived requests need a higher one.
返回顶部 ↑