Skip to content

presto: size worker memory from MemTotal, add worker nofile ulimits, cap drivers per task at 255 - #425

Open
karthikeyann wants to merge 3 commits into
rapidsai:mainfrom
karthikeyann:tpchbench-hostfixes
Open

karthikeyann wants to merge 3 commits into
rapidsai:mainfrom
karthikeyann:tpchbench-hostfixes

Conversation

@karthikeyann

@karthikeyann karthikeyann commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Host-size problems found while running the harness on larger machines (2.3 TB RAM, 256 cores) with the benchmark automation in knataraj's benchmarks repo. All fixes are general, not machine-specific.

1. generate_presto_config.sh: size from MemTotal, not lsmem

RAM_GB came from lsmem's online memory, which includes the memory the kernel reserves for itself. pbench turns that into system-memory-gb (~98.5%), and Velox's MmapAllocator maps that whole amount in one anonymous mmap. Under the default heuristic overcommit (vm.overcommit_memory=0) the kernel refuses a single mapping larger than MemTotal + SwapTotal, so on a host with no swap and a kernel reservation above the 1.5% headroom the worker aborts at startup:

Could not allocate working memory mmap failed with Cannot allocate memory for sizeClass 1

Observed on a 4U 8x RTX PRO 6000 box: lsmem 2306 GiB, MemTotal 2267.2 GiB, requested 2271 GiB. The same gap exists on every host measured (128 vs 125 GiB, 495 vs 482 GiB); smaller hosts survive only when swap or rounding happens to cover it.

Change: RAM_GB from /proc/meminfo MemTotal; PRESTO_MEMORY_GB and PRESTO_NPROC override the detected values (useful for benchmark drivers and for reproducing a smaller host). The generation banner says when an override is in effect.

2. docker-compose.native-gpu.yml.jinja: nofile ulimit for the worker

The worker's ulimits set memlock and stack but not nofile; the nofile: 500000 that exists sits under the sccache build block and never reaches the runtime container, which therefore runs with Docker's default 1024 descriptors. On the 256-core host the worker dies at startup:

Failed to create eventfd for AtomicNotificationQueue: Too many open files

Change: nofile: {soft: 500000, hard: 500000}, the value the sccache build blocks already use.

3. generate_presto_config.sh: cap task.max-drivers-per-task at 255

vcpu_per_worker becomes task.max-drivers-per-task, and a Velox hash join build merges one hash table per driver and supports at most 255 of them. On the 256-core host every hash join failed, base TPC-H Q3 included:

1 + otherTables_.size() <= std::numeric_limits<uint8_t>::max() (256 vs. 255)

Change: VCPU_PER_WORKER is capped at 255 (GPU workers default to 2 and are unaffected).

4. docker-compose.native-cpu.yml: nofile ulimit for the CPU worker

Same problem as (2) for the CPU worker, which also ran with Docker's default 1024 descriptors and died at startup on the 256-core host. Change: the same nofile: {soft: 500000, hard: 500000}.

(3) and (4) were split out of #431 (TPC-Havoc), which needed them to run on that host.

Testing

  • Config generation on a 2306 GiB / 256-core host now yields system-memory-gb=2233 (< MemTotal) and the worker registers.
  • With (3) and (4) on the 256-core host, the native CPU worker starts (it holds ~2300 descriptors when idle), gets task.max-drivers-per-task=255, and TPC-H Q3 and Q18 plus their TPC-Havoc variants pass at SF10.
  • Unchanged behaviour on a 128 GiB workstation apart from system-memory-gb 120 -> 118.

@karthikeyann
karthikeyann requested a review from a team as a code owner September 17, 2026 02:34
@copy-pr-bot

copy-pr-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@karthikeyann karthikeyann changed the title presto: size worker memory from MemTotal (overridable) and give the GPU worker a nofile ulimit presto: size worker memory from MemTotal, add worker nofile ulimits, cap drivers per task at 255 Oct 12, 2026

@misiugodfrey misiugodfrey 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.

The configuration changes look good. I want to raise a potential issue with the scale-factor override that was added. I think we want to make sure that the override can't be used while a metadata.json file exists (or at least verify it matches) or else we are opening the door to potential mismatches between what is run and what is reported.

-o, --output-dir Directory path that will contain the output files from the benchmark run.
By default, output files are written to "$(pwd)/benchmark_output".
-i, --iterations Number of query run iterations. By default, 5 iterations are run.
--scale-factor Scale factor of the data set (e.g. 1000). Passed straight to pytest so Q11's

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.

I'm a little concerned that adding this option can lead to potential mismatches with the underlying data.

Currently the scale-factor is override-able via the pytest option, but that's not plumbed through the entire process as the expectation is that we obtain the scale-factor from the metadata.json file as a Single-Source-of-Truth. Notably, the benchmark_result.json file reports the scale_factor based on the metadata.json file and is unaffected by this override.

Two cases interest me in using this override:

  1. No metadata.json file exists that is readable immediately (S3 case).
  2. metadata.json file exists and has different values from the override.

For case 1:
The override allows us to run the benchmark, and properly inserts the scale-factor into Q11's calculations, but the benchmark_result.json file that is generated is missing the scale_factor attribute. This unblocks the run, but could lead to some confusion - particularly when uploading benchmark results as I believe this values is read as part of that.

For case 2:
This case leads to an actual problem, because the override is inserted into Q11, but the benchmark_result.json reports the scale_factor based on the metadata.json file - so we are not running what the report says we are running.

While we could plumb the override all the way through such that the metadata.json file is fully ignored when we use it, but I think we should always be using the metadata.json file as a source of truth if it exists (overriding it is a dangerous game and we should probably override it in the meetadata.json file itself rather than as an option). To that end, I think adding a check in the code such that if an override is specified, and a metadata.json file exists, then the values must match or we will error out. This would allow us to use this approach for the S3 case (albeit with the onus on the user to get the scale_factor correct) but prevents the mismatch cases for local datasets.

karthikeyann and others added 3 commits October 15, 2026 06:22
…PU worker a nofile ulimit

- generate_presto_config.sh: RAM_GB from /proc/meminfo MemTotal instead of lsmem online
  memory (lsmem counts the kernel's own reservation; Velox maps system-memory-gb in one mmap
  that the kernel refuses under heuristic overcommit when it exceeds MemTotal, observed on a
  2306 GiB host: 2271 GiB requested vs 2267 GiB MemTotal). PRESTO_MEMORY_GB / PRESTO_NPROC
  override the detected values.
- docker-compose.native-gpu.yml.jinja: the worker's ulimits set memlock and stack but not
  nofile, so the container ran with Docker's default 1024 descriptors and aborted on a
  256-core host (Too many open files). Same value the CPU compose file uses.
get_scale_factor() derives the scale factor from a metadata.json next to the
tables' external location; with s3:// locations that lookup fails ("External
location '' ... does not exist"). The pytest option already exists; expose it.
…ulimit

- generate_presto_config.sh: vcpu_per_worker becomes task.max-drivers-per-task,
  and a Velox hash join build supports at most 255 drivers. On a 256-core host
  every hash join failed, base TPC-H Q3 included:
    1 + otherTables_.size() <= std::numeric_limits<uint8_t>::max() (256 vs. 255)
- docker-compose.native-cpu.yml: the CPU worker gets the nofile limit the
  previous commit gave the GPU worker. It also ran with Docker's default soft
  limit of 1024 and died at startup on that host ("Too many open files").

@patdevinwilson patdevinwilson 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.

The MemTotal sizing and runtime nofile limits address the large-host startup failures directly, and the 255-driver cap is easy to follow. I agree with the scale-factor concern already raised: Q11 and the result metadata need to use the same value, with a mismatch rejected when metadata.json exists. I'd either resolve that here or move the override into a separate change so the resource fixes can land on their own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants