Skip to content

[Data]Draft nstrumented PyArrow baseline for arrow-rs A/B release run - #65217

Closed
AarryaSaraf wants to merge 2 commits into
ray-project:masterfrom
AarryaSaraf:arrow-rs-ab-baseline
Closed

AarryaSaraf wants to merge 2 commits into
ray-project:masterfrom
AarryaSaraf:arrow-rs-ab-baseline

Conversation

@AarryaSaraf

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Draft PR to run release tests

AarryaSaraf and others added 2 commits August 4, 2026 14:37
…de USS

The release log's only memory metric is object-store peak, which can't see the
decode-side working set the arrow-rs migration is about. Add
`collect_operator_metrics(ds)` to benchmark.py: it walks the dataset stats and
emits, per operator, wall/cpu/udf time, output rows/bytes, and
`avg_max_uss_per_task_bytes` (per-task decode USS from
`extra_metrics["average_max_uss_per_task"]`, Linux-only), plus top-level `read_*`
convenience fields for the first Read operator. Wire it into
read_and_consume_benchmark's `benchmark_fn` so every read/count/iter/write run
carries the read operator's decode USS into the log — the metric that actually
answers the arrow-rs-vs-PyArrow memory question.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Aarrya <[email protected]>
Release tests currently report only total wall time and aggregate
object-store peak, which cannot attribute a memory change to the read
operator or see per-worker decode memory. This adds:

- MemoryProfiler: track max RSS alongside the existing max-USS estimate
  (same poll; memory_info() returns both). RSS counts shared pages
  (e.g. mapped object-store blocks) that USS excludes, so the pair
  separates a task's private working set from its OS-visible footprint.
- TaskExecWorkerStats.max_rss_bytes, populated by MapOperator next to
  max_uss_bytes.
- OpRuntimeMetrics: max_rss_bytes DistributionTracker plus
  max_uss_per_task / average_max_rss_per_task / max_rss_per_task
  metric properties (worst-task values, since the average can hide one
  task decoding an outlier file).
- benchmark.py collect_operator_metrics(): per-operator wall time,
  output bytes/rows, and avg/max USS/RSS per task merged into the
  release result JSON, with read_* top-level conveniences; wired into
  the wide_schema and read_from_uris benchmarks.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Aarrya <[email protected]>
@AarryaSaraf
AarryaSaraf requested a review from a team as a code owner August 4, 2026 21:52
@AarryaSaraf
AarryaSaraf marked this pull request as draft August 4, 2026 21:53

@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 introduces tracking and reporting of peak Resident Set Size (RSS) memory metrics alongside Unique Set Size (USS) memory across Ray Data tasks. This includes updating the memory profiler to sample RSS, exposing RSS metrics in operator runtime metrics and task execution statistics, and integrating these metrics into benchmarks and tests. The review feedback suggests a performance optimization in the memory profiler to avoid redundant system calls when querying USS and RSS metrics back-to-back.

Comment on lines +1775 to +1776
with self._max_uss_lock:
self._sample()

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.

medium

In map_operator.py, estimate_max_uss() and max_rss() are called back-to-back at the end of each task. Since estimate_max_uss() already forces a synchronous _sample() call (which queries psutil.Process().memory_info(), a relatively expensive system call), calling _sample() again in max_rss() results in a redundant system call.

By only calling _sample() if self._max_rss is None, we avoid this duplicate system call while still ensuring at least one final sample is taken.

Suggested change
with self._max_uss_lock:
self._sample()
with self._max_uss_lock:
if self._max_rss is None:
self._sample()

@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 using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0aa5c69. Configure here.


out: Dict[str, Any] = {"operators_detail": []}
try:
summary = ds.get_stats_summary(detail=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Timed benchmarks include metrics collection

Medium Severity

collect_operator_metrics calls get_stats_summary(detail=True), which triggers a Ray State API list_tasks scan, even though scheduling overhead is never used. Call sites invoke this inside Benchmark.run_fn, so that overhead is folded into reported runtime and can skew the PyArrow vs arrow-rs A/B comparison.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0aa5c69. Configure here.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Aug 19, 2026
elliot-barn added a commit that referenced this pull request Aug 21, 2026
Two findings from surveying the sibling arrow-rs PRs (#65217, #65406, #65407),
which the first pass missed:

* #65406 patches the third-party parquet crate
  (patches/parquet-59.1.0-dict-reserve.diff, applied by vendoring the registry
  source and pointing [patch.crates-io] at it from a build-local
  .cargo/config.toml). Fine for an experiment, but if the patch is load-bearing
  for the numbers it becomes a standing fork requirement -- which a dedicated
  repo can carry properly and the Ray tree cannot, particularly on top of an
  uncovered crates.io fetch. It also costs Cargo.lock its parquet checksum
  line, weakening the reproducibility the committed lock is there to provide.

* The missing py_test target is not a one-draft oversight: #65406's BUILD.bazel
  patch contains zero arrow_rs mentions either. Across the whole effort the
  2,643-line test file has never been registered with Bazel.

Signed-off-by: Elliot Barnwell <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

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!

@github-actions github-actions Bot closed this Sep 2, 2026
@AarryaSaraf
AarryaSaraf deleted the arrow-rs-ab-baseline branch September 8, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant