cswork / libraryOpen practice workspace

Articles

AWS EMR Interview Questions: Core vs Task Nodes, Failed Steps, and Safe Scale-Down

Practice AWS EMR interview questions on core vs task nodes, failed-step evidence, HDFS replica capacity, graceful scale-down and output-safe retries.

AWS EMR interview questions often sound like capacity questions: “Can we remove two nodes?” or “Should we rerun the failed step?” Both decisions depend on where data lives, which process failed, and whether the previous attempt already produced output.

Classify the failure before choosing the recovery. Core-node loss, task-node loss, a failed application and a failed cluster are different events.

Official behavior here comes from AWS EMR documentation and Apache Hadoop/Spark references. Cluster names, times, capacities and output ledgers are original exercises. The scope is EMR on EC2 with YARN and HDFS; do not transfer this node model automatically to EMR Serverless or EMR on EKS.

AWS EMR interview questions: distinguish node roles

AWS’s node-type guide describes core nodes as running HDFS DataNodes as well as computation. Task nodes provide computation without storing HDFS data. The primary node manages the cluster and runs management components such as the YARN ResourceManager and HDFS NameNode in the documented architecture.

Node roleInterview-relevant responsibilityFailure question to ask
PrimaryCluster management and application coordination servicesWhich service or application lost its coordinator?
CoreHDFS storage plus computeWhich blocks and processes depended on this node?
TaskAdditional compute, without HDFS DataNode storageWhich tasks, cached data or local intermediate files need recovery?

“Task nodes hold no data” is an imprecise answer. The official distinction is about HDFS storage. In our exercise, a Spark executor writes intermediate files on its task node. Removing that node loses those local files even though the node is not an HDFS DataNode.

Similarly, do not say every primary-node failure must destroy every EMR cluster. The node guide describes a multiple-primary high-availability configuration. Ask for the actual topology before asserting that one failure is fatal.

Ask where the application master and driver run

The AWS node guide documents release-dependent YARN node-label behavior. In the EMR 6.x series, labels are disabled by default and application processes can run on core or task nodes. The 7.x discussion includes market-type labels and configurable placement. “The application master always runs on core nodes” is therefore not a safe universal claim.

Apache Spark’s YARN guide separately distinguishes deploy modes: in cluster mode the driver runs inside the YARN application master process; in client mode the driver runs in the client process. Node role alone does not locate the driver.

Our original interview checklist asks for release label, effective node-label configuration, deploy mode, application ID and driver location. These observations determine whether a lost machine removed an executor or the application’s coordinating process. That changes both the available logs and the restart plan.

For example, losing executor T2 while the cluster-mode driver remains on C1 permits a different investigation from losing an application master placed on T2. The words “Spot task node interrupted” are not enough to distinguish them. Read the effective configuration and application records rather than assuming defaults from a remembered older release.

Work through a task-loss timeline

Assume this original cluster has four core nodes C1–C4 and four task nodes T1–T4. The input is recoverable from durable object storage; one running stage has intermediate shuffle files on T2. The driver and application master remain available on C1.

09:00  Step s-example starts application application_example_001
09:12  T2 disappears; its executor and local shuffle files disappear
09:13  Application logs report missing shuffle output and retry work
09:18  Stage completes after recomputation
09:20  Output validation completes; step reports success

This is a synthetic exercise, not an AWS log transcript or a guaranteed recovery duration. Its conclusion is that node loss caused additional work but did not, in this timeline, make the step fail. Calling the entire cluster failed would contradict the last two observations.

Now alter the evidence. Suppose the application exhausts retries, or the remaining nodes cannot allocate the required containers. The same lost node can become a step failure. Suppose the application master also disappears: now application-attempt recovery matters. Keep those possibilities separate instead of claiming that task nodes are always safe to interrupt.

Explain the performance consequence too. More retries can increase latency, disk use and network traffic even when final results remain correct. A cost-saving scale-down that repeatedly invalidates work may increase total runtime. Your recommendation should compare observed recovery work with the capacity saved, without inventing a percentage improvement.

Diagnose core loss with block placement, not node count alone

Hadoop’s HDFS user guide explains replication and decommissioning. For our original example, explicitly set the replication factor to two; this is an exercise configuration, not a claim about EMR’s default.

BlockRecorded replicas before the changeAfter immediate loss of C3 and C4
B1C1, C2Two replicas remain
B2C2, C3One replica remains
B3C3, C4No recorded replica remains

You cannot conclude “two nodes remain, so replication two is satisfied.” Replication is a property of each block’s placement. B3 loses both recorded copies in the immediate-loss scenario. B2 remains available in this ledger but has reduced redundancy.

Next distinguish temporary HDFS work from the source of truth. If B3 is regenerable from a versioned input, recovery may require restarting work. If it is the only copy of important data, the consequences are different. Ask what was backed up and what can be reconstructed before choosing to discard the cluster.

The exercise also shows why a sequence matters. Losing C3, repairing B3 onto C1, and then losing C4 is different from losing both before repair. A cluster count without a placement and time ledger hides this distinction.

Evaluate scale-down against storage and running work

AWS’s scale-down guide describes graceful decommissioning, HDFS capacity constraints and task-completion behavior. It also warns that explicit EC2InstanceIdsToTerminate in modify-instance-groups terminates instances immediately. Do not describe that operation as a normal graceful resize.

Continue our original example. Suppose each core node has 1 TB of usable HDFS capacity, and the cluster holds 1.5 TB of logical data at replication two. Ignore metadata overhead for this arithmetic exercise: the replicas occupy approximately 3 TB.

Scaling four core nodes down to two leaves 2 TB of capacity. Even perfectly redistributed blocks cannot fit 3 TB into 2 TB. Scaling to three leaves no headroom under these assumptions. A safe plan must also account for growth, temporary writes and the real filesystem’s usable capacity.

This arithmetic does not predict the exact service response. It rejects an unsafe proposal before you depend on a service guardrail. Our recommendation is to inspect actual HDFS usage, replication health, decommission progress and ongoing writes, then use the supported resize path for the release and cluster configuration.

AWS documents another easily missed detail: for its specified graceful-decommission timeout property, -1 means immediate decommissioning, unlike open-source YARN’s indefinite-wait interpretation. Copying a familiar configuration value across systems can therefore produce the opposite policy. Read the release-specific behavior instead of treating “graceful” as a universal guarantee.

Trace a failed step to an application and its logs

AWS’s DescribeStep API returns step configuration and status, including failure details and timeline fields. The logging guide identifies step logs on the primary node under /mnt/var/log/hadoop/steps/ and distinguishes them from application/component logs.

Our original investigation starts with this compact record:

cluster:   j-example
release:   recorded from cluster configuration
step:      s-example, FAILED
command:   recorded JAR/script and arguments
app:       application_example_001
first cause: executor stderr reports malformed input at partition 17
output:    attempt-1 files exist; publish status unresolved

The malformed-input row is an exercise assumption. It makes blind capacity increases a weak next action: more nodes do not correct the same bad record. Confirm the first relevant exception, input identity and parser behavior before retrying.

If the record instead shows a resource shortage or lost node, correlate it with cluster and application events. Keep the first causal failure separate from cleanup errors. A later “unable to delete temporary directory” message can be real without explaining why processing originally stopped.

Also confirm that the logs you need survived. AWS’s logging guide describes different archiving behavior for releases through 6.8 versus 6.9 and later. Record the actual release and logging configuration; a dead node’s local path is not evidence that its logs are still accessible.

Explain what ActionOnFailure does and does not do

The official StepConfig reference distinguishes CONTINUE, CANCEL_AND_WAIT and TERMINATE_CLUSTER. It also documents restrictions when step concurrency exceeds one. These are workflow actions, not instructions to repair the failed application or roll back its output.

For a sequential exercise, CONTINUE can permit the next queued step to run. If that next step consumes the failed step’s partial output, continuing may be inappropriate even though the option is valid. Define the dependency gate separately.

If several steps run concurrently, read the documented restrictions instead of assuming that one failed step cancels every dependent action. Ask how the orchestrator prevents a consumer from reading an unpublished attempt. A step’s display status and a dataset’s publish status need different evidence.

The interview answer should connect the selected policy to the workload. A debugging cluster may remain available for inspection. A disposable batch cluster may terminate after failure. Neither choice makes duplicate external effects disappear.

Make step retries reviewable at the output boundary

Our original retry ledger separates execution from publication:

Previous attemptEvidence required before retryProposed recovery
Failed before writingConfirm no external effect or output commitRetry after fixing the cause
Wrote attempt-scoped files, unpublishedIdentify those files and their ownerWrite a new attempt; publish only validated output
Published output, then status acknowledgment failedRead the publication record and expected contentsReconcile completion before rerunning effects
Appended records to a shared destinationCheck stable keys and duplicate policyUse explicit deduplication or an idempotent write contract

These are design recommendations, not built-in EMR exactly-once guarantees. A retry should use stable input identity and a clear output ownership rule. Attempt-specific paths alone do not prevent duplicates if two attempts can both publish.

For the exercise, have a validation step check row counts, schema and selected business invariants before marking the dataset consumable. Record which attempt published it. If the destination needs a transactional catalog operation, use its documented commit mechanism; do not assume that renaming objects in storage provides an atomic dataset transaction.

Then rehearse two failures: processing stops before publication, and publication succeeds before the client observes success. The recovery decisions should differ. This is the part of an EMR answer that connects infrastructure knowledge to reliable data delivery.

Sources and Further Reading