Built with Tutify.io

    AIStudyLabs

    Apache Spark Architecture

    Apache Spark Architecture

    Introduction

    Apache Spark is a computing framework that processes data in parallel in a distributed environment with low latency. Spark works on a master node (driver) and slave (worker) node architecture within a cluster. Spark applications run as independent sets of processes on a cluster, coordinated by the SparkContext object in your main program (called the driver program). Below are the components of Spark.

    <img height="208" width="435" alt="Spark Cluster Overview" title="Spark Cluster Overview" src="https://yrltjyzsmzdylqvoonwf.supabase.co/storage/v1/object/public/lesson-images/100/181/spark-cluster-overview.png" />

    Cluster: A cluster is a platform to launch the Spark applications. A Spark cluster is a combination of a Driver Program, Cluster Manager, and Worker Nodes that work together to complete tasks. The SparkContext (Driver program) lets us coordinate processes across the cluster in order to execute the application. The SparkContext sends tasks to the Executors on the Worker Nodes to run. The cluster can be a single node or multinode cluster based on the resource availability.

    Driver Program: The Spark driver program is the one that creates the SparkContext object in the application. As soon as we submit the Spark job, the driver program runs the main() method of your application and creates DAGs representing the data flow internally. Based on the DAG workflow, the driver requests the cluster manager to allocate the resources (workers) required for processing. Once the resources are allocated, the driver then uses the Spark context to send the serialized result (code+data) to the workers to execute as Tasks and their result is captured.

    Cluster Manager: Cluster Manager is the key component in the Spark architecture. It plays a very important role in terms of resource management. Cluster Manager makes sure the application runs efficiently and effectively by utilizing the resources of the cluster. There are a variety of cluster managers such as Hadoop YARN, Apache Mesos, and Standalone Scheduler. Below are the key responsibilities of the Cluster Manager.

    Cluster Manager Types

    Spark supports below cluster managers:

    Apache Spark Tutorial with Scala Examples — Introduction to Apache Spark

    Introduction to Apache Spark

    Setup Apache Spark Environment

    SparkSession & SparkContext

    Resilient Distributed Datasets (RDDs)

    Apache Spark Concepts

    Cache, Persistence and Shared Variables

    DataFrame Introduction

    DataFrame Narrow Transformation

    DataFrame Wider Transformation

    DataFrame Actions

    Spark SQL Functions

    Advanced DataFrame Features

    Using SQL Queries

    Spark Read & Write CSV Files

    Working with JSON Files

    Working with Parquet Files

    Spark Dataset

    What Next?

    Tutorial Not Found