api-gateway
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAPI Gateway — Kong, Traefik, Patterns
API网关 — Kong、Traefik、相关模式
API Gateway moderne pour routing, auth, rate limiting, observabilité.
现代API网关可用于路由、认证、限流、可观测性。
Responsabilités
核心职责
| Fonction | Outils |
|---|---|
| Routing (path, header, canary) | Kong, Traefik, Nginx |
| Auth (JWT, OAuth2, API keys) | Kong plugins, Traefik middleware |
| Rate Limiting (per-user/IP) | Redis-backed counters |
| Load Balancing | HAProxy, Traefik |
| Circuit Breaker | Resilience4j, Istio |
| 功能 | 工具 |
|---|---|
| 路由(路径、请求头、金丝雀发布) | Kong、Traefik、Nginx |
| 认证(JWT、OAuth2、API密钥) | Kong插件、Traefik中间件 |
| 限流(按用户/IP) | 基于Redis的计数器 |
| 负载均衡 | HAProxy、Traefik |
| 断路器 | Resilience4j、Istio |
Stacks
技术栈选型
Kong — Enterprise, plugins riches, K8s-native
Traefik — Cloud-native, auto-discovery
AWS API Gateway — Managed, serverless
Nginx — Performance max, self-hosted
Envoy — Service mesh (Istio), gRPC
Traefik — Cloud-native, auto-discovery
AWS API Gateway — Managed, serverless
Nginx — Performance max, self-hosted
Envoy — Service mesh (Istio), gRPC
Kong — 企业级、插件丰富、原生支持K8s
Traefik — 云原生、自动服务发现
AWS API Gateway — 托管式、无服务器
Nginx — 性能优异、自托管
Envoy — 服务网格(Istio)、支持gRPC
Traefik — 云原生、自动服务发现
AWS API Gateway — 托管式、无服务器
Nginx — 性能优异、自托管
Envoy — 服务网格(Istio)、支持gRPC
Kong Config
Kong Config
yaml
services:
- name: payment-api
url: http://payment:8080
routes: [{ paths: ["/api/payments"] }]
plugins: [rate-limiting, jwt, prometheus]yaml
services:
- name: payment-api
url: http://payment:8080
routes: [{ paths: ["/api/payments"] }]
plugins: [rate-limiting, jwt, prometheus]Traefik Config
Traefik Config
yaml
http:
routers:
payment:
rule: "PathPrefix(`/api/payments`)"
middlewares: [rate-limit, auth]
middlewares:
rate-limit:
rateLimit: { average: 100, burst: 50 }yaml
http:
routers:
payment:
rule: "PathPrefix(`/api/payments`)"
middlewares: [rate-limit, auth]
middlewares:
rate-limit:
rateLimit: { average: 100, burst: 50 }Rate Limiting Algorithms
限流算法
Fixed Window — Simple counter, bursty
Sliding Window — Rolling counter, lissé
Token Bucket — Flexible, burst toléré
Leaky Bucket — Output constant, strict
Sliding Window — Rolling counter, lissé
Token Bucket — Flexible, burst toléré
Leaky Bucket — Output constant, strict
Pour setup :
@devops-engineer固定窗口算法 — 计数器简单,易出现突发流量问题
滑动窗口算法 — 滚动计数器,流量更平稳
令牌桶算法 — 灵活性高,允许突发流量
漏桶算法 — 输出流量恒定,规则严格
滑动窗口算法 — 滚动计数器,流量更平稳
令牌桶算法 — 灵活性高,允许突发流量
漏桶算法 — 输出流量恒定,规则严格
如需部署配置:
@devops-engineer