Introduction to Apache Spark

Reading Time: 3 minutes

Hey guys, welcome to this fresh blog on Apache Spark.

In this blog, we’ll learn about what is Apache Spark and its importance in the industry, its comparison with hadoop, spark evolution, features and much more.

What is Apache Spark?

Apache Spark is a data processing framework that can quickly perform processing tasks on very large datasets. It can also distribute data processing tasks across multiple computers, either on its own or with other distributed computing tools.

These two qualities are key to the worlds of big data and machine learning, which require massive computing power to crunch through large data stores.

It’s a lightning-fast cluster computing technology, designed for fast computation. It is based on Hadoop MapReduce. It extends the MapReduce model to efficiently use it for more types of computations, which includes interactive queries and stream processing.

The main feature of Spark is its in-memory cluster computing that increases the processing speed of an application.

Evolution of Apache Spark

Spark is one of Hadoop’s sub-project developed in 2009 in UC Berkeley’s AMPLab by Matei Zaharia. It was open-sourced in 2010 under a BSD license.

It was donated to Apache software foundation in 2013. Now Apache Spark has become a top-level Apache project since Feb-2014.

Features of Apache Spark

Apache Spark has the following features:-

  • Speed- Spark helps to run an application in a Hadoop cluster, up to 100 times faster in memory, and 10 times faster when running on disk.
  • This is possible by reducing a number of read/write operations to disk.
  • Supports multiple languages– Spark provides built-in APIs in Java, Scala, or Python. Therefore, you can write applications in different languages.
  • In-Memory Computation– With in-memory processing, we can increase the processing speed. Here the data is being cached so we need not fetch data from the disk every time thus the time is saved.
  • Real-Time Stream Processing: Spark Streaming brings Apache Spark’s language-integrated API to stream processing, letting you write streaming jobs the same way you write batch jobs.
  • Reusability: Spark code can be used for batch-processing, joining streaming data against historical data as well as running ad-hoc queries on the streaming state. 
  • Cost-efficient: Apache Spark is open-source software, so it does not have any licensing fee associated with it. Users have to just worry about the hardware cost.

Comparing Apache Spark and Hadoop

Let’s take a closer look at the major differences between Hadoop and Spark

  • Performance: Spark is faster because it uses random access memory (RAM) instead of reading and writing intermediate data to disks. Hadoop stores data on multiple sources and processes it in batches via MapReduce.
  • Cost: Hadoop runs at a lower cost since it relies on any disk storage type for data processing. Spark runs at a higher cost because it relies on in-memory computations for real-time data processing, which requires it to use high quantities of RAM to spin up nodes.
  • Machine learning (ML): Spark is the superior platform in this category because it includes MLlib, which performs iterative in-memory ML computations. It also includes tools that perform regression, classification, persistence, pipeline construction, evaluation, etc.
  • Security: Spark enhances security with authentication via shared secret or event logging, whereas Hadoop uses multiple authentication and access control methods. Though overall, Hadoop is more secure, Spark can integrate with Hadoop to reach a higher security level.
  • Scalability: When data volume rapidly grows, Hadoop quickly scales to accommodate the demand via Hadoop Distributed File System (HDFS). In turn, Spark relies on the fault-tolerant HDFS for large volumes of data.
  • Processing: Though both platforms process data in a distributed environment, Hadoop is ideal for batch processing and linear data processing. Spark is ideal for real-time processing and processing live unstructured data streams.