Scaling compute for population-scale data

Azure HDInsight is a cloud service provided by Microsoft Azure to process big data. It supports various open-source analytics engines including Apache Hadoop, Spark, HBase, and more. HDInsight enables scalable processing of vast amounts of data, integrating well with Azure services for storage, such as Azure Blob Storage and Azure Data Lake Storage.

One of the key features of HDInsight, especially when working with Apache Spark, is its ability to scale computation resources dynamically to meet demand. This document outlines how scalability is achieved within Azure HDInsight, focusing on the integration with the Livy REST API for managing Spark sessions, and detailing how Apache Spark scales computation across nodes.

Scalability in Azure HDInsight

Dynamic Allocation of Resources

Azure HDInsight achieves scalability through dynamic allocation of resources, allowing clusters to scale out or in based on workload demands. This flexibility ensures that users can optimize the cost and performance of their big data applications. The service supports both manual and automatic scaling:

  • Manual Scaling: Users can manually adjust the number of nodes in a cluster based on their current needs.

  • Automatic Scaling: HDInsight can automatically add or remove nodes based on load or specific metrics, such as CPU utilization or memory usage.

Integration with Azure Infrastructure

Azure HDInsight clusters are deeply integrated with the Azure infrastructure, enabling seamless scaling across Azure's global network. This integration allows HDInsight to provision additional nodes rapidly and ensure data locality, reducing latency and improving performance.

Livy REST API for Session Management

Apache Livy is an open-source REST service for Apache Spark that provides easier interaction with Spark clusters. Livy enables remote management of Spark sessions and jobs, supporting a wide range of programming languages through its REST API.

Livy Sessions

Livy manages Spark sessions, which are interactive environments where users can execute Spark code without managing the underlying Spark context. Sessions can be created, monitored, and killed through the Livy REST API, providing a high level of control over Spark computations. Livy supports two types of sessions:

  • Interactive Sessions: Allow for interactive, iterative computing. Users can submit code snippets to be executed in the context of an existing Spark session.

  • Batch Sessions: Designed for submitting batch jobs. A new Spark context is created for each job, and the job runs to completion before the context is terminated.

Session Scalability with Livy

Livy enables scalable Spark session management by abstracting the complexities of Spark context initialization and management. It allows HDInsight users to focus on their data processing logic rather than on infrastructure management. Livy sessions scale with the underlying Spark cluster, benefiting from Spark's dynamic resource allocation mechanism.

Apache Spark Scalability

Apache Spark is designed for massive scalability, able to handle petabytes of data across thousands of nodes.

Dynamic Resource Allocation

Spark's dynamic resource allocation feature allows it to add or remove executor instances dynamically based on the workload. This ensures efficient utilization of resources, scaling up during high demand and scaling down during low demand periods.

Computation Scaling

Spark scales computation by distributing data and tasks across the cluster. It uses a distributed data structure known as Resilient Distributed Datasets (RDDs) to achieve fault-tolerant, parallel data processing. The Spark engine automatically partitions data across nodes, and computations are executed close to where data resides, minimizing network overhead.

Node Provisioning on Demand

In the context of Azure HDInsight, Spark clusters can dynamically provision additional nodes in response to increased demand. This elasticity is supported by Azure's infrastructure, which allows for rapid provisioning and integration of new nodes into the existing cluster.

Scalability Limits

The scalability of Azure HDInsight with Spark and Livy is subject to Azure's limits on resources and the specific configurations of the HDInsight cluster. Generally, HDInsight clusters can scale to thousands of nodes, handling petabytes of data. The actual scalability limit depends on factors such as:

  • Azure subscription limits.

  • The chosen HDInsight tier and configuration.

  • Network bandwidth and latency within the Azure environment.

  • Data storage and management practices.

Scalability Stories

Databricks' Petabyte Sort

In 2014, Databricks conducted an experiment where Apache Spark sorted 100 TB of data (1 trillion records) 3X faster using 10X fewer machines compared to Hadoop MapReduce. They further pushed Spark to sort 1 PB (10 trillion records) on 190 machines in under 4 hours, a task that previously took Hadoop MapReduce 16 hours on 3800 machines. This achievement marked Spark as the fastest open-source engine for sorting at petabyte scale and demonstrated its capability to process datasets much larger than the aggregate memory in a cluster.

Facebook's 60 TB+ Production Use Case

Facebook shared a production use case where Apache Spark was used to process over 60 TB of data. Initially starting with smaller datasets, they gradually scaled up to 20 TB and beyond. This particular use case required numerous improvements and optimizations to both the core Spark infrastructure and the application itself. Spark managed to shuffle and sort over 90 TB of intermediate data and run 250,000 tasks in a single job, demonstrating significant performance improvements over the previous Hive-based pipeline. This example underscores Spark's ability to efficiently leverage memory, optimize code, and reuse JVMs across tasks for better performance at scale. These examples highlight Apache Spark's robustness and efficiency in handling petabyte-scale data processing, making it a preferred choice for organizations dealing with large-scale data challenges.

Last updated