lore 1: high-level architecture and crate structure
to separate control from performance in my hybrid load balancer project, i divided things into two worlds across a cargo workspace:
data plane:
- 'janus-proxy' (network i/o)
- 'janus-balancer' (selection algorithms)
control plane:
- 'janus-config' (configuration management)
- 'janus-admin' (metrics api)
- 'janus-health' (health checking)
- 'janus-bin' (orchestration)
what is a data plane?
- it has one very simple role: handling incoming client connections.
- speed is critical here, which is why it must avoid slow system operations.
- its job is to accept connections, read and write bytes, decide where traffic should go, and forward the data.
what is a control plane?
- it is responsible for system management tasks such as configuration, health monitoring, metrics collection, startup, and graceful shutdown.
- the data plane should only focus on routing and handling traffic.
- you do not want the data plane worrying about configuration changes while processing incoming requests.
- a request should never have to wait because someone opened the dashboard, reloaded a config file, or checked metrics. the control plane takes care of those responsibilities and makes the data plane's job easier.
why this division?
- let's say your load balancer is handling 100k requests per second.
- if every request had to check whether configurations changed, whether a backend became unhealthy, or whether some metric was updated, you would waste a lot of time and eventually money.
- why should your connection handler care about changes that might not even happen?
- this is where the control plane comes in.
- it maintains the system's configuration and state, then provides the necessary information to the data plane so it can focus entirely on moving traffic.
communication between the data plane and control plane?
- i said the control plane gives instructions to the data plane, but how?
- everything that is modified by the control plane and read by the data plane is stored in a shared state module that both can access.
- this shared state contains things like runtime server state, backend health metrics, routing information, and other important operational data.
- the control plane updates it whenever changes happen, while the data plane reads from it during request processing without having to perform expensive checks itself.
next upcoming topic: cli argument parsing & main entrypoint (janus-bin)