Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

HADOOP ECOSYSTEM(APACHE SPARK)

A.S.Shalini
Computer Science Engineering
Mahatma Gandhi Institute Of Technology
Hyderabad,India
Email Id:a.s.shalini123@gmail.com

Abstract —Hadoop is an open source distributed processing written in Scala still offers rich APIs in Scala, Java, Python, as
framework that manages dataprocessing and storage for big well as R. We can say, it is a tool for running spark
data applications running in clustered systems. Hadoop is a applications.
Java-based framework that is extremely popular for Most importantly, by comparing Spark with Hadoop, it is 100
handling and analyzing large sets of data. Industries are
times faster than Big Data Hadoop and 10 times faster than
using Hadoop extensively to analyze their data sets. The
reason is that Hadoop framework is based on a simple accessing data from disk.
programming model (MapReduce) and it enables a Spark is one of Hadoop’s sub project developed in 2009 in UC
computing solution that is scalable, flexible, fault-tolerant Berkeley’s AMPLab by Matei Zaharia. It was Open Sourced
and cost effective. Here, the main concern is to maintain in 2010 under a BSD license. It was donated to Apache
speed in processing large datasets in terms of waiting time software foundation in 2013, and now Apache Spark has
between queries and waiting time to run the program. Spark become a top level Apache project from Feb-2014.
was introduced by Apache Software Foundation for
speeding up the Hadoop computational computing software
process. As against a common belief, Spark is not a modified
version of Hadoop and is not, really, dependent on Hadoop Why Spark?
because it has its own cluster management. Hadoop is just
one of the ways to implement Spark. Spark uses Hadoop in As we know, there was no general purpose computing engine
two ways – one is storage and second is processing. Since in the industry, since
Spark has its own cluster management computation, it uses 1. To perform batch processing, we were using Hadoop
Hadoop for storage purpose only.Hadoop ecosystem MapReduce.
components are actually different services deployed by the
various enterprise.We can integrate these to work with a
2. Also, to perform stream processing, we were using
variety of data.Each of the Hadoop Ecosystem components is Apache Storm / S4.
developed to deliver explicit function.Different Hadoop 3. Moreover, for interactive processing, we were using
ecosystems are Hive,HBase,YARN,HDFS,Apache spark. Apache Impala / Apache Tez.
4. To perform graph processing, we were using Neo4j /
Apache Graph.
Hence there was no powerful engine in the industry,
INTRODUCTION
that can process the data both in real-time and batch
mode. Also, there was a requirement that one engine
Apache Spark is a lightning-fast cluster computing can respond in sub-second and perform in-memory
technology, designed for fast computation. It is based on processing.
Hadoop MapReduce and it extends the MapReduce model to Therefore, Apache Spark programming enters, it is a
efficiently use it for more types of computations, which powerful open source engine. Since, it offers real-
includes interactive queries and stream processing. The main time stream processing, interactive processing, graph
feature of Spark is its in-memory cluster computing that processing, in-memory processing as well as batch
increases the processing speed of an application. Spark is processing. Even with very fast speed, ease of use
designed to cover a wide range of workloads such as batch and standard interface. Basically, these features
applications, iterative algorithms, interactive queries and create the difference between Hadoop and Spark.
streaming. Apart from supporting all these workload in a Also makes a huge comparison between Spark vs
respective system, it reduces the management burden of Storm.
maintaining separate tools. Moreover, it is designed in such a
way that it integrates with all the Big data tools. Like spark
can access any Hadoop data source, also can run on Hadoop
clusters .Basically, Apache Spark offers high-level APIs to
users, such as Java, Scala, Python and R. Although, Spark is
All the functionalities being provided by Apache Spark are
Features of Apache Spark built on the top of Spark Core. It delivers speed by
providing in-memory computation capability. Thus Spark
Core is the foundation of parallel and distributed processing of
Apache Spark has following features. dataset.
a. Speed:
Spark helps to run an application in Hadoop cluster, up to 100 The key features of Apache Spark Core are:
times faster in memory, and 10 times faster when running on
disk. This is possible by reducing number of read/write -It is in charge of essential I/O functionalities.
operations to disk. It stores the intermediate processing data in -Significant in programming and observing the role of
memory. the Spark cluster.
-Task dispatching.
b. Supports multiple languages: -Fault recovery.
Spark provides built-in APIs in Java, Scala, or Python. -It overcomes the snag of MapReduce by using in-memory
Therefore, you can write applications in different languages. computation.
Spark comes up with 80 high-level operators for interactive Spark Core is embedded with a special collection
querying. called RDD (resilient distributed dataset). RDD is among the
abstractions of Spark. Spark RDD handles partitioning data
c. Advanced Analytics: across all the nodes in a cluster. It holds them in the memory
Spark not only supports ‘Map’ and ‘reduce’. It also supports pool of the cluster as a single unit. There are two operations
SQL queries, Streaming data, Machine learning (ML), and performed on RDDs: Transformation and Action-
Graph algorithms. Transformation:
It is a function that produces new RDD from the existing
d. In-Memory Computation in Spark: RDDs.
With in-memory processing, we can increase the processing Action:
speed. Here the data is being cached so we need not fetch data In Transformation, RDDs are created from each other. But
from the disk every time thus the time is saved. Spark when we want to work with the actual dataset, then, at that
has DAG execution engine which facilitates in-memory point we use Action.
computation and acyclic data flow resulting in high speed. Refer these guides to learn more about Spark RDD
Transformations & Actions API and Different ways to create
e. Reusability: RDD in Spark.
we can reuse the Spark code for batch-processing, join stream
against historical data or run ad-hoc queries on stream state. 2.Spark SQL:
Spark SQL is a component on top of Spark Core that
f. Fault Tolerance in Spark: introduces a new data abstraction called SchemaRDD, which
Apache Spark provides fault tolerance through Spark provides support for structured and semi-structured data.
abstraction-RDD. Spark RDDs are designed to handle the
failure of any worker node in the cluster. Thus, it ensures that Features of Spark SQL include:
the loss of data reduces to zero. Learn different ways to create
RDD in Apache Spark. -Cost based optimizer.
-Mid query fault-tolerance: This is done by scaling thousands
g. Real-Time Stream Processing: of nodes and multi-hour queries using the Spark engine.
Spark has a provision for real-time stream processing. Earlier Follow this guide to Learn more about Spark fault tolerance.
the problem with Hadoop MapReduce was that it can handle -Full compatibility with existing Hive data.
and process data which is already present, but not the real-time DataFrames and SQL provide a common way to access a
data. but with Spark Streaming we can solve this problem. variety of data sources. It includes Hive, Avro, Parquet, ORC,
JSON, and JDBC.
-Provision to carry structured data inside Spark programs,
Components Of Spark using either SQL or a familiar Data Frame API.

3.Spark Streaming:
1.Apache Spark Core:
Spark Streaming leverages Spark Core's fast scheduling
Spark Core is the underlying general execution engine for
capability to perform streaming analytics. It ingests data in
spark platform that all other functionality is built upon. It
mini-batches and performs RDD (Resilient Distributed
provides In-Memory computing and referencing datasets in
Datasets) transformations on those mini-batches of data.
external storage systems.
How does Spark Streaming Works? 5.GraphX:
There are 3 phases of Spark Streaming: GraphX is a distributed graph-processing framework on top of
a.GATHERING Spark. It provides an API for expressing graph computation
The Spark Streaming provides two categories of built- that can model the user-defined graphs by using Pregel
in streaming sources: abstraction API. It also provides an optimized runtime for this
Basic sources: abstraction.
These are the sources which are available in GraphX in Spark is API for graphs and graph parallel
the StreamingContext API. Examples: file systems, and socket execution. It is network graph analytics engine and data
connections. store. Clustering, classification, traversal, searching, and
Advanced sources: pathfinding is also possible in graphs.
These are the sources like Kafka, Flume, Kinesis, etc. are Furthermore, GraphX extends Spark RDD by bringing in
available through extra utility classes. Hence Spark access light a new Graph abstraction: a directed multigraph with
data from different sources like Kafka, Flume, Kinesis, or properties attached to each vertex and edge.
TCP sockets. GraphX also optimizes the way in which we can represent
b.PROCESSING vertex and edges when they are primitive data types. To
The gathered data is processed using complex algorithms support graph computation it supports fundamental operators
expressed with a high-level function. For example, (e.g., subgraph, join Vertices, and aggregate Messages) as well
map, reduce, join and window. as an optimized variant of the Pregel API.
c.DATA STORAGE
The Processed data is pushed out to file systems, databases, Resilient Distributed Dataset – RDD
and live dashboards.
Spark Streaming also provides high-level abstraction. It is The key abstraction of Spark is RDD. RDD is an acronym for
known as discretized stream or DStream. Resilient Distributed Dataset. It is the fundamental unit of data
DStream in Spark signifies continuous stream of data. We can in Spark. Basically, it is a distributed collection of elements
form DStream in two ways either from sources such as Kafka, across cluster nodes. Also performs parallel operations.
Flume, and Kinesis or by high-level operations on other Moreover, Spark RDDs are immutable in nature. Although, it
DStreams. Thus, DStream is internally a sequence of RDDs. can generate new RDD by transforming existing Spark
RDD.Learn about Spark RDDs in detail.
Decomposing the name RDD:
4.MLlib(Machine Learning Library):
MLlib is a distributed machine learning framework above Resilient, i.e. fault-tolerant with the help of RDD lineage
Spark because of the distributed memory-based Spark graph(DAG) and so able to recompute missing or damaged
architecture. It is, according to benchmarks, done by the partitions due to node failures.
MLlib developers against the Alternating Least Squares (ALS) Distributed, since Data resides on multiple nodes.
implementations. Dataset represents records of the data you work with. The
Spark MLlib is nine times as fast as the Hadoop disk-based user can load the data set externally which can be either JSON
version of Apache Mahout (before Mahout gained a Spark file, CSV file, text file or database via JDBC with no specific
interface). data structure.
MLlib in Spark is a scalable Machine learning library that Hence, each and every dataset in RDD is logically partitioned
discusses both high-quality algorithm and high speed. across many servers so that they can be computed on different
The motive behind MLlib creation is to make machine nodes of the cluster. RDDs are fault tolerant i.e. It posses self-
learning scalable and easy. recovery in the case of failure.There are three ways to create
It contains machine learning libraries that have an RDDs in Spark such as – Data in stable storage, other RDDs,
implementation of various machine learning algorithms. For and parallelizing already existing collection in driver
example, clustering, regression, classification and program. One can also operate Spark RDDs in parallel with a
collaborative filtering. Some lower level machine learning low-level API that offers transformations and actions. We will
primitives like generic gradient descent optimization study these Spark RDD Operations later in this section.Spark
algorithm are also present in MLlib.. RDD can also be cached and manually partitioned. Caching is
The reason MLlib is switching to DataFrame-based API is that beneficial when we use RDD several times. And manual
it is more user-friendly than RDD. Some of the benefits of partitioning is important to correctly balance partitions.
using DataFrames are it includes Spark Data sources, SQL Generally, smaller partitions allow distributing RDD data
DataFrame queries Tungsten and Catalyst optimizations, and more equally, among more executors. Hence, fewer partitions
uniform APIs across languages. MLlib also uses the linear make the work easy.Programmers can also call
algebra package Breeze. Breeze is a collection of libraries for a persist method to indicate which RDDs they want to reuse in
numerical computing and machine learning. future operations. Spark keeps persistent RDDs in memory by
default, but it can spill them to disk if there is not enough
RAM. Users can also request other persistence strategies, such d.Immutability:
as storing the RDD only on disk or replicating it across Data is safe to share across processes. It can also be created or
machines, through flags to persist. retrieved anytime which makes caching, sharing & replication
easy. Thus, it is a way to reach consistency in computations.
Ways to create Spark RDD:
e.Partitioning:
Partitioning is the fundamental unit of parallelism in Spark
Basically, there are 3 ways to create Spark RDDs
RDD. Each partition is one logical division of data which is
Parallelized collections: mutable. One can create a partition through some
By invoking parallelize method in the driver program, transformations on existing partitions.
we can create parallelized collections.
f.Persistence:
External datasets Users can state which RDDs they will reuse and choose a
One can create Spark RDDs, by calling a textFile method. storage strategy for them (e.g., in-memory storage or on Disk).
Hence, this method takes URL of the file and reads it as a
collection of lines. g.Location-Stickiness:

Existing RDDs RDDs are capable of defining placement preference to


Moreover, we can create new RDD in spark, by applying compute partitions. Placement preference refers to information
transformation operation on existing RDDs. about the location of RDD.
To learn all three ways to create RDD in detail, follow the The DAGScheduler places the partitions in such a way that
link. task is close to data as much as possible.

Spark RDDs operations:-


There are two types of operations, which Spark RDDs Limitations Of Apache Spark
supports:
Transformation Operations: 1.No File Management System:
It creates a new Spark RDD from the existing one. Moreover, A major issue is Spark does not have its own file management
it passes the dataset to the function and returns new dataset. system. Basically, it relies on some other platform like
Action Operations : Hadoop or another cloud-based platform.
In Apache Spark, Action returns final result to driver program
or write it to the external data store. 2. Expensive:
While we desire cost-efficient processing of big data, Spark
turns out to be very expensive. Since keeping data in memory
Features Of Spark RDD is quite expensive. However the memory consumption is very
high, and it is not handled in a user-friendly manner.
a.In-memory Computation: Moreover, we require lots of RAM to run in-memory, thus the
Spark RDDs have a provision of in-memory computation. It cost of spark is much higher.
stores intermediate results in distributed memory(RAM)
instead of stable storage(disk). 3. Less number of Algorithms:
Spark MLlib have very less number of available algorithms.
b. Lazy Evaluations: For example, Tanimoto distance.
All transformations in Apache Spark are lazy, in that they do
not compute their results right away. Instead, they just 4. Manual Optimization:
remember the transformations applied to some base data It is must that Spark job is manually optimized and is adequate
set.Spark computes transformations when an action requires a to specific datasets. Moreover, to partition and cache in spark
result for the driver program. to be correct, it is must to control it manually.

c.Fault Tolerance: 5. Iterative Processing:


Spark RDDs are fault tolerant as they track data lineage Basically, here data iterates in batches. Also, each iteration is
information to rebuild lost data automatically on failure. They scheduled and executed separately.
rebuild lost data on failure using lineage, each RDD
remembers how it was created from other datasets (by 6. Latency:
transformations like a map, join or groupBy) to recreate itself. On comparing with Flink, Apache Spark has higher latency.
Use Cases Of Apache Spark

a.Spark Use Cases in the Finance Industry:


There are many banks those are using Spark. Basically, it
helps to access and analyze many of the parameters in the
bank sector like the emails, social media profiles, call
recordings, forum, and many more. Further, it helps to make
right decisions for several zones.

b.Apache Spark Use Cases in E-Commerce Industry:


Basically, it helps with information about a real-time
transaction. Moreover, those are passed to streaming
clustering algorithms.

c. Apache Spark Use Cases in Media & Entertainment


Industry:
We use Spark to identify patterns from the real-time in-game
events. Moreover, it helps to respond in order to harvest
lucrative business opportunities.

d. Apache Spark Use Cases in Travel Industry:


Basically, travel industries are using spark rapidly. Moreover,
it helps users to plan a perfect trip by speed up the
personalized recommendations. Although, its review process
of the hotels in a readable format is done by using Spark.

You might also like