feat(presto): add --cache-mode for reproducible cold/hot/lukewarm benchmark runs #419
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #419"
general
weight: 0.35
patdevinwilson
What
Adds
--cache-mode {lukewarm,hot,cold}to the Presto TPC-H/TPC-DS pytestbenchmark harness (
run_benchmark.sh), so cache-reset behavior for cold-IObenchmarking is explicit and correct, instead of an accidental side effect
of a single session-start OS-cache drop.
Why
The harness reported a
Lukewarm(ms)column (iteration 0's raw time) nextto
Hot(ms)stats (iterations 1..N-1), but the only automatic cache resetwas a single OS page-cache drop at the very start of the whole pytest
session — presto-native's own Velox memory/SSD cache and the Hive
connector's file-handle cache were never cleared at all. So "Lukewarm" was
only meaningfully cold for the very first query of a run; every later
query's "Lukewarm" number silently rode on whatever cache warmth earlier
queries left behind — not comparable across queries, query order, or runs.
The modes
Adapted from @kjmph's c5a43f9, which contributed the
cold-onceshape, the idle-cluster check, exact success-body matching, and concurrent clears.| Mode | Reset schedule | What gets reported |
|---|---|---|
|
off(default) | Legacy behavior: OS page-cache drop once, no worker cache clearing. The only mode Java workers support. |Lukewarm(ms)+Hot(ms)— unchanged from today ||
lukewarm| Full reset once, before the first measured query. |Lukewarm(ms)+Hot(ms)||
cold-once| Full reset before each query's iteration group. |Cold(ms)(iteration 0) +Hot(ms)(the rest) ||
cold| Full reset before every iteration. |Cold(ms)aggregates only ||
hot| No resets. First--warmup-iterationsprime the cache. |Hot(ms)aggregates only — warm-ups never reported |Cache clearing hits presto-native's
/v1/operation/{connector,server}/clearCacheREST endpoints (GET, per
PrestoServer.cpp'sregisterGet— not POST, which404s) on every worker discovered via the coordinator's
/v1/node, concurrently,followed by the OS page-cache drop.
Resets fail closed. The cluster must be idle before and after
(
AsyncDataCache::clear()keeps pinned entries, so clearing mid-query is onlypartly cold), every worker must be cleared, and responses are matched against the
exact success body — the endpoint answers
200withNo memory cache set onfor no-ops, so trusting the status code reports warm numbers as cold.server
A tier that simply isn't configured is reported, not failed: this repo's GPU
worker ships without an AsyncDataCache, so cold modes there control the
file-handle and OS page caches only. The run metadata records the layers actually
cleared, so it can't claim a reset that never happened.
Known limitation:
drop_cache()writes/proc/sys/vm/drop_cacheson the hostrunning pytest only. That covers workers sharing that kernel (the single-node
Docker setup this was tested on), but does nothing for remote workers — so
coldnumbers from a multi-node cluster are not truly cold. A real per-worker drop would
be a follow-up.
New flags
--cache-mode {off,lukewarm,cold-once,cold,hot}(defaultoff)--warmup-iterations N(default1) — leading iterations per query that prime the cache and are excluded from the aggregate stats. Validated at startup: must be>= 0and< --iterations.--connector-id ID(defaulthive) — the catalog to clear. The connector type is alwayshive: native'sclearConnectorCacheonly implementsname == "hive"andVELOX_USER_FAILs on anything else.Compatibility
off, which is behaviorally identical to today: OS page-cache drop once, no worker clearing, same reported columns, noCache Mode:line. Existing baselines and Java clusters are unaffected.lukewarm/cold-once/coldrequire native workers; the run fails fast with a clear message onpresto-java.Cache Mode:/cache_mode/cache_reset_layersappear in the report and JSON context only for non-offmodes (post_results.pyfilters context to known fields, so the extra keys are ignored there).spark_glutennever registers--cache-mode, so its report stays byte-identical.Testing
common/testing/cache_mode_reporting_test.py(new, 16 cases): header/stat shape invariants across all modes and iteration counts, per-mode column expectations, thespark_glutenunregistered---cache-modefallback, and degenerate inputs (failed queries,--warmup-iterations >= --iterations). Matches the existing*_test.pyconvention incommon/testing/; like its siblings there it is run manually, not by CI.--connector-id: the run now aborts with aRuntimeErrorand reportsNULLinstead of printing plausible-lookingCold(ms)numbers from caches that were never cleared.presto/testing/cache_reset_test.py(new, 3 cases): all-workers-cleared succeeds and strips the/v1/statussuffix, partial clear raises, no-nodes raises.