Lesson 3 of 3 Amazon EMR

Choosing EMR Engines, Node Types and Storage

This lesson explains how to choose the right engine, storage layer and cost-efficient cluster shape for a workload on EMR, which runs many open-source engines and gives control over node types and storage on EC2.

Learning outcomes

After completing this lesson, you will be able to:

  • Choose an engine for a workload.
  • Choose between HDFS and EMRFS on Amazon S3.
  • Shape a cluster's node types for cost.

Engines

An EMR cluster can run several open-source engines, each suited to particular work. Apache Spark is the general-purpose engine for batch ETL, machine learning and SQL on large data, and Structured Streaming adds stream processing. Apache Hive, running on Tez, processes SQL in batches and is the natural target when migrating existing HiveQL. Trino and Presto run interactive, low-latency SQL across many sources.

Apache HBase is a wide-column store for fast random reads and writes on very large tables. Apache Flink handles stateful stream processing with event-time semantics. The table formats Iceberg, Hudi and Delta Lake add transactional tables on S3, with updates, deletes and time travel. The following table summarises the engines.

EngineBest for
Apache SparkBatch ETL, machine learning, and SQL on large data; also Structured Streaming
Apache Hive (on Tez)SQL batch processing, especially migrating existing HiveQL
Trino / PrestoInteractive, low-latency SQL across many sources
Apache HBaseRandom, low-latency reads and writes on very large wide tables
Apache FlinkStateful stream processing with event-time semantics
Iceberg, Hudi, Delta LakeTransactional tables on S3 with updates, deletes and time travel
Match the pairs

EMR engines

Exam skills 1.2.5

Match each workload with the EMR engine that fits it.

Log in to try this activity Interactive activities are free with an account.

Storage: HDFS or S3

HDFS lives on core nodes' disks: fast and local, but lost when the cluster terminates. EMRFS reads and writes S3 directly: durable and shared, so clusters can be transient and storage scales independently of compute. Most designs keep data in S3 and use HDFS only for intermediate data. Use the Glue Data Catalog as the Hive metastore so tables outlive any cluster and are shared with Athena and Glue.

The following diagram compares what remains when a cluster terminates.

What survives when a cluster terminates. Data in HDFS lives on core nodes' disks and is lost with the cluster. Data in S3, read through EMRFS, with tables in the Glue Data Catalog as the Hive metastore, outlives every cluster and is shared with Athena and Glue, which makes transient clusters possible.
HDFS can still hold intermediate data during a job.
Sort into groups

HDFS or EMRFS?

Exam skills 2.1.1 · 1.4.10

Decide which storage each statement describes.

Log in to try this activity Interactive activities are free with an account.

Node types and cost

An EMR cluster has three node types with different roles. The primary node coordinates the cluster and its applications; long-running clusters use three primary nodes for high availability. Core nodes run tasks and store HDFS data, so losing one can lose data, which is why core nodes use On-Demand capacity. Task nodes only run tasks and store no HDFS data, which makes them ideal for Spot Instances: losing one costs only the work in progress.

Instance fleets mix instance types and purchase options, and managed scaling resizes the cluster to the workload. Transient clusters start, run their steps and terminate, which suits scheduled batch jobs, while long-running clusters suit interactive analysis and applications such as HBase that need to stay available.

Worked example

A company runs a nightly 3-hour Spark job on a permanently running EMR cluster that is idle the rest of the day. Data is in HDFS. It wants to cut cost significantly without rewriting the job.

Move the data to S3 (EMRFS) with the Glue Data Catalog as metastore, then run the job on a transient cluster that terminates after the step, with task nodes on Spot. Alternatively submit the same Spark job to EMR Serverless. Either removes 21 idle hours a day.

Check yourself

Why should core nodes usually run On-Demand while task nodes can use Spot?

Show answer

Core nodes store HDFS data, so losing them can lose data. Task nodes only process data, so an interruption costs only work in progress.

Exam Tips

Remember for the exam

  • Spark for batch and ML, Hive for HiveQL batch, Trino/Presto for interactive SQL, HBase for random access, Flink for streaming.
  • Keep data in S3 via EMRFS and use the Glue Data Catalog as metastore; HDFS is ephemeral.
  • Core nodes hold HDFS: use On-Demand. Task nodes do not: ideal for Spot.
  • Transient clusters or EMR Serverless suit scheduled batch jobs; long-running clusters suit interactive use.
  • Managed scaling and instance fleets reduce cost and improve Spot availability.