# hhoangsonnw/azure-load-balancer architecture

> Architecture diagram of the GitHub repository hhoangsonnw/azure-load-balancer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hhoangsonnw/azure-load-balancer
- Repository: https://github.com/hhoangsonnw/azure-load-balancer

## Overview

CloudAdapt is a Go L7 load-balancing testbed. A client sends a workload request to the proxy; the proxy classifies and size-checks it, selects an eligible worker, and forwards it. Workers serve light, CPU, or I/O workloads and expose readiness and metrics endpoints. Health probes control worker eligibility. The README also describes planned routing baselines and HALB, seeded k6 comparisons, analysis, Prometheus/Grafana, and Azure validation; these are shown as product branches, not verified runtime integrations. Unsampled subsystems use only paths present in the tree.

Main entry points: [`cmd/worker/main.go`](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/main.go) (Worker Application), [`cmd/proxy/main.go`](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/proxy/main.go) (Proxy Application), [`internal/router/registry.go`](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/registry.go) (Route Selection), [`internal/router/proxy.go`](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/proxy.go) (Request Proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_proxy["Proxy Routing"]
  node_proxy_app["Proxy Application<br/>[main.go]"]
  node_proxy_config["Proxy Configuration<br/>[config.go]"]
  node_request_proxy["Request Proxy<br/>[proxy.go]"]
  node_route_selection["Route Selection<br/>[registry.go]"]
  node_registry[("Backend Registry<br/>[registry.go]")]
  node_round_robin["Round Robin<br/>[round_robin.go]"]
  node_health_checker["Health Checker<br/>[checker.go]"]
  node_policy_suite["Routing Policies"]
end

subgraph group_workers["Worker Runtime"]
  node_worker_app["Worker Application<br/>[main.go]"]
  node_workloads["Workload Routes<br/>[workload.go]"]
  node_worker_health["Readiness Endpoints<br/>[workload.go]"]
  node_worker_metrics["Worker Metrics<br/>[workload.go]"]
end

subgraph group_evaluation["Load Evaluation"]
  node_k6["k6 Load Generator"]
  node_analysis["Experiment Analysis"]
end

subgraph group_operations["Operations"]
  node_prometheus["Prometheus"]
  node_grafana["Grafana"]
  node_azure["Azure Validation"]
  node_workers_lab["Worker Lab<br/>[compose.yaml]"]
end

node_client(("HTTP Client"))

node_client -->|"sends requests"| node_proxy_app
node_proxy_app -->|"loads config"| node_proxy_config
node_proxy_app -->|"starts probes"| node_health_checker
node_proxy_app -->|"creates handler"| node_request_proxy
node_request_proxy -->|"chooses backend"| node_route_selection
node_route_selection -->|"reads eligible"| node_registry
node_route_selection -->|"dispatches pick"| node_round_robin
node_health_checker -->|"updates eligibility"| node_registry
node_health_checker -->|"probes readiness"| node_worker_health
node_request_proxy -->|"forwards request"| node_workloads
node_worker_app -->|"registers routes"| node_workloads
node_worker_app -->|"registers routes"| node_worker_health
node_worker_app -->|"registers routes"| node_worker_metrics
node_client -->|"starts worker"| node_worker_app
node_workloads -->|"records requests"| node_worker_metrics
node_k6 -.->|"generates load"| node_client
node_analysis -.->|"analyzes runs"| node_k6
node_worker_metrics -.->|"scrapes metrics"| node_prometheus
node_prometheus -.->|"supplies dashboards"| node_grafana
node_policy_suite -.->|"planned policies"| node_route_selection
node_workers_lab -.->|"runs workers"| node_worker_app
node_azure -.->|"planned validation"| node_workers_lab

click node_proxy_app "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/proxy/main.go"
click node_proxy_config "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/config.go"
click node_request_proxy "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/proxy.go"
click node_route_selection "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/registry.go"
click node_registry "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/registry.go"
click node_round_robin "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/round_robin.go"
click node_health_checker "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/health/checker.go"
click node_worker_app "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/main.go"
click node_workloads "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go"
click node_worker_health "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go"
click node_worker_metrics "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go"
click node_k6 "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/experiments/k6"
click node_analysis "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/experiments/analysis"
click node_policy_suite "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/internal/router"
click node_prometheus "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/observability"
click node_grafana "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/observability"
click node_azure "https://github.com/hhoangsonnw/azure-load-balancer/tree/main/infra/terraform"
click node_workers_lab "https://github.com/hhoangsonnw/azure-load-balancer/blob/main/deploy/compose.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_proxy_app,node_proxy_config,node_request_proxy,node_route_selection,node_registry,node_round_robin,node_health_checker,node_policy_suite,node_client toneBlue
class node_worker_app,node_workloads,node_worker_health,node_worker_metrics toneAmber
class node_k6,node_analysis toneMint
class node_prometheus,node_grafana,node_azure,node_workers_lab toneRose
```

## Components

### Proxy Routing

- [Proxy Application](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/proxy/main.go): `cmd/proxy/main.go`
- [Proxy Configuration](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/config.go): `internal/router/config.go`
- [Request Proxy](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/proxy.go): `internal/router/proxy.go`
- [Route Selection](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/registry.go): `internal/router/registry.go`
- [Backend Registry](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/registry.go): `internal/router/registry.go`
- [Round Robin](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/router/round_robin.go): `internal/router/round_robin.go`
- [Health Checker](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/internal/health/checker.go): `internal/health/checker.go`
- [Routing Policies](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/internal/router): `internal/router`

### Worker Runtime

- [Worker Application](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/main.go): `cmd/worker/main.go`
- [Workload Routes](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go): `cmd/worker/workload.go`
- [Readiness Endpoints](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go): `cmd/worker/workload.go`
- [Worker Metrics](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/cmd/worker/workload.go): `cmd/worker/workload.go`

### Load Evaluation

- [k6 Load Generator](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/experiments/k6): `experiments/k6`
- [Experiment Analysis](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/experiments/analysis): `experiments/analysis`

### Operations

- [Prometheus](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/observability): `observability`
- [Grafana](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/observability): `observability`
- [Azure Validation](https://github.com/hhoangsonnw/azure-load-balancer/tree/main/infra/terraform): `infra/terraform`
- [Worker Lab](https://github.com/hhoangsonnw/azure-load-balancer/blob/main/deploy/compose.yaml): `deploy/compose.yaml`

### Other components

- **HTTP Client**

## Connections

- HTTP Client → Proxy Application: sends requests (evidence: `README.md`)
- Proxy Application → Proxy Configuration: loads config (evidence: `cmd/proxy/main.go`)
- Proxy Application → Health Checker: starts probes (evidence: `cmd/proxy/main.go`)
- Proxy Application → Request Proxy: creates handler (evidence: `cmd/proxy/main.go`)
- Request Proxy → Route Selection: chooses backend (evidence: `internal/router/proxy.go`)
- Route Selection → Backend Registry: reads eligible (evidence: `internal/router/registry.go`)
- Route Selection → Round Robin: dispatches pick (evidence: `internal/router/registry.go`)
- Health Checker → Backend Registry: updates eligibility (evidence: `internal/health/checker.go`)
- Health Checker → Readiness Endpoints: probes readiness (evidence: `internal/health/checker.go`)
- Request Proxy → Workload Routes: forwards request (evidence: `README.md`)
- Worker Application → Workload Routes: registers routes (evidence: `cmd/worker/main.go`)
- Worker Application → Readiness Endpoints: registers routes (evidence: `cmd/worker/main.go`)
- Worker Application → Worker Metrics: registers routes (evidence: `cmd/worker/main.go`)
- HTTP Client → Worker Application: starts worker (evidence: `README.md`)
- Workload Routes → Worker Metrics: records requests (evidence: `cmd/worker/workload.go`)
- k6 Load Generator → HTTP Client: generates load (evidence: `README.md`)
- Experiment Analysis → k6 Load Generator: analyzes runs (evidence: `README.md`)
- Worker Metrics → Prometheus: scrapes metrics (evidence: `README.md`)
- Prometheus → Grafana: supplies dashboards (evidence: `README.md`)
- Routing Policies → Route Selection: planned policies (evidence: `README.md`)
- Worker Lab → Worker Application: runs workers (evidence: `README.md`)
- Azure Validation → Worker Lab: planned validation (evidence: `README.md`)
