Supercharge Your Analytics with Delta Engine

Updated on Mar 06,2024

Supercharge Your Analytics with Delta Engine

Table of Contents

  1. Introduction
  2. The Need for Delta Lake
  3. Introducing Delta Engine
  4. Improved Query Optimizer
  5. Native Vectorized Execution Engine
  6. Caching Layer for Faster IO Throughput
  7. Hardware Trends and CPU Bottlenecks
  8. Characteristics of Modern Workloads
  9. Optimizing for Data-Level Parallelism
  10. Optimizing for Instruction-Level Parallelism
  11. Leveraging UTF-8 Encoding for Performance
  12. Conclusion

💡 Introduction

In the world of data lakes, maintaining reliability and structure is a crucial challenge. This is where Delta Lake has proven to be a Game-changer. By bringing structure and reliability to data lakes, Delta Lake fills in a critical layer of modern lakehouse architecture and supports various downstream data use cases. However, indexing alone is not enough to achieve high performance for small analytic workloads. This is where Delta Engine, the latest innovation from Databricks, comes into play.

💾 The Need for Delta Lake

While Delta Lake provides reliability and structure to data lakes, there is a need for a high-performance query engine to meet the demands of traditional analytic workloads. Many analytic workloads involve small queries that need to be executed quickly. To address this need, Databricks has created Delta Engine, a high-performance query engine that works seamlessly with Delta Lake. Delta Engine is built on Apache Spark 3.0 and is fully compatible with Spark's SQL and DataFrame APIs.

🔍 Introducing Delta Engine

Delta Engine consists of three important components that contribute to its high performance for SQL and DataFrame workloads. First, it features an improved query optimizer that extends Spark's cost-based optimizer and adaptive query execution optimizer. With more advanced statistics and techniques, Delta Engine can deliver up to 18 times performance increase for star schema workloads.

The Second component of Delta Engine is a native vectorized execution engine. This execution engine, written from scratch in C++, maximizes performance by leveraging data-level parallelism and instruction-level parallelism. It allows for the processing of multiple data points at once, greatly speeding up computation.

The third component is a caching layer that sits between the execution engine and cloud object storage. This caching layer intelligently selects which input data to cache for the user, transcoding it into a more CPU-efficient format. By fully leveraging the throughput of local NVMe SSDs, Delta Engine delivers up to five times scan performance increase for all types of workloads.

🖥️ Hardware Trends and CPU Bottlenecks

To design an efficient execution engine, it is crucial to understand how hardware trends impact performance. Over the past five years, IO throughput has continued to increase significantly, while CPU clock frequency has remained relatively constant. This has led to CPUs becoming a bottleneck for performance, especially with the increasing demands of modern workloads.

In response to this challenge, Databricks launched Project Tungsten, aimed at optimizing CPU efficiency by optimizing execution. However, with CPUs still being the bottleneck, the question arises: How do we achieve the next level of performance?

🔄 Characteristics of Modern Workloads

The characteristics of modern workloads play a critical role in optimizing performance. In today's fast-paced business environment, data teams are given less time to properly model and prepare data. Traditional data modeling approaches are no longer practical, as businesses change rapidly and new problems need immediate solutions. As a result, data often lacks proper modeling, with strings being used extensively and columns having few constraints.

Recognizing these challenges, Databricks developed Photon, an execution engine designed to accelerate Spark SQL workloads. Photon is built from scratch in C++ and leverages the principles of vectorization. It optimizes the processing of both well-modeled and not-so-well-modeled data, achieving agility and performance simultaneously.

🚀 Optimizing for Data-Level Parallelism

To harness the power of data-level parallelism, Photon focuses on optimizing memory data format. By transposing row-oriented data into a column-oriented format, Photon allows for efficient computation. This format enables the processing of multiple values at once and simplifies code execution. Additionally, modern compilers can optimize these simple loops, resulting in significant performance improvements.

✨ Optimizing for Instruction-Level Parallelism

In addition to data-level parallelism, Photon takes advantage of instruction-level parallelism to further enhance performance. By breaking long loops into multiple smaller loops, Photon enables CPUs to reorder and run multiple instructions in parallel. This technique optimizes the execution of complex computations, such as hash tables and STRING functions, resulting in faster query processing.

🌐 Leveraging UTF-8 Encoding for Performance

The widespread use of UTF-8 encoding presents both memory-saving benefits and computational challenges. While UTF-8 encoding is compact and memory-efficient, computations involving variable-length encoding can be computationally expensive. Databricks tackled this challenge by introducing a two-step approach.

Photon incorporates a fast ASCII detection algorithm that runs at an incredibly high speed. By leveraging this algorithm, Photon can determine if a string is entirely in the ASCII character set. If so, it can execute a special fixed-length version of string functions, bypassing the performance penalties of UTF-8 encoding. This automatic optimization significantly improves the performance of string operations.

📝 Conclusion

Delta Engine, powered by Photon, is a purpose-built execution engine designed for maximum performance. With its improved query optimizer, native vectorized execution engine, and intelligent caching layer, Delta Engine delivers best-in-class performance while retaining the expressiveness of Spark. By optimizing for both hardware trends and the characteristics of modern workloads, Delta Engine paves the way for efficient and agile data processing.

Resource: Databricks

Most people like