Motivation: Implement ByteByteGo System Design problems to enhance my System Design Knowledge and learn Go at the same time.
Goal: Implement different rate limiting algorithms, expose a backend API, and visualize traffic throttling via a React UI.
- Fixed Window - Easy to implement; but bursty at window edges
- Sliding Window - More accurate; needs atomic ops(Lua in Redis)
- Token Bucket - Smooth traffic, allows bursts.
flowchart LR
UI[React UI] --> | GET /api/allow?user=123 | API(Go HTTP API)
API -->| INCR / EVAL | Redis[(Redis)]
Redis --> API
API -->| JSON | UI
sequenceDiagram
participant UI
participant API
participant Redis
UI->>API: GET /api/allow?user=U123
API->>Redis: EVAL sliding_window.lua
Redis-->>API: {count, resetIn}
API-->>UI: {allowed:true, count:3, resetIn:4200}