How goldenberry274/load_balancer_reverse_proxy_cpp works
This is a multithreaded C++ TCP reverse proxy and load balancer. The principal workflow is YAML configuration loading, client connection acceptance, worker-pool dispatch, HTTP request parsing, backend selection, and bidirectional proxying. Separate health checks update backend availability; the server also serves human-readable status and Prometheus metrics. The graph reflects README-documented capabilities and shown source references; unsampled implementation details and their internal wiring are not assumed.
Main entry points: Server.cpp TCP proxy server · main.cpp Application entry · HealthChecker.cpp Health checker · Backend.hpp Backend state
Components 16
Proxy runtime
- Application entry
src/main.cpp - YAML configuration
src/config/config.cpp - TCP proxy server
src/core/Server.cpp - Worker pool
src/core/ThreadPool.cpp - HTTP parser
src/proxy/HttpParser.cpp - HTTP request model
include/proxy/HttpRequest.hpp
Backend routing
- Round-robin balancer
src/balancer/RoundRobinBalancer.cpp - Weighted balancer
src/balancer/WeightedBalancer.cpp - Backend state
include/balancer/Backend.hpp
Operations
- Health checker
src/health/HealthChecker.cpp
Observability
- Runtime metrics
src/observability/Metrics.cpp - Structured logger
src/observability/Logger.cpp
Other components
- Operator
- HTTP clients
- Backend servers
- Prometheus
Connections 21
- Operator → Application entry: starts
README.md - Application entry → YAML configuration: loads settings
src/main.cpp - Application entry → TCP proxy server: starts
src/main.cpp - HTTP clients → TCP proxy server: sends requests
README.md - TCP proxy server → Worker pool: dispatches clients
src/core/Server.cpp - Worker pool → TCP proxy server: runs handler
README.md - TCP proxy server → HTTP parser: parses request
src/core/Server.cpp - HTTP parser → HTTP request model: creates model
- TCP proxy server → Round-robin balancer: selects backend
README.md - Round-robin balancer → Backend state: selects from
- TCP proxy server → Backend servers: proxies traffic
src/core/Server.cpp - Health checker → Backend servers: checks availability
README.md - Health checker → Backend state: updates health
README.md - TCP proxy server → Health checker: starts checks
src/core/Server.cpp - TCP proxy server → Runtime metrics: records requests
src/core/Server.cpp - TCP proxy server → Structured logger: logs events
src/core/Server.cpp - HTTP clients → TCP proxy server: requests status
README.md - TCP proxy server → HTTP clients: returns status
README.md - HTTP clients → TCP proxy server: scrapes metrics
README.md - TCP proxy server → Prometheus: exposes metrics
README.md - Weighted balancer → Backend state: uses backend state