Skip to content

jcar787/go-rate-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Week 1 - Rate Limiter (Go + Redis + React)

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.


System Design Concepts

  • 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.

Architecture

flowchart LR
    UI[React UI] --> | GET /api/allow?user=123 | API(Go HTTP API)
    API -->| INCR / EVAL | Redis[(Redis)]
    Redis --> API
    API -->| JSON | UI
Loading

Sequence

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}
Loading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors