Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request optimizes the startup of node-spawned processes (such as the log monitor and monitor processes) by passing the cluster ID hex string directly via command-line arguments. This avoids an extra GCS RPC that could potentially time out during large cluster bring-ups. Additionally, a bug in GcsClientOptions initialization was fixed, and new unit tests were added to verify the cluster ID distribution. There are no review comments, so I have no feedback to provide.
…ching it from the GCS Every process that connects to the GCS without a cluster ID issues a NodeInfoGcsService.GetClusterId RPC during Connect(). During mass cluster bring-up the GCS is busy with node registrations, those fetches time out, and DEADLINE_EXCEEDED is fatal to the connecting process (observed as fleet-wide bring-up deaths at 400 nodes on Ray 2.56). Workers, raylets, dashboard, and both agents already receive the ID on their command line; this PR covers the remaining node-spawned processes through the environment and fixes a bug that made two more paths fetch unnecessarily: - GcsClientOptions.create (common.pxi) passed allow_cluster_id_nil twice, silently ignoring fetch_cluster_id_if_nil — so callers requesting fetch_cluster_id_if_nil=False (services._get_gcs_client_options and wait_for_node, i.e. every 'ray start') fetched anyway. Pass the right argument. - The node now exports RAY_CLUSTER_ID (via start_ray_process env_updates) when spawning the log monitor and the autoscaler monitor (v1 and v2), and GcsClient falls back to that variable when constructed without a cluster ID — so the spawned processes need no flag or code changes and anything else the node spawns this way is covered for free. Unset env (drivers, external tools, kuberay-launched monitors) keeps the fetch-from-GCS fallback. Signed-off-by: xyuzh <[email protected]>
448cde6 to
40ec01a
Compare
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
Why are these changes needed?
Every process that connects to the GCS without a cluster ID issues a
NodeInfoGcsService.GetClusterIdRPC duringConnect(). During mass cluster bring-up the GCS is busy with node registrations, those fetches time out, andDEADLINE_EXCEEDEDis fatal to the connecting process — we hit this as fleet-wide bring-up deaths at 400 nodes on Ray 2.56 (see #64845 / #64847 for the server- and client-side halves of that incident).The most effective fix is to not fetch a constant at scale: the node that spawns a process already knows the cluster ID. Workers, raylets, the dashboard, and both agents already receive it on their command line; this PR covers the remaining node-spawned processes through the environment (no new CLI flags), and fixes a latent bug that made two more paths fetch unnecessarily:
python/ray/includes/common.pxi):GcsClientOptions.createpassedallow_cluster_id_niltwice to the C++ constructor, silently ignoringfetch_cluster_id_if_nil. Every caller requestingfetch_cluster_id_if_nil=Falsewith a nil ID —services._get_gcs_client_optionsandservices.wait_for_node, i.e. everyray starton every node — actually fetched. That is an O(nodes) unnecessaryGetClusterIdstorm during exactly the bring-up window where the GCS is most backlogged.RAY_CLUSTER_IDviastart_ray_process(env_updates=...)when spawning the log monitor and the autoscaler monitor (v1 and v2), and PythonGcsClientfalls back to that variable when constructed without a cluster ID (_raylet.pyx). The spawned processes therefore need zero code changes — no argparse, no constructor plumbing — and any future process spawned with the variable set is covered for free. An unset variable (drivers, external tools, kuberay-launched monitors) keeps today's fetch-from-GCS fallback.Remaining fetchers after this PR (intentionally out of scope — not spawned by a node that knows the ID): drivers connecting via
ray.init(address=...), CLI tools (ray statusetc.), and the ray client proxy. #64845/#64847 keep those robust.Related issue number
None found — searched open PRs/issues for GetClusterId / cluster ID distribution before opening (companion PRs #64845, #64847 cover the same incident's server/client halves; no overlap in files or mechanism). Not a duplicate of in-flight work.
Checks
python/ray/tests/test_cluster_id_distribution.pyassertsstart_log_monitor/start_monitor(v1 and v2) passenv_updates={"RAY_CLUSTER_ID": ...}when given a cluster ID and omit it otherwise (registered inpython/ray/tests/BUILD.bazel, small).GcsClientenv fallback in_raylet.pyxrequires a built wheel and is exercised in CI by every test that starts a cluster and a log monitor/monitor).common.pxichange is exercised by every CI test that callsray start/wait_for_node; the C++ flag semantics (ShouldFetchClusterId) are already unit-tested.Per the repo's AI contribution policy: AI assistance was used to develop this change; every changed line was reviewed and the tests above were run locally.