Skip to content

[Core] Update OOM documentation to use resource isolation mode for OOM issues - #63652

Merged
edoakes merged 25 commits into
ray-project:masterfrom
Kunchd:RI_documentation
Jun 10, 2026
Merged

edoakes merged 25 commits into
ray-project:masterfrom
Kunchd:RI_documentation

Conversation

@Kunchd

@Kunchd Kunchd commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

We will be introducing a new memory monitoring system that will provide enhanced stability under memory contention. This PR updates the user guide documentations for how to leverage the new resource isolation mode to protect critical ray systems to prevent node deaths and eliminate OOMs.

Related issues

Additional information

New/modified high-level description of the memory monitoring system: https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-core/scheduling/ray-oom-prevention.html
New/modified OOM debugging guide: https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-observability/user-guides/debug-apps/debug-memory.html

@Kunchd
Kunchd requested review from a team as code owners May 26, 2026 23:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Ray documentation regarding memory monitoring, OOM prevention, and debugging memory issues. It introduces details on the resource isolation mode (available since Ray 2.56), explains the new time-based worker killing policy, and provides guidance on monitoring and eliminating worker OOM errors. The reviewer feedback focuses entirely on improving the documentation's quality by correcting minor typos, grammar, punctuation, and capitalization inconsistencies.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit afa5464. Configure here.

@Kunchd
Kunchd force-pushed the RI_documentation branch from c263e62 to 93fa0de Compare May 27, 2026 01:12
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core labels May 27, 2026
Signed-off-by: davik <[email protected]>
@Kunchd
Kunchd force-pushed the RI_documentation branch from 341a4c2 to ce8624e Compare May 27, 2026 18:18
@Kunchd Kunchd added the go add ONLY when ready to merge, run all tests label May 27, 2026
If Tasks or Actors cannot be retried, they raise an exception with
a much cleaner error message when you call ``ray.get`` to it.
Ray's memory monitor will also log the details of the out-of-memory kill to the ``raylet.out`` log file.
Note that the log's new lines are delimited by ``;`` instead of ``\n`` to make grepping for the log easier.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? we can still grep messages delimited by \n?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we grep, only the matching line is returned. This can get annoying if you're trying to pipe commands together with the grep. If we have ;, the entire log message will be returned and can be processed in one go by the downstream command.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I usually just go to the relevant line and look from there. I am guessing similar thing may be doable with grep (looks like there is support for -C (couple lines before and after), -B (couple lines before the match) and -A (couple of lines after the match)).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you can definitely look around the line that matched in grep and go from there. But we've previously had a discussion offline on this and we arrived at the point that it's common for people's observability tools and commands to treat each line as a new log entry. If we include new lines the log, the log might be split up into multiple log entries. When users who are unfamiliar with the particular log looks at the matching log line in this scenario, they might miss some information because they don't know how many lines are actually part of the same log entry.

@sampan-s-nayak sampan-s-nayak May 28, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my previous company we configured systems to emit logs as json and then ingested it into our system. And Ray does support structured logging for this same purpose https://docs.ray.io/en/latest/ray-observability/user-guides/configure-logging.html#configure-structured-logging-for-ray-core

I just feel using ; as a delimiter is very unusual and may look very hacky

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a good point. If we already support structured logging out of the box, we should just comfortably log newlines then.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember not every component supports structured logging. Especially the raylet, gcs, and driver, I recall those don't support it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the structural logging above only applies to workers, we do have env var that enables structural logging for raylet as well export RAY_BACKEND_LOG_JSON=1. I will keep the new lines.


To prevent this oversubscription and eliminate OOM issues, you can pass in a `memory` resource request to tasks or actors
to reserve a certain amount of memory for them to use. See :ref:`resource requirements <resource-requirements>` for more details.
Note that this does not impose any limits on memory usage and is used for scheduling only.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why we don't enforce these constraints, is it planned for future milestones?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was out of the scope of the current milestones. Per task/actor level resource isolation is planned for future milestones.

@Yicheng-Lu-llll Yicheng-Lu-llll self-assigned this May 28, 2026

@Yicheng-Lu-llll Yicheng-Lu-llll left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! Left some nits.

@bveeramani bveeramani self-assigned this Jun 3, 2026

@MengjinYan MengjinYan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice doc!! Just some nit comments and clarification questions.

**Idle worker policy:**

1. The memory monitor only considers workers that have never executed any tasks or actors (cold-start idle workers) for killing if their memory footprint exceeds the idle-worker killing memory threshold.
Cold-start idle workers should have a small memory footprint. In the unlikely case that the OOM logs show active workers being selected over idle workers while a large idle-worker memory footprint remains,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering do we differentiate the cold start idle worker and the not cold start idle worker in the OOM logs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't as of right now. All non-selected idle workers are simply aggregated into a single log line indicating the number of idle workers and their combined memory footprints.

In the current iteration of the killing policy, non-cold-start idle workers will always be killed before active workers regardless of their footprint. Thus, if the OOM log shows active workers being selected to be killed, it automatically means all idle workers aggregated into the idle worker log line must be cold-start idle workers.

@bveeramani bveeramani removed their assignment Jun 10, 2026
@edoakes
edoakes merged commit 2d52af2 into ray-project:master Jun 10, 2026
3 checks passed
limarkdcunha pushed a commit to limarkdcunha/ray that referenced this pull request Jun 30, 2026
…M issues (ray-project#63652)

## Description
We will be introducing a new memory monitoring system that will provide
enhanced stability under memory contention. This PR updates the user
guide documentations for how to leverage the new resource isolation mode
to protect critical ray systems to prevent node deaths and eliminate
OOMs.

## Related issues

## Additional information
New/modified high-level description of the memory monitoring system:
https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-core/scheduling/ray-oom-prevention.html
New/modified OOM debugging guide:
https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-observability/user-guides/debug-apps/debug-memory.html

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…M issues (ray-project#63652)

## Description
We will be introducing a new memory monitoring system that will provide
enhanced stability under memory contention. This PR updates the user
guide documentations for how to leverage the new resource isolation mode
to protect critical ray systems to prevent node deaths and eliminate
OOMs.

## Related issues

## Additional information
New/modified high-level description of the memory monitoring system:
https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-core/scheduling/ray-oom-prevention.html
New/modified OOM debugging guide:
https://anyscale-ray--63652.com.readthedocs.build/en/63652/ray-observability/user-guides/debug-apps/debug-memory.html

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
Signed-off-by: 400Ping <[email protected]>
@Kunchd
Kunchd deleted the RI_documentation branch September 10, 2026 21:58
dstrodtman added a commit that referenced this pull request Oct 7, 2026
…66790)

## Why are these changes needed?

The Ray Core style-pass stack, #66642 through #66677, flagged
pre-existing problems in the pages it edited and left them as written,
because a style pass shouldn't change claims. This PR fixes the ones
that don't change a technical claim. It's stacked on #66677, the top of
that stack, because it edits lines on pages across every layer.

Each fix is settled by the page itself, its own code sample, or a
renamed symbol:

- `configure.md`: the default worker port range 10002 to 19999 holds
9,998 ports, so the per-node worker maximum is 9,998, not 10,000.
- `user-spawn-processes.md`: the deprecation note told readers to enable
`process_group_cleanup_enabled`, which L19 of the same page says is on
by default.
- `type-hint.md`: the Pattern 2 sample uses `ray` and `ObjectRef`
without importing them.
- `actors/terminating-actors.md`: the front-matter description said
cleanup runs when `ray.shutdown` is called, which the page never says.
It now names the `__ray_shutdown__` method the page covers. The
`sys.exit` sentence sits below the Python, Java, and C++ tabs, so it now
scopes `sys.exit` to Python.
- `objects/object-spilling.md`: the CLI tab wrapped a `ray start` shell
command in a `{doctest}` fence. It's now `bash`.
- `patterns/nested-ray-get.md` and
`patterns/out-of-band-object-ref-serialization.md`: the front-matter
descriptions contradicted their page bodies ("serializes execution",
"can let its value be reclaimed early"). They now summarize what the
bodies say.
- `scheduling/memory-management.md`: the prose named a "Reference
Creation Site" column, but every `ray memory` sample on the page labels
it "Call Site". "In Ray 1.3 and later" is gone, since every supported
release is 2.x.
- `scheduling/ray-oom-prevention.md`: "how to address memory issues"
linked to a label left on the "Questions or issues?" section after
#63652 deleted the section it named. It now links to the out-of-memory
troubleshooting guide that #63652 expanded, and the orphaned label is
gone. Nothing else in `doc/source` targets it.
- `scheduling/resources.md`: the lead-in said the rules configure
"logical resources", but one rule in the list says object store memory
isn't a logical resource.
- `compiled-graph/overlap.md`: overlap "reduces" latency by about 14%,
rather than "improves" it. The page's output shows 1.0670 s to 0.9211 s.
- `compiled-graph/profiling.md`: NVIDIA's product is Nsight Systems. A
`(nsight-system-profiler)=` label keeps the old heading fragment
working.
- `internals/token-authentication.md`: two notes said that new HTTP
services must add the middleware and header injection themselves. The
first one goes, and the one in the "Adding token authentication to new
services" section stays.
- `examples/monte-carlo-pi.md`: the task takes exactly `num_samples`
samples, not "up to".
- `examples/index.md`: five link texts didn't match the titles of the
notebooks they link to. They now render the live titles.
- `internals/object-spilling.md`: "GCS" in the cloud storage passages
meant Google Cloud Storage, which reads as Ray's GCS on a Ray Core page.
`ReleaseFreedObject` is now `ReleaseFreedLocalObject`, renamed in
#63218. The two `PopDeleteWorker` links pointed at different lines of
`worker_pool.cc`, and the `blob/master` anchors had drifted. Those three
links are now pinned to a commit. The page's other `blob/master` links
have drifted too and need symbol-by-symbol remapping, which is left for
a follow-up.
- `internals/ray-event-exporter.md`: the Step 5 link text named
`AddEvent()`, but the function at the pinned commit and on master is
`AddEvents()`. The Step 6 `AggregatorAgent` link pointed at the default
event list, at the same anchor as Step 4, rather than the class.
- `internals/metric-exporter.md`: the `SetMetricValue()` link pointed at
a call site in `metric.cc`. It now points at the definition, which other
links on the page already use.

Not included: two typos in the `scheduling/labels.md` operator table,
curly quotes in code spans and "anything by one value", which sit on
lines that #66550 edits.

## Related issue number

None. Not a duplicate: I searched open PRs touching `doc/source/core/`
and `doc/source/ray-core/`. Open PRs editing these pages are this stack,
#66464 (Compiled Graph deprecation banners, on lines this PR doesn't
touch), and #66550 (left alone as described above).

## Checks

- Docs-only: every change is in a `.md` file under `doc/source/core/`,
so no library tests run.
- `vale` on the 18 changed files from the repo root: the same alerts as
the base branch, with none added.
- `codespell` on the changed files: clean.
- `doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py --check` on the
changed files: clean.
- Every link changed here was checked against the file at its pinned
commit, at the line it names.
- `pre-commit`: passed.
- Full `-W` doc build: relying on the Read the Docs preview.

AI assistance (Claude Code) was used to draft these edits. Draft until
the submitter has reviewed every changed line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants