Loading...
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetRetry-After👉 Storage is manageable; throughput & latency are the real challenges
POST /rules
PUT /rules/{id}
DELETE /rules/{id}
GET /rules/{id}
GET /rules?scope=...
POST /shouldAllow
Request:
{
"scope": "user",
"scope_value": "123",
"api": "/payments"
}
Response:
{
"allowed": true,
"remaining": 120,
"reset_time": 1710000000
}
👉 Even though sidecar handles decisions, this API helps in:
Rules Table:
rule_id (UUID PK)
scope_type (user/ip/org/api_key)
scope_value
api_endpoint
algorithm (token_bucket, sliding_window)
max_requests
window_seconds
burst_size
version
Constraint:
UNIQUE(scope_type, scope_value, api_endpoint)
Key:
rl:{hash(scope_value)}:{api}:{shard}
Value:
👉 Uses sharding to avoid bottlenecks
The system is divided into Data Plane (request path) and Control Plane (configuration path).
👉 Ensures:
They only maintain:
rl:{user}:{api}:shard1
rl:{user}:{api}:shard2
Formula:
tokens = min(capacity, tokens + rate × Δt)
Instead of:
We use:
👉 Benefits:
rl:user123:/payments:shard1
rl:user123:/payments:shard2
Flow:
Flow:
Consistency:
Track:
Tools: