Hive : Difference between the Tez execution engine and the Spark execution engine in Hive

Hive @ Freshers.in

Hive is a data warehousing tool built on top of Hadoop, which allows us to write SQL-like queries on large datasets stored in Hadoop Distributed File System (HDFS). Hive supports different execution engines, including Tez and Spark. In this article, we will discuss the differences between the Tez and Spark execution engines in Hive.

  1. Architecture
    The Tez execution engine is based on a directed acyclic graph (DAG) execution model, where the query is represented as a DAG of vertices and edges. Each vertex represents a processing step, and edges represent the data flow between the vertices. The Tez execution engine uses YARN as the resource manager and can run on any Hadoop cluster.

The Spark execution engine, on the other hand, is based on the Resilient Distributed Dataset (RDD) model, which is a distributed collection of data that can be processed in parallel. Spark uses its own cluster manager called Spark Standalone, or can run on other cluster managers like YARN and Mesos.

  1. Performance
    Tez is known for its low latency and high throughput performance, as it optimizes the data processing pipeline by eliminating the overhead of MapReduce. Tez does this by using an in-memory data processing technique called Vertex Reuse, where the output of one vertex is cached in memory and used as input for subsequent vertices.

Spark, on the other hand, provides a more flexible and expressive programming model than Tez, which allows developers to write complex processing pipelines. Spark also offers a more interactive experience than Tez, thanks to its ability to cache intermediate results in memory.

  1. Scalability
    Tez provides good scalability for large datasets by optimizing the data processing pipeline and minimizing the number of MapReduce jobs. However, Tez can sometimes suffer from memory issues when processing large amounts of data.

Spark, on the other hand, is highly scalable and can handle large datasets with ease. Spark provides efficient data processing through its distributed processing engine, which can be easily scaled up or down as per the data volume.

  1. Ease of use
    Tez provides a simplified user experience for developers, as it uses HiveQL, which is similar to SQL. Tez also offers an interactive shell for developers to test their queries.

Spark, on the other hand, requires developers to write code in languages like Scala, Python, or Java. This requires more programming knowledge and expertise than Tez.

  1. Fault tolerance
    Both Tez and Spark provide fault tolerance, which ensures that processing can continue even if some nodes fail. Tez uses YARN for resource management and task scheduling, while Spark has its own fault-tolerant job scheduler called DAG Scheduler.

Tez and Spark are two popular execution engines in Hive, each with its own strengths and weaknesses. Tez offers low latency, high throughput performance, and ease of use, while Spark provides more flexibility, scalability, and fault tolerance. Developers should choose the execution engine that best suits their specific needs and requirements.

Author: user

Leave a Reply