#5115, stacked on #4979. "Today" links are pinned to #4979's head a29d55b; "this PR" links to 9d420a14. Dynamo 1.5.1 → 1.8.0.dev20261117.
Nine pages on this stack (#4905, #4979 and #5115), one question each. This one: what #5115 moves to several frontends, and why.
num_frontends frontends run on the GPU nodes, each started by a small Ray actor. They use stock dynamo.frontend with two supported plug-ins (our chat engine and the cut route), so the launcher and the second port are gone. The session table holds 16,777,216. A watchdog stops every service if its starter is killed.The same example in both columns: 2 GPU nodes, 4 vLLM engines (e0–e3), and on the right num_frontends: 3 (F0–F2). Dashed boxes are OS processes; boxes inside them are the classes that do the work. ①to ⑤ is one Gym chat call; ✂ is a checkpoint cut.
What happens to one Gym call, step by step.
client_base_urls) and keeps each session on one of them.main() (frontend.py, deleted). With this PR, Dynamo loads it through its supported --dyn-chat-processor flag (provider), and its settings arrive as one typed ChatProcessorOptions instead of four env vars.--router-replica-sync shares in-flight requests between the routers (in kv mode).routes() extension. The native and Dynamo routes now share one check-and-answer helper, answer_generation_cut.Start-up, today (a29d55b)
# v2 driver process, VllmGeneration.__init__ runtime.start() etcd = Popen(etcd, new session) # outlives a SIGKILLed driver nats = Popen(nats-server, new session) front = Popen(python -m nemo_rl...vllm.frontend, # patches Dynamo's main() env={RENDER_WORKERS, RAY_ADDRESS, CUT_PORT, ...}) gym(base_urls=[front:A], cut_urls=[front:B]) # two ports for one frontend v2 rollout → POST front:A/v1/completions
Start-up, this PR (9d420a14)
# v2 driver process runtime.start(frontend_node_ids=cluster.get_node_ids()) # [node0, node1] etcd = _ServiceProcess(etcd) # + watchdog: stops it if the driver dies nats = _ServiceProcess(nats-server) for i in range(num_frontends): # 3 here host[i] = FrontendHost.remote(node=ids[i % 2]) # Ray actor, 0 CPU: node 0, 1, 0 urls = ray.get([h.start() for h in host]) # all 3 start at once # inside each FrontendHost actor, on its GPU node start: port = a free port on this node _ServiceProcess(python -m dynamo.frontend --dyn-chat-processor chat_engine:provider --frontend-route-extension generation_cut:routes --router-replica-sync # only when num_frontends > 1 --router-session-affinity-max-entries 16777216) gym(base_urls=urls) # the cut goes to the same URL v2 rollout → POST random.choice(urls)/v1/completions
Real code: _start_frontends, frontend_argv, service_watchdog.main, rollout URL pick.
| What a large run hits | Today (1.5.1, one frontend) | This PR |
|---|---|---|
| Live Gym sessions (about 0.5M rollouts in flight) | Dynamo's table is fixed at 65,536. Session 65,537 gets HTTP 529. | session_affinity_max_entries, default 16,777,216. Every frontend holds every session, so size it for the whole fleet. |
| Rendering and routing load | One process on the driver's node renders every chat call and routes every request. | num_frontends spreads it over the GPU nodes: each frontend has its own router and render workers. |
| Plugging our chat engine into Dynamo | Patch Dynamo's main(); breaks silently if Dynamo renames what it patches. | Dynamo's supported --dyn-chat-processor hook. |
| Checkpoint cuts | A second port per frontend, and a second URL list threaded through setup and Gym config. | The frontend's own port, so the second URL list in setup.py, vllm_generation.py and nemo_gym.py goes away. One frontend runs at most 64 cuts at once (HTTP 529 past that). |
Token-level fields (stop_token_ids, cache_salt, …) | Dynamo dropped them before our chat engine, so a start-up check refused them. | Dynamo passes them through. The check is removed. |
| Driver killed with SIGKILL | etcd, NATS and the frontend keep running; the test scripts kill them by name. | A watchdog beside each service stops its whole process group. |
router_mode: power-of-two | Allowed. | Rejected at start-up: Dynamo removed it. Use least-loaded or kv. |
The design is a step forward: two patches of Dynamo's code become supported hooks, four env vars become one typed options object, and the native and Dynamo cut routes share one helper. The review asks for one small fix, one docs row, evidence and tests for the new multi-frontend setup, and a fix for a run that hangs when one frontend dies (C21; C22 is optional).
| Comment | What it asks | Where |
|---|---|---|
| C15 | When the second frontend never answers, the start-up timeout error prints the first frontend's healthy counts. Reset them when moving to the next frontend. | wait_for_engines · C15 comment |
| C16 | The docs row lists two rejected flags; the code rejects three. | guide L41 · C16 comment |
| C17 | Add the router-mode parser test the author declined: this PR's own power-of-two removal is the drift it catches. | reply on C10 · C17 comment |
| C18 | The pending multi-node run should also report numbers for the move shown in orange above: the default frontend and its 8 render workers now sit on GPU node 0, uncounted by Ray. | reply on C14 · C18 comment |
| C19 | The start-up check for six token-level fields is gone, but only cache_salt has an end-to-end test. | reply on C1 · C19 comment |
| C20 | The code comment above num_frontends should say replica sync works only with router_mode: kv. | reply on C3 · C20 comment |
| C21 | When one frontend dies, Gym retries its URL forever and the run hangs (forest training: 3 tries, then the rollout fails). Gym already has the fix; RL should turn on route_around_failing_endpoints and a retry time limit whenever Gym gets more than one URL. Explainer. | num_frontends · C21 comment |
| C22 | Optional: restart a dead frontend on the same port, so Gym's trial call can pick it back up. | FrontendHost · C22 comment |
| C23 | Each frontend picks a free port, releases it, then binds it seconds later, in a range that overlaps the vLLM servers' range on the same GPU nodes. Give the frontends their own range and retry a failed launch. | FrontendHost.start · C23 comment |
| C24 | Small: log each frontend's Prometheus /metrics (queued and in-flight calls) next to the vLLM metrics. | _start_frontends · C24 comment |
| C25 | Small: Dynamo calls start a new trace instead of joining Gym's. Turn on Dynamo's OTLP export when RL exports traces, and pass the trace to vLLM's generate. | adapter · C25 comment |