Namespace Flow Example
Generate namespace configs and run many identical flows on one Linux host.
This example runs a single-host namespace workload where the controller and Postgres run in Docker, and one local dataplane process spawns many namespace nodes and flow senders.
Linux prerequisites
- Linux host with
iproute2(ipcommand),sudo, andtmux. - Docker Engine with
docker compose(ordocker-composefallback). python3(used byexamples/ns-flow/generate.py).- Rust toolchain (
cargo) unless you already have a builtnextminibinary.
Namespace-specific behavior from this example:
examples/ns-flow/run.shapplies Linuxsysctltuning for large namespace/veth churn.examples/ns-flow/generate.pywritesexamples/ns-flow/controller-config.tomlandexamples/ns-flow/config.toml.- Generated dataplane config sets
enable_local_interface = falsefor namespace flow runs.
1. Generate config files
From the repository root, generate the default 136-node / 180-flow configuration:
python3 examples/ns-flow/generate.py --n-nodes 136 --n-flows 180 --src 1 --dst 136To customize the workload, pass the same arguments that run.sh accepts:
python3 examples/ns-flow/generate.py \
--n-nodes 200 \
--n-flows 400 \
--src 1 \
--dst 200 \
--flow-bytes 1000000 \
--flow-rate 500000 \
--flow-weight 1run.sh regenerates these files automatically unless you pass --no-generate.
2. Start the example
Start everything with the orchestration script:
sudo ./examples/ns-flow/run.shrun.sh orchestration details:
- Applies sysctl tuning (unless
--no-sysctl). - Regenerates config files (unless
--no-generate). - Starts a tmux session (
nextmini-ns-flow) with:- left pane:
docker compose up --buildinexamples/ns-flow - right pane: build dataplane (if needed), wait for Postgres/controller readiness, then launch
nextminiwithexamples/ns-flow/config.toml
- left pane:
If you only want tuning without startup:
sudo ./examples/ns-flow/run.sh --sysctl-only3. Verify startup and flow completion
Check generated counts:
grep -c '^\[\[routes\]\]' examples/ns-flow/controller-config.toml
grep -c '^\[\[flows\]\]' examples/ns-flow/controller-config.tomlCheck seeded and finished flows in Postgres:
docker exec postgres psql -U pgusr -d nextmini -c \
"SELECT COUNT(*) AS total, COUNT(*) FILTER (WHERE is_finished) AS finished FROM flows;"Optional route sanity check:
docker exec postgres psql -U pgusr -d nextmini -c "SELECT COUNT(*) AS routes FROM routes;"4. Cleanup
Stop tmux/docker and remove created namespace networking artifacts:
sudo ./examples/ns-flow/cleanup.shThe cleanup script kills the nextmini-ns-flow tmux session, brings down examples/ns-flow/docker-compose.yml, deletes veth* links for configured nodes, and removes isobr* bridge shards.