Repository navigation
presto: size worker memory from MemTotal, add worker nofile ulimits, cap drivers per task at 255 - #425
presto: size worker memory from MemTotal, add worker nofile ulimits, cap drivers per task at 255#425karthikeyann wants to merge 3 commits into
Conversation
misiugodfrey
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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:
- No metadata.json file exists that is readable immediately (S3 case).
- 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.
…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").
d80caa6 to
e0b3d43
Compare
patdevinwilson
left a comment
There was a problem hiding this comment.
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.
Host-size problems found while running the harness on larger machines (2.3 TB RAM, 256 cores) with the benchmark automation in knataraj's
benchmarksrepo. All fixes are general, not machine-specific.1.
generate_presto_config.sh: size fromMemTotal, notlsmemRAM_GBcame fromlsmem's online memory, which includes the memory the kernel reserves for itself. pbench turns that intosystem-memory-gb(~98.5%), and Velox'sMmapAllocatormaps that whole amount in one anonymousmmap. Under the default heuristic overcommit (vm.overcommit_memory=0) the kernel refuses a single mapping larger thanMemTotal + SwapTotal, so on a host with no swap and a kernel reservation above the 1.5% headroom the worker aborts at startup: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_GBfrom/proc/meminfoMemTotal;PRESTO_MEMORY_GBandPRESTO_NPROCoverride 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:nofileulimit for the workerThe worker's
ulimitssetmemlockandstackbut notnofile; thenofile: 500000that 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:Change:
nofile: {soft: 500000, hard: 500000}, the value the sccache build blocks already use.3.
generate_presto_config.sh: captask.max-drivers-per-taskat 255vcpu_per_workerbecomestask.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:Change:
VCPU_PER_WORKERis capped at 255 (GPU workers default to 2 and are unaffected).4.
docker-compose.native-cpu.yml:nofileulimit for the CPU workerSame 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
system-memory-gb=2233(< MemTotal) and the worker registers.task.max-drivers-per-task=255, and TPC-H Q3 and Q18 plus their TPC-Havoc variants pass at SF10.system-memory-gb120 -> 118.