API Rate Limiting & Caching System
Live interactive demo — FastAPI + Redis + PostgreSQL
Token Bucket
Redis Cache
CloudWatch Metrics
API Client
Free Tier
FREE
ak_free_demo_key_001
10 req / 60s · bursts to 15
Pro Tier
PRO
ak_pro_demo_key_002
300 req / 60s · bursts to 450
Enterprise
ENTERPRISE
ak_enterprise_demo_key_003
1000 req / 60s · bursts to 1500
Endpoint
GET
/api/products
60s TTL
GET
/api/products/42
60s TTL
GET
/api/users/7
30s TTL
GET
/api/stats
10s TTL
POST
/api/products
invalidates
GET
/metrics
exempt
Fire Requests
Count
1
Delay (ms)
100
▶ Send Request
⚡ Burst Attack (exhaust limit)
Scenario shortcuts
Demo: Cache Hit / Miss
Demo: Trigger 429s
Demo: Cache Invalidation
Request Feed
clear
Total
0
200 OK
0
429 Throttled
0
Cache Hits
0
Avg Latency
0ms
Token Bucket —
Free Tier
10
/
10
tokens
Request lifecycle
1
Identify client
X-API-Key or IP fallback
↓
2
Token bucket check
Lua script — atomic in Redis
↓
3
Cache lookup
Redis GET — HIT returns instantly
↓
4
Route handler
FastAPI — only on cache MISS
↓
5
Cache + log
SET in Redis · write to PostgreSQL
Last response
Waiting for first request...
Requests/sec
0.0
rolling 60s window
Cache hit ratio
0%
Redis hits vs misses
p99 latency
0ms
worst-case response
Throttle rate
0%
429s / total requests
Redis cache state
flush
No cached entries yet.