|
28 | 28 | <meta property="og:description" content="限流的作用限流定义:限制「速率」,或从业务层限制「总数」,被限流的请求,直接进入「降级」fallback 流程(fallback与业务相关); 使用场景: 应对突发流量,避免系统被压垮(全局限流和IP限流)。 防刷,防止机器人脚本等频繁调用服务(userID限流和IP限流) 对于应对突发流量避免系统压垮这个情景,可以在以下几方面做具体限流 业务系统入口(入流量),比如秒杀活动等系统做限流">
|
29 | 29 | <meta property="og:locale" content="zh_CN">
|
30 | 30 | <meta property="article:published_time" content="2021-10-17T06:10:18.000Z">
|
31 |
| -<meta property="article:modified_time" content="2021-10-17T14:24:23.719Z"> |
| 31 | +<meta property="article:modified_time" content="2021-10-17T14:56:05.803Z"> |
32 | 32 | <meta property="article:author" content="hustyong">
|
33 | 33 | <meta property="article:tag" content="技术">
|
34 | 34 | <meta property="article:tag" content="限流">
|
@@ -177,7 +177,7 @@ <h1 class="post-title" itemprop="name headline">
|
177 | 177 | <span class="post-meta-item-text">发表于</span>
|
178 | 178 |
|
179 | 179 |
|
180 |
| - <time title="创建时间:2021-10-17 14:10:18 / 修改时间:22:24:23" itemprop="dateCreated datePublished" datetime="2021-10-17T14:10:18+08:00">2021-10-17</time> |
| 180 | + <time title="创建时间:2021-10-17 14:10:18 / 修改时间:22:56:05" itemprop="dateCreated datePublished" datetime="2021-10-17T14:10:18+08:00">2021-10-17</time> |
181 | 181 | </span>
|
182 | 182 | <span class="post-meta-item">
|
183 | 183 | <span class="post-meta-item-icon">
|
@@ -220,6 +220,7 @@ <h1 id="限流的行为"><a href="#限流的行为" class="headerlink" title="
|
220 | 220 | <p>特权请求:资源不够了,我只能把有限的资源分给重要的用户</p>
|
221 | 221 | <p>延时处理:一般会有一个队列来缓冲大量的请求,这个队列如果满了,那么就只能拒绝用户了,如果这个队列中的任务超时了,也要返回系统繁忙的错误了</p>
|
222 | 222 | <p>弹性伸缩:用自动化运维的方式对相应的服务做自动化的伸缩</p>
|
| 223 | +<span id="more"></span> |
223 | 224 | <h1 id="单机-amp-分布式"><a href="#单机-amp-分布式" class="headerlink" title="单机&分布式"></a>单机&分布式</h1><p>本质上单机限流和分布式限流的区别其实就在于 “阈值” 存放的位置。单机限流就上面所说的算法直接在单台服务器上实现就好了,而往往我们的服务是集群部署的。因此需要多台机器协同提供限流功能。</p>
|
224 | 225 | <p>单节点限流<br>单实例限流,实现简单;依赖的资源如DB 无法被保护</p>
|
225 | 226 | <p>分布式限流<br>基于某种中间件(Redis)的限流方式,实现较复杂;但是能保护依赖资源不受流量冲击</p>
|
|
0 commit comments