Apache Spark Fundamentals
Apache Spark is a distributed computing engine for large-scale data processing. It runs batch and streaming workloads across a cluster using in-memory computation, providing APIs for SQL, machine learning, graph processing, and structured streaming.
itData engineering and analytics | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Apache Spark Fundamentals
Apache Spark is the machine you ask to perform one large, orderly bit of data work across one computer or several. It exists because a single process eventually meets a file too large, a calculation too slow, or a collection of data already scattered around the building. Spark does not become the building. Storage, tables, and databases remain outside; Spark arrives, does the arithmetic, and leaves the cups where it found them.
The useful mental picture is a lazy dataflow. You describe transformations such as filtering, selecting, joining, and grouping. Spark writes these down with impressive patience. Nothing substantial happens until an action asks for a result or writes output. Then the note-taking turns into a job, which is Spark's moment of dramatic but organized activity.
That job has a driver and executors. The driver is the coordinating process that builds plans, asks a cluster manager for resources, and schedules work. Executors run tasks. Each task works on a partition, which is one slice of the distributed data. The driver is the conductor, not an especially ambitious executor wearing a hat. Keep it reachable, and avoid asking it to hold a giant result with collect().
The surprise is that the awkward part is often not computation. It is movement. A shuffle redistributes data so that rows with the same key can meet for a group, join, sort, or repartition. That movement creates stage boundaries and can use network, memory, and disk. More executors do not make one hot partition less hot. The runtime tells you what happened through jobs, stages, task duration, shuffle metrics, spill, and skew; those clues are considerably less mystical than tuning by knob collection.
Spark also has a more reassuring habit: it can recompute lost partitions from the transformations that produced them. That does not make external side effects safe. A retried task can repeat an external request, so the receiving system needs a transaction, commit protocol, idempotency key, or deduplication rule. Reliability is a group project, as it so often turns out to be.
For structured data, begin with DataFrames or SQL. They give Spark named columns and a schema, which lets it plan structured work. Structured Streaming uses those same ideas for arriving rows: an input table, an incremental query, a result table, a sink, and a checkpoint. Checkpointing records progress, but exactly-once behavior still depends on the source, query, and sink agreeing to the arrangement.
Read the Intro when you want the full map of applications, partitions, shuffles, caching, and streaming. Use the Slides when the relationships need a picture. Keep the Cheatsheet open while reading a plan or the Spark user interface. Then follow the Reference path into the official quick start, submission guide, monitoring material, and streaming documentation. Spark is a distributed runtime, not a spell; fortunately, it leaves receipts.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://spark.apache.org/docs/latest/
Supports
- Apache Spark as a unified analytics engine for large-scale data processing
- Current Apache Spark 4.1.2 documentation version and supported runtime overview
- Official programming-guide boundaries among RDDs, Spark SQL, DataFrames, Structured Streaming, machine learning, and graph processing
- Standalone, YARN, and Kubernetes deployment choices
- Spark Connect as a client-server interface separate from embedded applications
- https://spark.apache.org/docs/latest/quick-start.html
Supports
- SparkSession-based self-contained applications
- Interactive shell and local application learning path
- Transformations and actions in basic examples
- Caching for repeatedly accessed datasets and iterative algorithms
- Packaging and launching Python, Java, and Scala applications
- https://spark.apache.org/docs/latest/sql-getting-started.html
Supports
- SparkSession as the entry point for Spark functionality
- DataFrame creation from RDDs, tables, and Spark data sources
- DataFrame operations in Python, Scala, Java, and R
- Programmatic SQL returning DataFrames or Datasets
- Dataset encoders and the typed Dataset interface for Scala and Java
- Interoperation between structured data and RDDs
- https://spark.apache.org/docs/latest/cluster-overview.html
Supports
- Driver, SparkContext, cluster manager, executor, worker, task, job, and stage responsibilities
- Application-specific executor processes and lack of direct data sharing across applications
- Driver network reachability and proximity requirements
- Standalone, YARN, and Kubernetes cluster managers
- Client and cluster deploy-mode definitions
- Driver user interface and application scheduling model
- https://spark.apache.org/docs/latest/rdd-programming-guide.html
Supports
- RDD as a fault-tolerant partitioned collection operated on in parallel
- One task per partition and partition-level parallelism
- Lazy transformations and actions that require computation
- Jobs created by actions and stages separated by shuffle operations
- Shuffle redistribution, network cost, memory pressure, and disk spill
- Persistence, storage levels, materialization through actions, and recomputation of lost cached partitions
- Broadcast variables and accumulators
- Driver collection behavior and local versus cluster execution
- https://spark.apache.org/docs/latest/submitting-applications.html
Supports
- spark-submit as the uniform application launcher across supported cluster managers
- Master, deploy mode, configuration, application archive, and application argument roles
- Client mode placing the driver with the submitter and cluster mode launching it on a worker
- Local, standalone, YARN, and Kubernetes master settings
- Properties-file loading and dependency-distribution options
- https://spark.apache.org/docs/latest/web-ui.html
Supports
- Jobs, stages, storage, environment, executors, SQL, and Structured Streaming views
- Job directed acyclic graph and stage visibility
- Task duration, shuffle, spill, garbage collection, and skew evidence
- Cache visibility after a dataset is materialized
- Structured Streaming rates, batch duration, operation timing, and state metrics
- https://spark.apache.org/docs/latest/monitoring.html
Supports
- Live driver user interface and default port behavior
- Event logging and history server for completed applications
- Metrics, REST interfaces, and external instrumentation options
- Driver and executor monitoring scopes
- https://spark.apache.org/docs/latest/streaming/getting-started.html
Supports
- Input-table, result-table, trigger, and incremental-query mental model
- Append, update, and complete output-mode concepts
- Event time, late data, and watermark purpose
- Checkpointing, write-ahead logs, replayable sources, idempotent sinks, and end-to-end exactly-once conditions
- Minimal retained state rather than materializing an entire streaming table
- https://spark.apache.org/docs/latest/streaming/apis-on-dataframes-and-datasets.html
Supports
- Streaming DataFrame and Dataset sources, transformations, triggers, and sinks
- Output-mode compatibility with different query shapes
- Watermark guarantees and late-data limits
- Checkpoint locations and recovery of progress and running aggregates
- File-sink exactly-once, Kafka-sink at-least-once, foreach at-least-once, and implementation-dependent foreachBatch guarantees
- Console and memory sinks as non-fault-tolerant debugging sinks
- https://spark.apache.org/docs/latest/streaming/performance-tips.html
Supports
- Default micro-batch processing and asynchronous progress tracking limits
- Continuous processing as an experimental low-latency mode with at-least-once fault tolerance
- Limited supported operations, sources, and sinks in continuous mode
- Checkpoint compatibility and restart behavior between supported trigger modes
- https://spark.apache.org/docs/latest/tuning.html
Supports
- CPU, network bandwidth, and memory as possible Spark bottlenecks
- Serialization cost and memory effects
- Memory management, garbage collection, parallelism, reduce-task memory, broadcast data, and locality concerns
- Evidence-based tuning of serialization and persisted data
- https://spark.apache.org/history.html
Supports
- Spark began as a UC Berkeley AMPLab research project in 2009
- Spark was open sourced in early 2010 and moved to the Apache Software Foundation in 2013
- https://spark.apache.org/releases/spark-release-1-0-0.html
Supports
- Spark 1.0 introduced Spark SQL and a uniform spark-submit workflow
- https://spark.apache.org/releases/spark-release-1-4-0.html
Supports
- Spark 1.4 expanded the DataFrame API and packaged SparkR
- https://spark.apache.org/releases/spark-release-2-0-0.html
Supports
- Spark 2.0 introduced the 2.x line with Structured Streaming and major SQL and API improvements
- https://spark.apache.org/releases/spark-release-3-0-0.html
Supports
- Spark 3.0 introduced adaptive query execution, dynamic partition pruning, ANSI SQL work, and Structured Streaming UI improvements
- https://spark.apache.org/releases/spark-release-3-4-0.html
Supports
- Spark 3.4 added Spark Connect Python client API coverage
- https://spark.apache.org/releases/spark-release-4-0-0.html
Supports
- Spark 4.0 expanded Spark Connect and Spark SQL capabilities
- https://docs.databricks.com/aws/en/optimizations/spark-ui-guide/long-spark-stage-page
Supports
- Stage metrics for diagnosing spill and skew, including maximum versus 75th-percentile task duration
- https://docs.databricks.com/aws/en/optimizations/spark-ui-guide/spark-memory-issues
Supports
- Memory-pressure causes including insufficient shuffle partitions, broadcasts, user-defined functions, skew, and streaming state
- https://community.databricks.com/t5/technical-blog/top-10-code-mistakes-that-degrade-your-spark-performance/ba-p/118468
Supports
- Operational performance costs caused by common Spark code patterns, including unnecessary actions
- https://www.databricks.com/product/data-intelligence-platform
Supports
- Databricks managed platform for Apache Spark workloads
- https://aws.amazon.com/emr/
Supports
- Amazon EMR managed deployment options for Apache Spark
- https://aws.amazon.com/glue/
Supports
- AWS Glue managed ETL service and Spark job capability
- https://cloud.google.com/products/managed-service-for-apache-spark
Supports
- Google Cloud Managed Service for Apache Spark cluster and serverless deployment choices
- https://azure.microsoft.com/products/databricks
Supports
- Azure Databricks managed Spark environment
- https://azure.microsoft.com/products/synapse-analytics
Supports
- Azure Synapse Analytics Apache Spark pools
- https://www.microsoft.com/microsoft-fabric
Supports
- Microsoft Fabric data-engineering workloads with Spark
