Files
slide/decks/gen2D/pages/ratelimit-overview.md
T
wonder 67ee76e58d
Deploy Slides / build-and-deploy (push) Successful in 1m8s
feat: expand gen2D deck with deep technical slides and interactive elements
- Add 5 new slide pages: eino-deep-dive, ratelimit-overview, ratelimit-lua, async-deep-dive, harness
- Add 4 new drawio SVGs: pipeline-detail, ratelimit, async-task, harness
- Update all existing slides with v-clicks progressive reveal
- Add presenter notes and interactive prompts
- Expand slides.md to register all new pages (16 → 25+ slides)
- Fix text overflow by trimming content per Item block
- Add Eino Graph deep dive: WithGenLocalState, Pre/Post Handler, branch routing
- Add rate limiting section: algorithm comparison, Lua script, Gin middleware
- Add async task deep dive: TaskQueue FIFO, context progress injection
- Add consistency section: style/pipeline/data/deployment 4-layer guarantees
2026-05-30 22:42:23 +08:00

1.2 KiB

分布式限流 — 算法选型与架构

保护 API 端点,防止资源滥用

算法 优点 缺点 适用场景
固定窗口计数器 实现简单 窗口边界突发 低精度场景
滑动窗口 边界平滑 内存开销大 中等精度
漏桶 严格平滑 无法应对突发 流量整形
令牌桶 平滑 + 允许突发 实现稍复杂 API 限流
令牌按固定速率填充,请求消耗令牌。桶满时可应对短时突发流量,同时保持长期平均速率稳定。 **用户级**:per-user 维度,防止单用户滥用。**全局级**:per-endpoint 维度,保护后端服务总容量。两级独立配置,互不影响。 Redis 不可用时限流器自动放行(fail-open),保障核心业务不因限流组件故障而中断。