Lesson 5 of 10Platform levers3 min read

EMR managed scaling and idle Spark capacity

EMR managed scaling adds and removes cluster instances based on workload, which trims idle capacity without a new product. It needs EMR 5.30.0 or later (not 6.0.0) and works only with YARN applications such as Spark. It decides how many nodes you have; it does not decide how well each node is used, which is where capacity optimizers come in.

By The Meter DeskSpark Cost ComparePublished

What is idle capacity?

A Spark cluster sized for its busiest hour carries spare nodes the rest of the day. Within a busy hour, nodes can also sit partly idle: memory is reserved for containers that use less than they asked for, or CPU waits on shuffle reads. Both kinds are paid for on per-second billing.

What does managed scaling do?

AWS describes EMR managed scaling as a feature that "lets you automatically increase or decrease the number of instances or units in your cluster based on workload", to "optimize your clusters for cost and speed". You set minimum and maximum limits; EMR adjusts within them.

Two constraints from the documentation:

  • It requires EMR 5.30.0 or later, except 6.0.0. AWS recommends the latest release; at the time of reading that was 7.14.0.
  • It "only works with YARN applications, such as Spark". Spark on EMR qualifies.

What does managed scaling not do?

It changes the number of nodes, based on the demand YARN sees. If containers reserve more memory than they use, YARN sees the reservation, not the use, and may add nodes that would not be needed if each node were packed more tightly. Managed scaling does not change how much each task asks for or how long it runs.

Where do capacity optimizers fit?

Pepperdata Capacity Optimizer works on that gap. Its FAQ says it gives "the system scheduler real-time visibility into actual CPU, GPU, and memory utilization levels", which "allows the scheduler to launch more containers per node". It also "augments the autoscaler to prevent the addition of new nodes until the existing nodes have been optimized", and works with YARN and Kubernetes autoscalers and Karpenter. In other words it sits alongside the autoscaler, not in place of it.

Cost tools that tune job settings, such as Definity and Unravel, act on the other side: how much each job asks for.

How do you see whether scaling is working?

Look at cluster utilization over a week: allocated vCPU and memory against what YARN reports as used, and node count against pending containers. Flat high node counts with low utilization point to idle capacity. Frequent scale-out with long pending times point to limits set too low. Change one limit at a time and compare cost per run against your baseline from lesson 1.

Does it work with accelerators?

Managed scaling is a platform feature and works whatever engine you run. An engine that shortens jobs leaves more of the day with low demand, so scaling and acceleration tend to reinforce each other. If an engine needs a particular instance family, set the scaling limits in that family.

Sources