> For the complete documentation index, see [llms.txt](https://alvintoh.gitbook.io/apache-2-0-spark-with-scala/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alvintoh.gitbook.io/apache-2-0-spark-with-scala/section-3-spark-basics-and-simple-examples/12.-spark-internals.md).

# 12. Spark Internals

## SPARK INTERNALS

What actually happenend?

### An Execution Plan Is Created From Your RDD'S

* This start from textFile() -> map() -> countByValue()

### The Job Is Broken Into Stages Based On When Data Needs To Be Organized

* Stage 1 -> textFile(), map()
* Stage 2 -> countByValue()

### Each Stage Is Broken Into Tasks (Which May Be Distributed Across A Cluster)

### Finally The Tasks Are Scheduled Across Your Cluster And Executed
