Protecting an 8-hour ETL window from 40 analysts

The business requirement was one sentence: gold tables refreshed by 10:00 every morning. The engineering reality was that the same cluster ran the ETL and, since the analysts discovered notebooks, forty private Spark applications from 08:00 onwards. On a bad day the pipeline finished at 13:00. Nobody had decided that analysts could take the ETL's memory; it simply had nothing stopping them.

This is the P2 decision in a proof of concept I built for an Iceberg warehouse (repository): do ETL and analytics share compute, and what protects the window? The client and the numbers are a synthetic scenario, but the shape of the problem is the one every lakehouse team meets in its second year.

The failure mode today

The ETL is about eight hours of Spark on YARN when it has the cluster to itself (02:00 to 10:00). It overlaps with analysts for the last two hours. A linear model is enough to see what contention does to the finish time:

analyst share of ETL capacity during the overlapETL slowdownfinish
0% (separate cluster, or no overlap)none10:00
15% (managed interactive queue at its guarantee)+20 min10:20
40% (today: unmanaged sessions from 08:00)+1.6 h11:40
60% (dashboards at 09:00 plus one heavy ad-hoc scan)+3 h13:00

The model is crude on purpose. The point is that the difference between "slightly late" and "lunchtime" is entirely about whether analyst load is bounded.

ETL finish time vs. analyst share of ETL capacity (02:00 start, 8 h uncontended) 13:0011:3010:0008:00 0 %10:00 15 %10:20 40 % (today)11:40 60 %13:00 objective: gold by 10:00
Hours lost to contention are linear in the share analysts take; the objective line is what the SLO defends.

Separate cluster, queues, night window, or all three

Four options were on the table, and each has a real weakness:

  • Separate clusters. Perfect isolation, independent sizing, and double the hardware for a cluster that is already memory-bound at 1.3 GB per core. Two HDFS clients, and either remote reads or data copies.
  • One cluster with YARN queue isolation. No new hardware; capacity guarantees plus preemption; works for Kyuubi engines because they are Spark applications. Queues share disks and network, preemption kills executors rather than pausing them, and Trino is not a YARN application at all.
  • Time-window scheduling. Run the ETL at night and most of the contention disappears. But the last two hours still overlap with analysts, and a late source delivery breaks the assumption on exactly the days it matters.
  • A combination. Each mechanism covers the others' gaps, at the cost of more policy to maintain.

I chose the combination, because none of the single answers survives its own weakness.

Guarantees versus preemption

The YARN side is a capacity-scheduler layout with four queues. The ETL queue gets a 60% guarantee and may grow to 100% between 02:00 and 08:00, when analysts are absent. The interactive queue, where Kyuubi's analyst engines land, gets 30% with a 60% maximum and is preemptable above its guarantee. A small adhoc_heavy queue (5%, up to 30%) takes the deliberately tagged heavy queries, and admin keeps 5% that is never preempted.

The guarantee is what caps analyst contention at the 15% row of the table: during the overlap the interactive queue holds its 30% and half of that is typically in use. Preemption is the backstop for the morning a dashboard refresh lands at 09:00 while the ETL is still in its last gold rebuild. It is slow (seconds to minutes, and it kills executors, not drivers), which is why it is the backstop and not the plan.

Kyuubi's own levers sit on top: engines mapped to queues per user, a per-engine executor cap, result-size and row caps so a careless SELECT * cannot hold a driver's memory, and a fifteen-minute default statement timeout. Kyuubi has no cluster-wide query queue; YARN is the enforcement point and Kyuubi is where you express the mapping.

Why Trino's memory budget living outside YARN matters

The second half of the answer is the primary engine. Trino is not scheduled by YARN, so its memory is reserved on each node before YARN gets its share: 3 GB per worker on the baseline cluster, 36 GB in total. Analysts on Trino consume a budget the ETL never had, and the only resource the two still share is HDFS I/O and the network. Admission is handled by Trino's resource groups: twelve concurrent interactive queries across the cluster, three per user, heavy queries in a group of two, everything else queued rather than failed.

That separation is the quiet reason the POC favoured Trino as the analyst-facing engine. It is not only faster at the median; it is structurally unable to take the ETL's executors.

The SLO and the alert that defends it

A window is only protected if someone is measuring it. The objective is written down as a service objective: gold refreshed by 10:00 on 99% of days per month. Two signals defend it. The first is an alert when any ETL stage's duration exceeds its trailing seven-day p95 by 25%, which catches contention while the run is still in progress rather than at 11:40. The second is YARN's pending-container count on the interactive queue, which tells you whether analysts are waiting (acceptable) or whether the guarantee is being breached (not).

The benchmark plan carries the matching test: run the forty-analyst workload while a representative ETL stage executes, and fail the plan if the ETL runtime grows by more than 10% or finishes after 10:00. That is the one benchmark step the laptop cannot run and the one that answers the question this post is about. It is specified for the staging cluster, with the pass criteria written before the run.

What I took from it

  1. Put a number on contention before choosing an isolation mechanism. "Analysts slow the ETL" becomes a decision only when it is "40% contention means 11:40".
  2. Guarantees bound the normal day; preemption rescues the bad one. You need both, and you should expect preemption to be slow.
  3. Prefer serving engines whose memory does not come out of the ETL's pool. Isolation by construction beats isolation by scheduler.
  4. Write the SLO and the alert before the first production day. A window without a measurement is a hope.