Skip to content

Commit

Permalink
docs: add plantuml files to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmatau79 committed Feb 6, 2025
1 parent d5bf6fd commit d7f138e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/loadbalancer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This project implements a **load balancer** for WebRTC **Mediasoup** servers. It
3. The server’s total capacity is calculated (`workers × 500` consumers).
4. The server is stored in Redis with `health: true`.

![Server Registration](docs/server-registration.png)
![Server Registration](docs/server-registration-flow.png)

### **2. Health Check Process**

Expand Down
13 changes: 13 additions & 0 deletions apps/loadbalancer/docs/health-check-process.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml
title Health Check Process

Loop Every 30 seconds (HEALTH_CHECK_INTERVAL)
LoadBalancer -> Webrtc-Server: GET /health
alt Server is healthy
LoadBalancer -> Redis: Update health: true
else Server is unhealthy
LoadBalancer -> Redis: Update health: false
end
end

@enduml
13 changes: 13 additions & 0 deletions apps/loadbalancer/docs/room-allocation-flow.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml
title Room Allocation Flow


Agent -> LoadBalancer: POST /rooms/:roomId?
LoadBalancer -> Redis: Fetch list of available servers
LoadBalancer -> LoadBalancer: Filter out unhealthy servers
LoadBalancer -> LoadBalancer: Select server with highest available capacity
LoadBalancer -> Webrtc-Server: Create Room
LoadBalancer -> Redis: Update server capacity
LoadBalancer -> Agent: Return WebSocket URL

@enduml
11 changes: 11 additions & 0 deletions apps/loadbalancer/docs/room-closure-flow.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@startuml
title Room Closure Flow



Agent -> MediasoupServer: Close Room
Webrtc-Server -> LoadBalancer: POST /room-closed
LoadBalancer -> Redis: Add back available capacity
LoadBalancer -> Redis: Remove room entry

@enduml
13 changes: 13 additions & 0 deletions apps/loadbalancer/docs/server-registration-flow.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml
title Server Registration Flow


entryspacing 1.1
webrtc-server -> LoadBalancer: POST /register
alt Server already registered
LoadBalancer -> Redis: Remove existing entry
end
LoadBalancer -> LoadBalancer: Calculate capacity (workers × 500)
LoadBalancer -> Redis: Store server data (health: true)

@enduml

0 comments on commit d7f138e

Please sign in to comment.