|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Streamlined multi-node serving with Ray symmetric-run" |
| 4 | +author: "Richard Liaw (Anyscale/Ray), Kaichao You (vLLM)" |
| 5 | +image: /assets/logos/vllm-logo-text-light.png |
| 6 | +--- |
| 7 | + |
| 8 | +Ray now has a new command: `ray symmetric-run.` This command makes it possible to launch the **same entrypoint command** on every node in a Ray cluster, simplifying the workflow to spawn vLLM servers with multi-node models on HPC setups or in using parallel ssh tools like `mpssh`. |
| 9 | + |
| 10 | +In this blog, we’ll talk about the issues with the current way of spawning vLLM servers with Ray; we’ll walk through a motivating example; and finally we’ll discuss how the new `symmetric-run` API from Ray will improve the launching experience. |
| 11 | + |
| 12 | +Ray recently joined the Pytorch foundation. As part of this donation, both vLLM and Ray teams are working together to build deep alignment to advance the next generation of AI infrastructure. |
| 13 | + |
| 14 | +<p align="center"> |
| 15 | +<picture> |
| 16 | +<img src="/assets/figures/2025-11-25-ray-symmetric-run/symmetric-run.png" width="100%"> |
| 17 | +</picture><br> |
| 18 | +Figure 1. Overview of `symmetric-run` command from Ray. |
| 19 | +</p> |
| 20 | + |
| 21 | +### Context |
| 22 | + |
| 23 | +vLLM users approaching Ray often bring expectations from their existing tools and workflows. Developers doing interactive work on barebones clusters expect to quickly launch commands across multiple hosts with tools like `mpssh` or `pssh`, using a single command parameterized by “rank”. HPC users familiar with SLURM and PBS expect *symmetric execution* — a single program entrypoint that runs simultaneously across all nodes, similar to MPI applications. |
| 24 | + |
| 25 | +However, Ray's recommended job execution pattern follows a different philosophy with specific roles for head and worker nodes. |
| 26 | + |
| 27 | +The program entrypoint executes on the head node, which then orchestrates and delegates work to worker nodes. The runtime lifecycle is separate from job execution, requiring explicit cluster management. This means users need two distinct command sets—one to establish the cluster with proper head/worker roles, and another to actually run their work. |
| 28 | + |
| 29 | +### Motivating Example |
| 30 | + |
| 31 | +Let’s walk through an example of launching a distributed job on 2 separate machines. We assume the machines are bare in that we can’t use other solutions like Ray’s cluster launcher or KubeRay. |
| 32 | + |
| 33 | +To run a Ray job on multiple machines in this situation, users will need to first start Ray on the head node: |
| 34 | + |
| 35 | +```shell |
| 36 | +ray start --block |
| 37 | +``` |
| 38 | + |
| 39 | +And then on worker nodes, they’ll need to connect back to the head node: |
| 40 | + |
| 41 | +```shell |
| 42 | +# worker node, terminal 1: |
| 43 | +ray start --block --address='ip:6379' |
| 44 | +``` |
| 45 | + |
| 46 | +After the nodes are setup, then they’ll need to start a separate terminal on the head node to run the job: |
| 47 | + |
| 48 | +```shell |
| 49 | +vllm serve Qwen/Qwen3-32B --tensor-parallel-size 8 --pipeline-parallel-size 2 |
| 50 | +``` |
| 51 | + |
| 52 | +And then in termination, they’ll need to run `ray stop` on each of the nodes: |
| 53 | + |
| 54 | +```shell |
| 55 | +ray stop |
| 56 | +``` |
| 57 | + |
| 58 | +Running vLLM in this configuration typically requires a fair amount of trial and error. A common failure mode occurs when certain environment variables, like `VLLM_HOST_IP`, are missing. When this happens, users will need to shut down the Ray cluster, set the environment variable on \`ray start\`, and go through the rest of the above steps yet again. |
| 59 | + |
| 60 | +For users expecting symmetric, single-command execution, this creates significant friction in their development and deployment workflows. |
| 61 | + |
| 62 | +Ray now offers a simple solution: **`ray symmetric-run`**, a new way to run Ray jobs across all nodes in a cluster. |
| 63 | + |
| 64 | +### What does `symmetric-run` do? |
| 65 | + |
| 66 | +`ray symmetric-run` makes it possible to launch the **same entrypoint command** on every node in a Ray cluster. The script automatically handles Ray setup, job execution, and teardown, allowing users can have a similar experience to other tools like `mpirun` or `torchrun`. |
| 67 | + |
| 68 | +Taking the same example as above, with `symmetric-run`, you can simply do: |
| 69 | + |
| 70 | +```shell |
| 71 | +# in SLURM sbatch script or via mpssh |
| 72 | + |
| 73 | +ray symmetric-run \ |
| 74 | + --address <head_node_address>:6379 \ |
| 75 | + --min-nodes 2 \ |
| 76 | + --num-gpus 8 \ |
| 77 | + -- vllm serve Qwen/Qwen3-32B --tensor-parallel-size 8 --pipeline-parallel-size 2 |
| 78 | +``` |
| 79 | + |
| 80 | +Each node will execute the same command, but the behavior underneath the hood will be different per node. In particular, the worker node will only execute the Ray cluster initialization, whereas the head node will: |
| 81 | + |
| 82 | +1. Starts Ray in `--head` mode. |
| 83 | +2. Waits for four nodes to register. |
| 84 | +3. Run your user command (`vllm serve Qwen/Qwen3-32B …`). |
| 85 | +4. Shuts down Ray when done. |
| 86 | + |
| 87 | +The workers simply run `ray start --address head-node:6379` and wait until the job ends, after which it will self-destruct. No extra SSH orchestration or startup scripts needed. |
| 88 | + |
| 89 | +If you need to provide an environment variable, you can simply append it to the start of the command, and `symmetric-run` will automatically propagate the variable to the Ray runtime: |
| 90 | + |
| 91 | +```shell |
| 92 | +ENV=VAR ray symmetric-run --address 127.0.0.1:6379 -- python test.py |
| 93 | +``` |
| 94 | + |
| 95 | +### Conclusion |
| 96 | + |
| 97 | +Ray’s new symmetric run utility simplifies running Ray and vLLM programs on HPC or parallel SSH setups. Try out Ray Symmetric Run today: [https://docs.ray.io/en/latest/cluster/vms/user-guides/community/slurm.html](https://docs.ray.io/en/latest/cluster/vms/user-guides/community/slurm.html) |
| 98 | + |
| 99 | +If you run into any issues, please open a ticket on Github: [https://github.com/ray-project/ray/](https://github.com/ray-project/ray/) |
| 100 | + |
| 101 | +To chat with other members of the community, join the [vLLM slack](https://communityinviter.com/apps/vllm-dev/join-vllm-developers-slack) and [Ray slack](https://www.ray.io/join-slack)\! |
0 commit comments