Performance analysis of BigData Frameworks using BigBench
Abstract
The ALOJA benchmarking platform is expanded with the first standardized Big Data benchmark: BigBench, in which a elasticity test extension is added. By making use of ALOJA and BigBench we compare the de facto SQL Big Data engine: Hive, against the on-growing Spark-SQL.
Full text
Facultat d’Informàtica de Barcelona Universitat Politècnica de Catalunya Big Data Data Management Systems performance analysis using Aloja and BigBench Author: Alejandro Montero Rivero Supervisor: David Carrera Pérez Co-Supervisor: Nicolas Poggi Barcelona Supercomputing Center (BSC) Data Centric Computing group Master in Innovation and Research in Informatics Spring 2018
Project information Project title: Student name: Alejandro Montero Rivero Degree: Master in Innovation and Research in Informatics Modality: A Director: David Carrera Pérez Co-Director: Nicolas Poggi Tribunal members (name and sign) President: Vocal: Vocal 2: Substitute: Qualifications Numerical qualification: Descriptive qualification: Date:
Abstract Traditional RDMBs cannot accommodate the need to analyze large volumes of data that may contain non-structured information, while also performing interactive applications that run through the data more than once. SQL-like Big Data infrastructure, offers the benefits of Big Data architectures with the ease of the SQL language. In this thesis project, the ALOJA benchmarking platform is expanded with the first standardized Big Data benchmark: BigBench. By making use of ALOJA and BigBench, it is possible to test SUTs and engines in discrete scenarios or discover possible bottlenecks. A proposed BigBench expansion, allows to test engine elasticity and how they react to workloads with diverse complexity. We demonstrate the capabilities of ALOJA and BigBench by analyzing the de facto SQL Big Data engine: Hive, against the on-growing Spark-SQL. Spark shows ahead in CPU intensive applications, while lacking performance in disk access when using rotational disks, even throttling network and CPU at high levels of concurrency. Hive requires more memory per CPU core than Spark, becoming unreliable when workload complexity grow. The expanded BigBench architecture allowed to detect a difference in task management between engines. Hive parallelizes independent tasks, assigning resources in function of their complexity. Spark, on the other hand, eliminates concurrency by executing tasks in a sequential order and assigning them the complete cluster resources.
Contents Contents ....................................................................................................................... 5 Figures .......................................................................................................................... 7 Tables ........................................................................................................................... 8 Chapter 1: Introduction ................................................................................................... 9 1.2 Problem statement ........................................................................................... 10 1.3 Project goals ..................................................................................................... 11 1.4 Motivation ........................................................................................................ 11 1.5 Related work ..................................................................................................... 13 1.6 Thesis structure ................................................................................................ 13 Chapter 2: Technological background ........................................................................... 15 2.1 BigBench ........................................................................................................... 15 2.1.1 Reference implementation details ............................................................ 16 2.2 Aloja .................................................................................................................. 17 2.3 Apache Hadoop ................................................................................................ 17 2.4 Apache Spark .................................................................................................... 18 2.5 Apache Hive ...................................................................................................... 19 2.6 Apache Mahout ................................................................................................ 20 Chapter 3: Experimental setup and methodology ....................................................... 21 3.1 Hardware .......................................................................................................... 21 3.2 Software............................................................................................................ 21 3.3 Methodology .................................................................................................... 22 Chapter 4: Benchmark automation ............................................................................... 24 4.1 Benchmark integration in ALOJA ...................................................................... 24 4.1.1 Engine integration ..................................................................................... 25 4.1.2 Benchmark integration .............................................................................. 27 4.1.3 Query execution architecture.................................................................... 29 4.1.4 BigBench extension ................................................................................... 30 4.2 Engine configuration......................................................................................... 32 4.2.1 Hadoop ...................................................................................................... 32 4.2.2 Hive ............................................................................................................ 33
4.2.3 Tez .............................................................................................................. 36 4.2.4 Spark .......................................................................................................... 39 4.2.5 Final engine configuration ......................................................................... 43 Chapter 5: Experimental evaluation ............................................................................. 45 5.1 Sequential query execution .............................................................................. 45 5.1.1 SQL-only queries ........................................................................................ 46 5.1.2 MapReduce-type post-processing ............................................................. 48 5.1.3 Natural language processing ..................................................................... 50 5.1.4 Machine Learning ...................................................................................... 52 5.2 Throughput tests .............................................................................................. 56 5.2.1 2-Stream concurrency ............................................................................... 57 5.2.2 4-Stream concurrency ............................................................................... 59 5.2.3 8-Stream concurrency ............................................................................... 61 5.2.4 Spark ML1 vs Spark ML2 with concurrency ............................................... 62 5.3 Multiple Scale factors ....................................................................................... 62 Chapter 6:onclusions and future work.......................................................................... 68 6.1 Future work ...................................................................................................... 70 References ...................................................................................................................... 71 Annexes .......................................................................................................................... 73 Annex A: Yarn log parsing code .................................................................................. 73 Annex B: Complete Power-Test execution times ....................................................... 78 Annex C: Throughput test Stream placement ............................................................ 79
Figures Figure 1. Big Data components. ....................................................................................... 9 Figure 2. Big Data landscape in 2017.............................................................................. 12 Figure 3. BigBench data-layer overview ......................................................................... 15 Figure 4. BigBench reference infrastructure architecture ............................................. 16 Figure 5. Hadoop MapReduce, HDFS and Yarn architecture ......................................... 17 Figure 6. Spark architecture ........................................................................................... 18 Figure 7. Hive architecture ............................................................................................. 19 Figure 8: ALOJA simplified benchmarking tool architecture .......................................... 25 Figure 9. Query execution architecture .......................................................................... 30 Figure 10. Expanded query execution architecture ....................................................... 31 Figure 11. Execution times for the parameter hive.mapjoin.smalltable.filesize ........... 34 Figure 12. Execution times for the parameter hive.nonconditionaltask.size ................ 35 Figure 13. Execution time and CPU utilization for Mapper parallelism ......................... 37 Figure 14. Execution time and CPU utilization for Reducer parallelism. ....................... 38 Figure 15. Spark executor memory hierarchy ................................................................ 39 Figure 16. Execution time and CPU usage for up to 10 Spark executors ...................... 41 Figure 17. Memory usage per node for Spark ............................................................... 42 Figure 18. BigBench power tests execution times per engine and query type ............. 45 Figure 19. Execution time of SQL-only queries 12 and 16 ............................................. 46 Figure 20. Disk and Network utilization in query 12 ...................................................... 47 Figure 21. CPU states for BigBench processes in query 16 ........................................... 47 Figure 22. Execution time of MapReduce query 30 ....................................................... 49 Figure 23. CPU and Network utilization in query 30 ...................................................... 49 Figure 24. Execution time of NLP query 18 .................................................................... 51 Figure 25. CPU and Network utilization in query 30 ...................................................... 51 Figure 26. CPU trace of NLP query 10 ............................................................................ 52 Figure 27. Query 5 execution flow using Mahout and Spark ML ................................... 53 Figure 28. Execution time of the different query 5 sections for Mahout, Spark ML ..... 54 Figure 29. CPU trace of query 5 for Hive and Spark master nodes ................................ 55 Figure 30. Execution times of query 5 combined ML sections ....................................... 56 Figure 31. Execution time of concurrency tests with 2 and 4 parallel Streams ............. 57 Figure 32. CPU traces for 2-Stream concurrency ........................................................... 57 Figure 33. Disk and Network traces for 2-Stream concurrency ..................................... 58 Figure 34. CPU states of BigBench processes for 2-Stream concurrency ...................... 58 Figure 35. Memory traces for 2-Stream concurrency .................................................... 59 Figure 36. CPU traces for 4-Stream concurrency ........................................................... 59 Figure 37. Disk and Network traces for 4-Stream concurrency ..................................... 60 Figure 38. Memory traces for 4-Stream concurrenc ...................................................... 60 Figure 39. Execution time of 8-Stream concurrency test ............................................... 61 Figure 40. Spark ML 1 and Spark ML 2 execution times of concurrency tests............... 62 Figure 41. Execution times for a Multiple Scale Factor test ........................................... 63
Figure 42. Number of concurrent queries during the execution of the extended BigBench elasticity test ................................................................................................................... 65 Figure 43. Number of concurrent tasks during the execution of the extended BigBench elasticity test ................................................................................................................... 66 Tables Table 1. BigBench query classification ........................................................................... 16 Table 2. Hardware description ....................................................................................... 21 Table 3. Software versioning .......................................................................................... 21 Table 4. BigBench configuration parameters ................................................................. 28 Table 5. BigBench environment variables ...................................................................... 28 Table 6. Expanded environment variables ..................................................................... 32 Table 7. Depiction of memory and CPU assignment and Yarn actual allocations. ........ 40 Table 8. Final simplified engine configuration ............................................................... 44
Chapter 1 Introduction 9 Chapter 1 Introduction As of June 2017, 51% of the world’s population is on the Internet and 3.2 billion people are estimated to be online by the end of the year. According to a study by Cisco, the amount of IP traffic is going to triple by 2021 [17] and the number of mobile devices connected to the Internet will exceed the number of inhabitants of the planet Earth. Those devices will be generating data constantly, and more than 130 Exabytes will be created annually in the form of plain text, metadata, video, GPS coordinates, sensor data, automobiles, etc., data will have many different shapes. The term Big Data refers to very big datasets (Volume) rapidly created (Velocity) and non-relational (Variety) that Classical Data Base Management Systems (DBMS) are unable to process with high performance. DBMS management technologies can easily aggregate, filter or search in very big datasets but are not suited for more complex algorithms such as Machine Learning, signal processing or Deep Learning. Big Data is the solution for interactive applications that have to go over the dataset multiple of times until convergence. As for now, Big Data is the union of two worlds, data management and data analytics. Application Big Data Figure 1. Big Data components.
Chapter 2 Background and related work 16 Query Method Query2 Method3 Query4 Method5 1 UDF/UDTF/MR 11 Pure QL 21 Pure QL 2 MapReduce 12 Pure QL 22 Pure QL 3 MapReduce 13 Pure QL 23 Pure QL 4 MapReduce 14 Pure QL 24 Pure QL 5 ML 15 Pure QL 25 ML 6 Pure QL 16 Pure QL 26 ML 7 Pure QL 17 Pure QL 27 UDF/UDTF/NLP 8 MapReduce 18 UDF/UDTF/NLP 28 ML 9 Pure QL 19 UDF/UDTF/NLP 29 UDF/UDTF/MR 10 UDF/UDTF/NLP 20 ML 30 UDF/UDTF/MR Table 1. BigBench query classification 2.1.1 Reference implementation details The reference implementation [15] currently supports the Hadoop ecosystem-only, and specifically relies on Hive for the database description (meta-store) to access the structured data. Queries are also written in HiveQL, and SQL-like adaptation. But as several products support Hive integration, it can also be accessed from other projects directly including Spark. On the Machine Learning side, the first release of BigBench only offered support for Mahout, while the current v1.2 also supports MLlib, the Machine Learning library for Spark 1 and 2. Figure 4 summarizes the composable matrix of commonly used frameworks and libraries in the Hadoop ecosystem. Figure 4. BigBench reference infrastructure architecture
Chapter 2 Background and related work 17 2.2 Aloja Aloja project is a collaborative engagement between the Barcelona Supercomputing Center (BSC) and Microsoft to explore the performance behavior and price of Big Data Infrastructure. Aloja is composed by a set of open source tools to automatically deploy, configure and execute benchmark suites in any given platform both on-premise or cloud while gathering metrics for later study. Initially, ALOJA was an initiative to characterize cost-effectiveness of Hadoop deployments. The project also maintains a complete repository containing thousands of Hadoop executions, used as a test bed to evaluate the cots-effectiveness of different hardware, parameters and Cloud services of Hadoop. The platform is composed of a series of modules that encompass the deployment and configuration of software in on-premise and Cloud clusters, automated benchmark execution, metric gathering and result storage in a centralized DataBase. ALOJA also offers an online Analytics tool publicly accessible at [9], used to share and browse performance metrics of executed benchmarks. Infrastructure can be individually modified between executions to tune the level of parallelism, split sizes, join behavior, heap size, CPU usage and more. This easy to tune infrastructure allows to rapidly test many different configurations and insight about how the different engines interact with each other. Alongside the infrastructure, all available benchmarks are also configurable, allowing to switch the data size, execution engines, data-lakes, data-warehouses, Machine Learning applications and even individual subbenchmark parameters. 2.3 Apache Hadoop Hadoop is considered the first open source Big Data framework that existed, presented in 2006 it combined a reliable, fault tolerant and distributed file system called HDFS [19] and a programming model called MapReduce [16], capable of processing huge amounts of data in an “embarrassingly parallel” manner. In 2012 Hadoop introduces a resource manager called “Yet another Resource Negotiator” or YARN [20]. Figure 5. Hadoop MapReduce, HDFS and Yarn. Source: Hadoop the Definitive Guide 4th edition
Chapter 2 Background and related work 18 The programing model MapReduce inherits a specific implementation of the split-apply-combine strategy found in functional programming and adds a layer of faulttolerance on top of it. Initially the input data is split in small batches of data in a keyvalue format; each node then receives data related to a single key and applies a “Map” function to the local data. Worker nodes redistribute data according to the output keys in a shuffle step. Finally, each worker applies a “Reduce” function to every key-value pair result of the “Map” step. The main drawback of MapReduce is that it is disk-oriented; in essence, every worker writes down partial results to a local disk after completing each step. Hadoop Distributed File System is a Write Once Read Many file system that mainly supports batch computations. HDFS splits data in immutable chunks of fixed size (typically 64 or 128 MB) and distributes them across all nodes in a cluster. Chunks can be replicated a number of times to add fault-tolerance to the system (typically 3 times). HDFS is also responsible of sending missing data portions to worker nodes that request them. Finally, Hadoop versions 2.x bundles a widely used resource manager called Yarn. Yarn manages resources of every node in the cluster, as to say, RAM and CPUs, packing them in a set of “containers”. A central agent controls all running and available containers. If a framework request a container Yarn will allocate one when available in one of the nodes of the cluster. Yarn is capable of working with a wide set of frameworks, reason for which it has become the “de facto” resource manager in the whole Hadoop ecosystem. After 2015, MapReduce started to lose steam against solutions such as Spark that relies in on-memory only computation, avoiding expensive disk access. However, the Hadoop core elements HDFS and Yarn are still being widely used in the Big Data ecosystem. 2.4 Apache Spark Apache Spark [18] is a cluster-centered programing model similar to MapReduce that relies on in-memory computation using a data structure called “Resilient Distributed Dataset” or RDD, a read-only multiset of data items distributed over all the nodes in a cluster. RDD facilitate the implementation of iterative algorithms such the ones used in Machine Learning or Deep Learning. Since its inception in 2014, Spark has endured a heavy development process that has mutated the initial idea into a whole framework. Spark now consists of plenty of modules with very different functionalities.
Chapter 2 Background and related work 19 All libraries run on top of Spark core, improving user interaction with SQL-like queries, streaming of endless data sources, Machine Learning algorithms or graph analytics. Spark is also capable of running on top of most common database systems, HDFS, Hive, Cassandras, MongoDB, etc. Spark has become an all-in-all solution that provides a full stack solution for Big Data applications, providing infrastructure and analytics in a single package. 2.5 Apache Hive Apache Hive [21] is a data warehouse solution built on top of Apache Hadoop to provide an easy to use query-like abstraction for accessing HDFS data. Hive SQL abstraction makes easy for computer scientist without knowledge of Hadoop to start processing huge quantities of data. Actual physical data is stored in HDFS, in consequence Hive stores metadata that translates the abstracted user tables into HDFS files and it’s locations. Hive is not only capable to retrive data from HDFS in an easy maner, but it is capable, as well, to run User Defined Functions (UDF) and classical SQL operations such as joins, unions or aggregations. All this operations are performed by a framework with direct access to HDFS such as MapReduce, Spark or Tez. Apache Tez [22] is the main execution engine used in this project as it is considred “the successor” of MapReduce. Tez generalizes Map and Reduce tasks using generic interfaces: Input, output and processing, generating a Direct Acyclic Graph (DAG) that greatly reduces latencies and disk access. On top of that, pipelining data through different stages and in-memory shuffles significantly improves overall execution times, bringing MapReduce jobs on-par with Spark. Spark SQL Spark Streaming Spark Core Spark MLlib GraphX Figure 7. Hive architecture
Chapter 2 Background and related work 20 2.6 Apache Mahout Apache Mahout [23] is a distributed linear algebra framework primarily used to perform scalable machine learning on the Hadoop Ecosystem. Mahout is built on top of Hadoop and utilized the MapReduce paradigm to support four main data science use cases: • Collaborative filtering: Analyze user behavior and make recommendations. • Clustering: Grouping objects that are close to each other by means of a specific characteristic than to those in other groups. • Statistical classification: Identify into which set of categories a new observation belongs. It requires a training set with already categorized observations. • Frequent itemset mining: Discover relations between objectes that appear together in a group. Mahout provides an implementation for many machine learning algorithms that are part of the groups previously explained. Despite many of said algorithms can run in an entirely distributed fashion, some can only run in local mode. Mahout is used in this project to perform the Machine Learning sections of some of the BigBench queries as it was one of the first ever ML engines to be introduced in the Hadoop Ecosystem, and is still, one of the most utilized frameworks in industry and science.
Chapter 3 Experimental setup and methodology 21 Chapter 3 Experimental setup and methodology 3.1 Hardware The experiments are performed in a 17-node cluster connected through a 1Gbit switch, with a single Master node and 16 DataNodes. The master node houses control processes such as the Resource Manager, NameNode and runs the client-side BigBench code. The actual processing and execution of the queries is performed by the DataNodes. Component Description CPU model Intel Xeon E5-2630L 2.00Ghz CPU cores/threads per node 2x (6 cores / 12 threads) Total CPU cores/threads (DataNodes) 192 cores / 384 threads Memory per node 16x 4GB Kingston DDR3 1333Mhz Total memory (DataNodes) 1TB SSD 1x 240GB SanDisk CloudSpeed eco SATA HDD 6x 1TB Seagate 2.5’’ 8MB cache 5.400 RPM Sata HDD – boot 1x 1TB WesternDigital 2.5’’ 8MB cache 5.200RPM SATA Network Cisco 3750-X 1Gbit switch Table 2. Hardware description 3.2 Software Software Version Operating System Ubuntu 14.04 Java JDK JDK1.8.0_101 Hadoop 2.7.3 Hive v1 1.2.1 Hive v2 (Not working) 2.2.0 Tez 0.8.5 Spark v1 1.6.3 Spark v2 2.1.1 Sysstat 10.2.0 Python 2.7.6 Table 3. Software versioning
Chapter 3 Experimental setup and methodology 22 3.3 Methodology All experiments presented in this thesis are performed using ALOJA. ALOJA offers and automated framework to execute, monitor, and store results from different benchmarks in both Cloud and on-premise clusters. As part of this project, ALOJA is expanded appropriately to use BigBench; this includes incorporating Hive, Spark, Tez and other software in the core framework alongside the benchmark itself. ALOJA eases the experimental section of this project as it allows to execute tens of benchmarks in a sequential order with specific parameters that configure the benchmark and all the required engines, while also gathering system metrics using the Sysstat system package. Resulting execution logs, metrics, configurations and results are compressed and stored in a shared filesystem for future access. Access to this data is restricted and secured behind the UPC-DAC security firewall. All executions are backed up with system metrics gathered by the Sysstat system package that provides information regarding: A) CPU utilization, including stats such as IDLE time, I/O waiting, System, etc. B) Network utilization. C) Disk utilization, with distinction for read and write. D) Memory utilization. Individual metrics are gathered from each node of the cluster and averaged for a final graphical representation using scripts at the end of the execution. This metrics are public and available at [24]. It is also possible to visualize individual node metrics and also discrete execution steps of the benchmark, or queries in BigBench. As a result, it is possible to analyze the overall performance of the whole cluster for complete benchmark in a coarse-grained manner, or a single query in a selected node in a fine-grained manner. Big Data engines are complex in nature and provide many configuration parameters that can greatly change performance. As part of the automation of the experimental setup, a good overall configuration is required to evaluate the engines in a fair scenario. In this configuration evaluation, only the most relevant parameters are analyzed, always in a vacuum state, which means that all configuration parameters are rest in the “default” configuration besides the one in test. This approach allows to analyze how a single parameter affects the overall engine. However, multiple parameters may affect each other in unexpected ways; this effect is not taken into account in this thesis, as a deeper analysis would require time far beyond the reach of this project. Binary parameters (True or False), are not considered in this evaluation and are configured using the most logical and advised option by the community with the objective of reducing time, cluster usage and costs. Finally, all parameters that configure the resource utilization are set to take advantage of the full cluster resources. All in all, the objective is for the engines to fully utilize cluster resources in a “good overall” manner that can provide a fair comparison. The first round of comparisons is performed using the sequential BigBench execution which consists on running the 30 queries without concurrency in an ascending order. These experiments allow to analyze how each engine performs in very different scenarios. As an example, a single query is selected per type (SQL, Machine Learning,
Chapter 3 Experimental setup and methodology 23 Natural Language Processing and MapReduce pre-processing) and analyzed exhaustively presenting performance metrics to prove in which scenarios each engine shines. Concurrency is then added in the second round of comparisons, with multiple queries running at the same time. During the execution it is not possible to change the concurrency level. Multiple executions are performed with 2, 4 and 8 queries running concurrently. In contrast with the previous round, discrete queries can’t be analyzed, for that reason the overall execution is studied as a whole. All executions are presented separately for the selected concurrency level, again using performance metrics to analyze how CPU, memory, disk and network behaves for each engine. Current benchmarks request static resources from the cluster. For that reason, and extension of BigBench is proposed and used as the final evaluation. This extension allows to execute multiple concurrency tests, each one requesting a different scale factor. This new set of tests allow to analyze the elasticity of each engine when there are multiple threads requesting different resources. As part of the evaluation a single test is performed in each engine with three threads, requesting few, average and many resources respectively. The performance metrics utilized in previous rounds can’t differentiate between threads, in consequence they allow to study the overall execution rather than a single thread. For that reason, a further study of the Yarn logs is introduced, allowing to graphically represent which of the threads are running at every step of the execution and how many containers they have requested. As a common ground, failed executions are re-run and no failed queries are allowed in any execution step. If a reconfiguration is required to execute very complex tasks, said execution is not performed to avoid invalidating the ones previously completed. As part of the analysis, the reason for any failed query is analyzed and the solution is proposed, while the failure is considered to make the engine less “robust” as a result.
Chapter 4 Benchmark automation 24 Chapter 4 Benchmark automation 4.1 Benchmark integration in ALOJA Initially, ALOJA was created to benchmark the Hadoop Core, specially MapReduce in all its major versions by using primarily HiBench, and Hadoop-Examples. As part of this project, ALOJA is expanded to allow more engines, including Hive and Spark and other benchmark suites. One of the main objective of the project was to integrate BigBench as a core part of ALOJA, however, other decision-based benchmarks that rely on query-type business use cases became compatible as well; TPC-DS or TPC-H are some examples of compatible benchmarks. The following subsections describe the expanded core of the ALOJA benchmarking module for this project. All source code is now part of the master version of ALOJA and can be found at [25]. ALOJA is a modular framework that includes an automated benchmark tool, a repository that contains thousands of executions from on-premise and cloud clusters, and ML tools used to predict costs, execution times, etc. As part of this project, though, only the benchmark tool has been expanded and used. Figure 8 depicts the simplified architecture of the ALOJA benchmarking tool. At first glance Aloja transforms any given cluster into a Platform as a Service that downloads, prepares and executes a given benchmark with total transparency for the user. The preparation of all required software works as follows: 1. The software is downloaded once from the Internet, using only official repositories. 2. Configuration templates are fetched from the code repository. Custom templates have been created for each new software, parametrizing most configurations. 3. The software tarballs are distributed and uncompressed across the whole cluster. 4. Custom configurations are built independently in each node, using the provided templates and inserted into the engine. Once all required software is prepared and ready in each node, Aloja initiates the execution of the benchmark suite in the master node. During the execution Aloja is in charge of monitoring and recovering various performance metrics.
Chapter 4 Benchmark automation 25 Figure 8: ALOJA simplified benchmarking tool architecture Metric gathering is made by a set of daemons running in every node recovering many system metrics including CPU usage, memory, disk access and networking. All metrics are compressed and packet alongside all infrastructure and benchmarks logs, which can later be used to generate exhaustive and discrete metric charts for a given execution. 4.1.1 Engine integration As part of this thesis several engines are integrated in the core of the ALOJA benchmarking tool. Those engines are: A) Hive. B) Tez. C) Derby. D) Spark. E) Mahout. All these engines are integrated following the ALOJA procedure that involves 4 main steps. 4.1.1.1 Engine download ALOJA is capable of downloading all engine required binaries in a distributed fashion. The procedure is simple, initially the master node downloads tarball containing all engine requirements: binaries, scripts, libraries, etc., and distributes the file across the whole cluster using a shared folder. Engine versions are parametrized, so it is possible for the user to select which version of the engine to use. User-side, the selection of the version is performed when calling the ALOJA binaries: HIVE_VERSION=hive-2.2.0 $ALOJA_PATH/run-benchs.sh
Chapter 4 Benchmark automation 32 Environment var. Definition Default BIGBENCH_MODE Execute the selected test sequentially or in parallel Sequential SCALE_FACTORS Number of scale factors to run the test with. Overrides -B option Not set Table 6. Expanded environment variables 4.2 Engine configuration Every single Big Data infrastructure solution has a large number of configurations that can radically change the performance and behavior of the engine, and even if misconfigured, fail the execution of a task entirely. The objective of this section is to characterize both Hive and Spark in an overview manner and try find the best possible configuration that ensures the fairest comparison. Both engines have a complete different approach that require not only different CPU and memory settings, but also specific configurations that radically change the functionality of the overall architecture. BigBench power tests (30 discrete queries executed without concurrency) are used to measure the effects of the most important parameters in both engines. BigBench is a great benchmark to perform the characterization, as the combination of pure declarative queries, ML and NLP provides a great variety of scenarios to test the settings. 4.2.1 Hadoop Both tested engines share the same resource manager and filesystem, Hadoop Yarn and Hadoop HDFS respectively. Being part of the same software bundle greatly simplifies the configuration, however this baseline can greatly benefit or harm the overall performance of both engines. Apache HDFS is probably the least overall configured system in the whole stack, maintaining most of the default configurations, including the block size at 128MB. However, replication is reduced to 1 to save space as fault tolerance is not tested in any experiment. Local folders for both the NameNode and DataNodes are located on HDD while temporal files reside in SSD. Hadoop Yarn abstracts the whole set of resources of the cluster by maintaining a set of so called “containers” which are a bundle of CPUs and physical memory assigned to an engine to perform a task. As such, Yarn is a critical component to configure, with the objective of fully utilize the available resources. Any node in the cluster can be individually configured to create a heterogeneous cluster, however, the test cluster shares the same components across all machines, as such, a homogeneous configuration is used with the following critical parameters: • Container minimum RAM: 512MB. • Container maximum RAM: 54.272MB. • Max memory to allocate to containers: 54.272MB.
Chapter 4 Benchmark automation 33 • Minimum number of cores to allocate per container: 1. • Maximum number of cores to allocate per container: 23. Finally, a last configuration is required for Yarn to take into consideration CPU as a first-class resource. By default, Hadoop utilizes a capacity calculator that takes into consideration main memory only, which can cause odd CPU behavior, resource underusage, container allocation in busy nodes and even containers exceeding quotas. This issue is even more pronounced in Spark, which makes use of “fat” containers called “executors” with huge quantities of memory and CPUs. Using the default scheduler can cause Spark executors to use just a single CPU core heavily underutilizing the cluster resources. For this reason, is extremely important to change the default DefaultResourceCalculator for the more complete DominantResourceCalculator. Fortunately, both schedulers are bundled with Hadoop and can be changed in a simple configuration parameter. 4.2.2 Hive Hive offers the user an abstraction layer of the data stored in HDFS using relational tables and a declarative language similar to SQL. This abstraction greatly helps the transition from classical Data Base Management Systems (DBMS), into the world of Big Data, that offers expanded functionalities such as processing of semi and nonstructured data using User Defined Functions (UDF). Due to the architectural nature of Hive, most classical challenges of DBMS are still present, being joins a major issue in a totally distributed environment. Table joins would be costly to replicate using MapReduce techniques (which Tez utilizes), as a join involves a map stage and a reduce stage. Mappers read from tables and emit intermediate key-value results that need to be shuffled, a very expensive task that requires to sort and merge all table rows. The reducer recovers the sorted pairs and performs the actual join. Hive introduces MapJoins, an optimization which allows to load a table into memory and perform a join with another table within a mapper, without having to use a shuffle and a Reduce stage. Only small tables that do not surpass the value of hive.mapjoin.smalltable.filesize threshold are loaded into the memory of all mappers to perform a MapJoin. BigBench utilizes several small tables to store static information such as dates, countries, addresses etc., information which many queries rely on.
Chapter 4 Benchmark automation 34 Figure 11. Execution times of a BigBench power-test with the parameter hive.mapjoin.smalltable.filesize setted at 25MB (Smalltable-1), 50MB (Smalltable-2) and 100MB (Smalltable-3) Figure 11 shows that even though it is advisable to activate MapJoins to improve performance, increasing the maximum size of the small table to fit in memory does not provide any major benefits. In fact, it reduces slightly the performance. The default configuration sets the threshold at 25MB (Smalltable-1) and offers the best performance compared to doubling the threshold at 50MB (Smalltable-2) and setting it at 4 times (Smalltable-3). Performance metrics are not conclusive on why increasing the threshold harms the performance, however, as BigBench has very few small tables, all of which always have the same size regardless of the selected scale factor (these tables are used to store country codes, dates and other static information), would explain why increasing the threshold does not provide any benefits. Hive can also perform a MapJoin when three or more tables are involved in a join condition. Hive then generates N-1 MapJoins assuming all tables are smaller than hive.mapjoin.smalltable.filesize. To further improve performance, Hive can combine the MapJoins into a single map-side join if the size of the N-1 tables combined does not surpass the value of hive.auto.convert.join.nonconditionaltask.size. Three combinations of this value are tested with relative values of 10, 20 and 30 % of the memory size assigned to the container. These experiments are called Nonconditional_joins-1, Nonconditional_joins-2 and Nonconditional_joins-3 respectively. 218,1291 224,9998 218,6368 0 60 120 180 240 300 360 Smalltable-1 Smalltable-2 Smalltable-3 Execution time (m)
Chapter 4 Benchmark automation 35 Figure 12. Execution times of a BigBench power-test with the parameter hive.auto.convert.join.nonconditionaltask.size setted at 10% (Nonconditional_joins-1), 20% (Nonconditional_joins-2) and 30% (Nonconditional_joins-3) of the memory allocated per container Figure 12 shows the execution time of running the 30 BigBench queries sequentially when increasing the maximum allowed memory to perform a N way MapJoin, starting with a 10% of the total allocated container memory, a 20% and up to a 30%. As it can be seen, increasing the memory threshold for a N-way MapJoin clearly benefits execution time with a maximum of a 16% speedup when increasing the memory to a 30%. However, using the proposed techniques and metrics of this project we haven’t found a compelling reason that backups the perceptible difference in execution time. CPU utilization, disk access for both read and write, memory utilization and even network usage is mostly the same across the three executions, with the exception of execution time. Despite this, some queries show slightly less I/O waiting when increasing the N- way join memory, even though this difference is not enough to explain the great difference in execution times. Other important configurations include the vectorized query execution, which reduces CPU usage for typical query operations like scans, filters, aggregates and joins. This is accomplished by creating streamline operations that processes complete blocks of 1024 rows at a time instead of processing one single row. Within the block, each column is stored as a vector which eases iterating for arithmetic operations and effectively use cache. Column and partition stats are also automatically gathered allowing to use the Cost-Based Optimization (CBO) which allows to remove reduce operations in several tasks, by making decisions such as: how to order a Join and which algorithm to use, persist intermediate results or recompute on operator failure, degree of parallelism at any operator, etc. Finally, even though Metastore files are stored in HDD, temporal files are, as in every other engine, stored in SSD. 260,71 237,88 221,22 0 60 120 180 240 300 360 Nonconditional_joins-1 Nonconditional_joins-2 Nonconditional_joins-3 Completion time (m)
Chapter 4 Benchmark automation 36 4.2.3 Tez Tez, as the data processor engine used in Hive, requires a set of configurations similar to MapReduce, in essence, the amount of memory and CPU to use for Map and Reduce tasks. In a Yarn cluster, all tasks are executed in isolated containers with a fixed allocation of memory and CPU. Tez configuration, therefore, requires to configure A) The size of the container to use. B) Mapper parallelism. C) Reducer parallelism. Container size is probably the easiest parameter to configure, as usually the main objective is to maximize the allocation of resources. Utilizing the 1 core per task rule of thumb inherited from MapReduce, the cluster can allocate a total of 345 containers. Memory per container is calculated with the following equation: 𝐶𝑜𝑛𝑡𝑎𝑖𝑛𝑒𝑟_𝑀𝑒𝑚𝑜𝑟𝑦=𝐶𝑙𝑢𝑠𝑡𝑒𝑟 𝑚𝑒𝑚𝑜𝑟𝑦 #𝐶𝑜𝑛𝑡𝑎𝑖𝑛𝑒𝑟𝑠 ~ 814080𝑀𝐵 345 =2359.65𝑀𝐵 ~ 2048𝑀𝐵 This configuration allows a theoretical perfect allocation of CPU and an 86.8% allocation of memory. Yarn logs show a practical allocation very close to the expected numbers: It is possible to determine the initial number of tasks Tez will use to read the input data by defining how many input splits are required. This number is affected by the variables tez_grouping_split_min_size and tez_grouping_split_max_size. Input size is divided by the first variable creating the initial taks count, however, if the number causes a too small grouped split size, task number is recalculated using the former variable. Splits are then grouped by node to take advantage of data locality. To simplify the problem: incrementing the value of these two variables reduces the parallelism while reducing it increments the number of Mappers. Three different configurations are compared for the abovementioned variables, with 8MB/512MB min/max grouping size (denoted Mappers-1), 16MB/1024MB min/max grouping size (denoted Mappers-2) and 32MB/2048MB min/max grouping size (denoted Mappers-2). Results for these experiments can be found in Figure 13. The first chart shows the overall execution time for the thirty queries, executed without concurrency in ascending order. CPU utilization is breakdown in charts subsequent charts. On average, the three configurations show near to no difference in execution time, with just a 1% increased time from Mappers-1 to Mappers-3. The trend, however, shows a slight decline in performance when increasing the grouping sizes. The results suggest that the algorithm Tez utilizes for defining the initial number of mappers is almost not affected by the user input, a statement further demonstrated by the CPU behavior across the three executions, with near exact utilization. root.default stats: default: capacity=1.0, absoluteCapacity=1.0, usedResources=<memory:704512, vCores:343>, usedCapacity=0.9942029, absoluteUsedCapacity=0.9942029, numApps=1, numContainers=343
Chapter 4 Benchmark automation 37 Unlike MapReduce, Reducers in Tez utilize the same resource settings as mappers, but parallelism is deduced from the data size the reducer needs to process using the following formula: 𝑀𝑎𝑥(1,𝑀𝑖𝑛 (ℎ𝑖𝑣𝑒.𝑒𝑥𝑒𝑐.𝑟𝑒𝑑𝑢𝑐𝑒𝑟𝑠.𝑚𝑎𝑥, 𝑅𝑒𝑑𝑢𝑐𝑒𝑟𝑆𝑡𝑎𝑔𝑒 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑 𝑠𝑖𝑧𝑒 ℎ𝑖𝑣𝑒.𝑒𝑥𝑒𝑐.𝑟𝑒𝑑𝑢𝑐𝑒𝑟𝑠.𝑏𝑦𝑡𝑒𝑠.𝑝𝑒𝑟.𝑟𝑒𝑑𝑢𝑐𝑒𝑟))∗ ℎ𝑖𝑣𝑒.𝑡𝑒𝑧.𝑚𝑎𝑥.𝑝𝑎𝑟𝑡𝑖𝑡𝑖𝑜𝑛.𝑓𝑎𝑐𝑡𝑜𝑟 The initial number of reducers is calculated by dividing the estimated Reducer input size, obtained during the Mapper execution stage, by the max size per reducer. This value can be set by the user in the variable hive.exec.reducers.byte.per.reducer which defaults at 256MB per reducer. However, to avoid overloading a reduce stage, the variable hive.exec.reducers.max defines the maximum number of reducers that can be executed per stage (1099 per default). If the required reducers are bigger than the maximum permitted, a new Reduce stage is created with the remaining reducers. Final reduce number is multiplied by a partition factor which defaults at 2. Three configurations for the hive.exec.reducers.byte.per.reducer are tested with sizes 64MB/reducer (denoted Reducers-1), 256MB/reducer (denoted Reducers-2), 1024MB (denoted Reducers-3). Both maximum number of reducers and partition factor are left by default, 1099 and 2 respectively. Results of this experiments can be found in Figure 14. 217,04 218,94 219,53 0 60 120 180 240 300 360 Mappers-1 Mappers-2 Mappers-3 Execution time (m) A B C Figure 13. Execution time and CPU utilization for 8MB/512MB (Fig 9.A), 16MB/1024MB (Fig 9.B) and 32MB/2048MB (Fig 9.C) Min/Max grouping size Mapper Parallelism
Chapter 4 Benchmark automation 38 Reducer parallelism heavily affects execution times, especially on queries that rely on custom data preprocessing. Reducing the number of bytes per reducer increases parallelism, or, increases the number of required tasks to complete a Reduce stage. Performance tends to decrease as the parallelism is reduced, induced by an overall reduction in CPU usage. Reducers-1 averages a 32% of CPU usage and 60% average in heavy reduce-like queries like Q30. Reducers-2 maintains a very close 31% of CPU usage but decreases performance in reduce-like queries, averaging a 50% usage. A very low parallelism in Reducers-3 heavily affects performance, reducing overall CPU usage to just a 19%. Query 3, 4 and 30 shows especially bad results, averaging a 20% CPU usage and extremely long completion times, harming the overall execution time by more than a 30% compared to Reducers-1. Other configurations include the memory assigned when the output requires to be sorted (tez.runtime.io.sort.mb) which is assigned to the 40% of the total container memory. In case the output does not require sorting, the memory is reduced to a 10%. 220,88 232,78 308,08 0 60 120 180 240 300 360 Reducers-1 Reducers-2 Reducers-3 Execution time (m) Figure 14 Execution time and CPU utilization for 64MB/reducer Figure 14.A), 256 MB/reducer (Figure 14.B) and 1024MB/reducer ( Figure 14.C). A B C
Chapter 4 Benchmark automation 39 4.2.4 Spark Apache Spark is a memory-centric framework for BigData processing. As such, the configuration of the engine is significantly different to Hive. Processing in Spark is performed by the executors, which can run many tasks in a single process. Executors remain active during the whole lifetime of the Spark application which greatly improves execution time, as tasks can be initialized with very small overhead. Each executor has assigned a specific amount resources (CPU and memory) by Yarn and is Spark who manages internally how individual tasks are executed inside executors. This architecture creates a coarse-grained resource management as only it is possible to specify the number of executors to run per application and how many resources to give them. Spark memory management is a complex problem that requires three considerations: the amount of memory used by RDD (Basic, immutable data structure of Spark), the cost of accessing those objects and the overhead of Garbage Collection. The user can assign the amount of memory to an executor using the variable spark.executor.memory. This memory is managed internally by Spark for two differentiated categories: execution and storage. Storage memory is used for caching RDDs and propagating internal data across the cluster. Execution memory is used for buffering intermediate data when performing shuffles, joins, sorts and aggregations. Whenever in-memory data reaches the limit for any of the two regions, it is spilled to disk. Cached RDD can be dropped from memory altogether which heavily impacts performance in further accesses. Regardless, in both cases, dropping data from memory worsens performance due to I/O and network. On top of that the JVM requires off-heap memory to be allocated per executor for VM overheads, internal strings, etc, and tends to grow as the spark.executor.memory does so. This memory can be assigned by setting spark.yarn.executor.memoryOverhead. The sum of spark.executor.memory and spark.yarn.executor.memoryOverhead is the total size of the executor container requested to Yarn. Figure 15 depicts the simplified Spark memory hierarchy. Figure 15. Spark executor memory hierarchy In spark 1.6.0 and onwards the fraction of memory assigned to execution and storage is internally managed by Spark, so the user only has to set the amount of memory for the executor and its overhead. As with Hive + Tez, the objective is to allocate as much resources as possible, however, the number of executors is still an important question to solve. Running executors with too much memory and CPUs can potentially
Chapter 4 Benchmark automation 40 result in excessive Garbage Collection times and odd interactions with HDFS, while small executors with very few memory and CPUs can potentially harm parallelism. Even more problematic, both excessive end insufficient memory can drive to failed tasks. With the objective of finding the overall better number of executors six experiments are performed for both Spark-1.6.3 and Spark-2.1.1 with 1,2,3,4,5 and 10 executors per node. Memory and CPUs are assigned based on the following equations: 𝐸𝑥𝑒𝑐_𝑀𝑒𝑚=𝑀𝑖𝑛( 𝑀𝑒𝑚𝑜𝑟𝑦𝑛𝑜𝑑𝑒 𝐸𝑥𝑒𝑐𝑢𝑡𝑜𝑟𝑠𝑛𝑜𝑑𝑒 +𝐸𝑥𝑒𝑐_𝑀𝑒𝑚_𝑂𝑣𝑒𝑟ℎ𝑒𝑎𝑑,𝑀𝑒𝑚𝑜𝑟𝑦𝑛𝑜𝑑𝑒 − 𝐸𝑥𝑒𝑐_𝑀𝑒𝑚_𝑂𝑣𝑒𝑟ℎ𝑒𝑎𝑑) 𝐸𝑥𝑒𝑐_𝑀𝑒𝑚_𝑂𝑣𝑒𝑟ℎ𝑒𝑎𝑑= 𝑀𝑎𝑥( 𝑀𝑒𝑚𝑜𝑟𝑦𝑛𝑜𝑑𝑒 𝐸𝑥𝑒𝑐𝑢𝑡𝑜𝑟𝑠𝑛𝑜𝑑𝑒/ 6,2048𝑀𝐵) 𝐸𝑥𝑒𝑐𝑢𝑡𝑜𝑟𝐶𝑃𝑈𝑠 =⌊ 𝐶𝑃𝑈𝑠𝑛𝑜𝑑𝑒 𝐸𝑥𝑒𝑐𝑢𝑡𝑜𝑟𝑠𝑛𝑜𝑑𝑒⌋ Memory Overhead is the major culprit of tasks failures and high execution times. After many experiments we found the best overall value for this parameter is at least 1 6 of the initial memory allocated for executors, with a minimum of 2GB. 𝐸𝑥𝑒𝑐𝑢𝑡𝑜𝑟_𝑛𝑜𝑑𝑒 Exec CPU Exec Mem (MB) Exec Over (MB) Allocated Mem (%) Allocated CPUs (%) 1 Executor 23 45056 9216 94.97 93.36 2 Executor 11 23040 4608 99.56 92.75 3 Executor 7 15360 3072 98.36 87.54 4 Executor 5 11520 2304 99.50 84.35 5 Executor 4 9011 2048 99.79 75.86 10 Executor 2 3481 2048 99.62 55.00 Table 7. Depiction of memory and CPU assignment and Yarn actual allocations. In order to avoid possible request of more CPU tan available in any given node, the assignment is set to the lower bound of the total number of CPUs divided by the number of executors. As a result of this operation as the number of executors per node grows, more CPU cores are not allocated which can potentially harm execution times. Memory on the other hand, is easier to fully allocate in any given scenario as selecting the lower band in MB is always unnoticeable. Therefore, runtime Yarn allocations, are always greater than 90%.
Chapter 4 Benchmark automation 41 The first round of Spark experiments already shows important insights, Spark 1 is heavily affected by executor configuration and CPU-Memory settings, failing when memory per executor reaches very low levels. Spark 2 seems to tolerate more extreme configurations; however, performance degrades significantly at higher number of executors. Raw execution times denote both versions work better with lower number of executors, peaking performance with just a single one running a time. 1 Exec/node 2 Exec/node 3 Exec/node 4 Exec/node 5 Exec/node 10 Exec/node Spark 1 233,55 252,25 237,30 241,58 Spark 2 181,95 191,89 185,66 197,40 208,91 256,62 0 60 120 180 240 300 360 Execution time (m) Figure 16. Execution time and CPU usage for up to 10 executors for Spark 1 and Spark 2
Chapter 5 Experimental evaluation 48 settings into Spark ones. BigBench was initially conceived for Hive only even though any Hive Metastore compatible engine can theoretically be used as well. This is the case of Spark, which unfortunately takes a significant hit in performance due to the design of BigBench. Alongside the setting parsing, Spark creates both the Master process and assigns resources to the executors before starting the query. The sum of the setting parsing and the assignment of resources heavily affects Spark execution time compared to Hive which can start the processing almost immediately. The fast start of Hive makes it necessary to create containers and assign resources dynamically during the query processing, the dynamic container assigning creates a significant overhead compared to Spark, which can utilize the full cluster resources from the very start of the query. On top of that Spark 2 improves performance over Spark 1, reducing 37% the execution time of the main query section. After the required data is selected and processed, a data shuffle is required to perform a final reduce, the increased number of containers that Hive requires, significantly reduces the performance compared to Spark, which only requires one fat container per DataNode. Shuffle performance is a 60% faster in Spark 1 and an 85% faster in Spark 2 in this query. All in all, these two queries depict how both Spark and Hive perform in very distinct scenarios. Spark is heavily affected by a slow start brought about the Hive settings parsing and the pre-assignment of resources. Also, DB scans induce a heavy disk and network usage, supposedly by a suboptimal data allocation policy. In contrast, Hive is capable of starting query processing faster, at the cost of slow execution time due to dynamic container allocation. DB scans in Hive are also extremely fast in Hive, the increased number of containers make it possible to take advantage of data allocation, reducing disk access, network and overall execution times. As a conclusion, Spark is more suited for heavy CPU-oriented queries while Hive performs better in full table scans. 5.1.2 MapReduce-type post-processing Seven out of the thirty BigBench queries use custom reducers to post-process data selected from Hive tables beyond what Hive and Spark-SQL are capable of, as these languages are not able to process semi-structured data. This post-process is formally written in Python code, and is executed after finishing a mandatory SELECT clause to gather the initial required data. The python code processes all selected rows as part of a REDUCE phase. Because of this name, the official BigBench specification [15], calls this queries as MapReduce-type post-processing. On top of it queries 1 and 30 make use of User Defined Functions (UDF) to further post-process data. UDFs are written in Java and are executed as part of the reduce phase. Q30 is selected for being the most complex and time-consuming MapReducetype query of BigBench which utilizes both MR and UDF. Its objective is to categorize the affinity of products viewed together. “Click sessions” for a user are specified with a timeout of 60 minutes, and clicks (semi-structured data) are studied to analyze the affinity of products. As can be seen in Error! Reference source not found., Spark 2 performs the best overall in this query, being a 40% faster than Hive and a 67% faster
Chapter 5 Experimental evaluation 49 than Spark 1. This query shows a clear difference between the two Spark versions, a notable improvement in execution time. Figure 232. Execution time of MapReduce query 30 using Hive, Spark and Spark 2 Q30 is divided in three main phases. In phase 1 data from users, user clickstreams, items and item categories are selected from the tables. Every recovered row is post-processed by a reducer in phase 2, the objective of which is to create user sessions out of its clickstreams. To do so, all clicks are gathered together if they are within a 60-minute timeout. In phase 3 all sessions are processed by a UDF which groups items which are usually seen together in a session. As part of this last phase, a SELECT clause is used to retrieve all processed pairs. Hive follows a slow-start similarly to what could be seen in SQL-only queries (chapter 5.1.1). Both versions of Spark also perform this phase, but with different behavior. Spark 1 suffers a notorious issue as the engine spends and abnormal long time selecting data with very low CPU usage and almost no network communication between DataNodes. This indicates there has been some issue recovering certain blocks, delaying the overall execution significantly. However, this behavior is not isolated as further executions show exactly the same issue, even after repopulating the Hive Metastore. In the end, missing blocks can be recovered as execution continues and finishes 1298,547 2315,425 770,535 0 720 1440 2160 2880 3600 q30 Execution time (s) Hive Spark Spark2 Figure 22. CPU and Network utilization in query 30 for Hive (Error! Reference source not found.3.A) Spark 1 (Error! Reference source not found.3.B) and Spark 2 (Error! Reference source not found.3.C) A B C
Chapter 5 Experimental evaluation 50 successfully. On contrast Spark 2 not only solves its prior version issues but also reduces the amount of I/O waiting, while also introducing an important optimization as it can start executing the reduce phase approximately when only half of the dataset is recovered. Error! Reference source not found..C shows how the reduce phase starts while there is still heavy network utilization between DataNodes. The reduce phase is quite similar in all three engines, showing no network communication while the reducer is in place, followed by a data shuffle that introduces the User Defined Function in phase 3. Spark 1 maxes CPU at around 85% with no visible I/O wait, kernel stops or other blocking system privileged processes. Spark 2 also maxes CPU at around 85% with similar completion times. It is impressive, though, that Spark 2 can maintain similar execution times compared to its prior version while still selecting and recovering data from HDFS. Hive is the most performant engine of the pack when executing custom reducers, more interestingly, it is capable of start the data shuffle slightly before completing the reducer. As stated previously, the phase 3 starts with a data shuffle that introduces the UDF, Spark 2 performs the best overall in this step followed closely by Hive. Spark 1 shows, again, a very low performance compared to the competing engines. Its important no note that Spark is capable of selecting the data directly from the UDF while Hive requires a further SELECT stage to gather the resulting data. Because of this, and even though Hive shows a remarkable performance in UDF and custom Reducers, ends up being slower than Spark 2. Analyzing query 30 further demonstrates that Spark is a great engine for CPU intensive applications. Optimizations such as being able to start reducers before the whole dataset is recovered further improves performance over Hive, on top of that, preassignment of resources shows again performance improvements over the slow-start overhead of Hive. Spark also shines on UDF sections while Hive performs great in custom Reducers. Finally, Spark ends up being significantly faster due to its ability to recover results while performing the UDF, in contrast, Hive requires a final SELECT stage. As a side note, Spark 2 demonstrates how much the Spark team has improved the engine; the first version shows that some queries can show unexpected behavior resulting in extremely long execution times. 5.1.3 Natural language processing The four NLP queries utilize custom UDF functions, written in Java, to encapsulate the reviews processing. The OpenNLP library is utilize to expand the capabilities of the UDF with utilities like sentence detectors and models. Similarly to MapReduce, NLP queries are a combination of SQL and extended functionalities, formally, the SQL section of the queries retrieve the required dataset, usually combining structured data such as users and items with non-structured data, aka, user reviews for products. The recovered dataset is then sent to a custom UDF that processes the reviews with the help of the OpenNLP library.
Chapter 5 Experimental evaluation 51 Q18 is the most complex NLP query of the bunch, its objective is to identify the stores that have declining sales in 3 consecutive months, and check if there are any negative reviews regarding the store service. The query is executed in two main phases: Initially, stores with declining sales are filtered using linear regression. Table joins are required in this step to recover stores, sells and names. In phase 2, the recovered dataset is sent to a UDF to process the reviews of the filtered stores. Q18 is complex in both phases, performing better in Hive than both versions of Spark, while also showing a dramatically improvement when moving to the newer version of Spark. Figure 254. Execution time of NLP query 18 using Hive, Spark and Spark 2 The two main phases of Q18 are clearly distinguishable in all engines: the query section in which the dataset is recovered from the Metastore tables shows an average CPU usage and high data movement across the whole cluster, a behavior that is repeated across the whole set of queries. The query section ends with the linear regression, this step in the query shows very little CPU usage and no data movement across the cluster. Hive shows the classical slow-start container allocation but performing a very quick regression. Both versions of Spark perform significantly worse in this aspect, even if Spark 2 improves performance by a 60% compared to its former version. 492.276 785.446 538.827 0 100 200 300 400 500 600 700 800 900 1000 q18 Execution time (s) Hive Spark Spark2 Figure 245. CPU and Network utilization for Hive (Figure 245.A) Spark 1 (Figure 245.B) and Spark 2 (Figure 245.C) A B C
Chapter 5 Experimental evaluation 52 The NLP UDF shows few data movement from both disk and network but with a consistent CPU usage that peaks at 45% in Spark and 50% in Hive. No I/O wait is present showing that this section is CPU-bounded. In contrast to what has been discovered in previous query types, Hive performs very similarly to Spark 2. Ultimate completion time favors Hive due to its faster calculation of the linear regression, however, focusing on just NLP performance, both engines perform very similarly. Continuing with the NLP section, is interesting to analyze how Spark 2 improves upon Spark 1, skipping complete sections that utilize both CPU and network. The overall set of log files: Yarn, Spark and execution log, do not show up why Spark 2 can skip the execution of specific sections. Despite this, no other NLP queries show a similar behavior, as an example in query 10, CPU usage is mostly the same for both engine versions (Figure 26). Query 18 gives some very interesting insight on how Hive compares to Spark, simple models that do not require ML libraries such as linear regression seem to favor Hive by a fair amount while NLP does not favor any engine (excluding Spark 1), an affirmation that is apparent in any of the other 3 NLP queries. Spark 2 keeps showing improvements compared to Spark 1, NLP is slightly faster in the second engine version and on top of that, complete query sections can be skipped, even though we couldn’t discover the reason. 5.1.4 Machine Learning Five BigBench queries utilize Machine Learning techniques to train models out of the Metastore data and make testing predictions. As part of the official implementation Mahout and Spark ML are the two engine that can be used for this purpose. On top of that, the team behind the development of BigBench has provided us a “developer preview” of the ML extension that enables Spark 2 ML natively on BigBench. This extension not only allows us to compare Spark 2 against its first version when performing taxing Machine Learning tasks, but also, enables Spark-2 to be used across the whole BigBench workload, as it is not possible to switch version while already executing a query, aka, use Spark 2 for SQL and and Spark 1 for ML. All five ML queries utilize the very same structure, a SQL query that selects a subset of the whole dataset that is stored in a transitory Hive table. The next step is to execute some ML algorithm on the selected data using Spark ML or Mahout. This Figure 26. CPU trace of NLP query 10 for Spark 1 (Figure 26.A) and Spark 2 (Figure 26.B) A B
Chapter 5 Experimental evaluation 53 transition between the query and the ML portion is accomplished using a bash script running in the master node. Query five is selected to be analyzed, its objective is to predict if new visitors to the online web-page will be interested in a given item category. To do so, a Logistic Regression is created using existing user online activities, specially, interests in items of different categories and demographics. The model can be used to predict if a visitor is interested in a given category of items. The output consists on the precision, accuracy and confusion matrix of the model, stored as TextFile directly into HDFS. Both Hive and Spark share the same steps to create the model and calculate the prediction: A) Select data from Hive Metastore. B) Recover the data from HDFS. C) Create the model. D) Make prediction. E) Store prediction in HDFS. however, the implementation is extremely different. BigBench bash script for Query 5 does most of the workload; it is responsible for recovering the data from hive, communicate to HDFS, launch the model creation and predictions to Mahout and store results to HDFS. On contrast, to be able to use Spark MLlib, BigBench uses a wrapper, written in scala, to communicate with Spark. The functionalities of the wrapper are similar to the steps defined for the Mahout execution and include data retrieval and transformation, model creation, predictions and storing results in HDFS. Figure 27 depicts the execution steps for both Machine Learning engines. As ML queries are the only ones that change implementation so drastically between execution engines, and exhaustive analysis is presented for each step of the execution, to firmly differentiate between the two engines using scale factors starting from 1GB up to 10TB. In the data preparation section, the engine recovers the resulting dataset from the starting query and transforms the data into the required format, being RDD in Spark 1, Data Frames in Spark 2, while Mahout can work just with csv file without further Figure 27. Query 5 execution flow using Mahout (Figure 27.A) and Spark ML (Figure 27.B) A B
Chapter 5 Experimental evaluation 54 processing. Figure 28.A shows that Mahout is the fastest on the group as no preprocessing is required on the data. The change to Data Frames in Spark 2 improves data cooking performance by a 37% compared to RDD, while both versions do not seem to be affected by input size. Figure 28. Execution time of the different query 5 sections for Mahout, Spark ML 1 and Spark ML 2 Data preparation in Figure 28.A, model creation in Figure 28.B and prediction in Figure 28.C Figure 28.B shows that when creating the model, Spark is hardly affected by the input size, with variations of generally a few seconds. More interesting is the difference in performance between the two versions of Spark as version 1 is around an 80% faster than the newer Spark-2 which also suffers from a spike in execution time when 10 TB of data is reached. On the opposite, Hive is affected by the access to Hadoop HDFS which is the responsible of storing all the metadata related to the prediction and distribute it through the whole cluster. The biggest difference between engines, however, can be found in Figure 28.C, while both Spark versions are able to create the model in a fast manner, while also not being affected by input size, Mahout shows and exponential execution time behavior. Analyzing CPU behavior of every node in the cluster (FIGURE) shows that Mahout spawns a process in the master node which performs the whole training by its own, leaving all the slave nodes without real work. The process is single-core which explains that the maximum load in the master node remains still in around a 6% of usage with neglective I/O access as the whole input data remains in memory. This experiment shows that for the given cluster deployment and software configuration, Mahout is not benefiting from any of the parallel capabilities a Hadoop cluster offers. Spark on the other hand shows the expect CPU usage across the cluster, the Slaves show a high CPU usage during the select stage and also when calculating the logistic regression, at around the second 300 on Figure 29.D. Master node also utilizes more resources than even Mahout when creating the model. 1 10 100 1000 10000 1 GB 10 GB 100 GB 1 TB 10 TB Exec time (s) Mahout Spark 1 Spark 2 0 20 40 60 80 100 1 GB 10 GB 100 GB 1 TB 10 TB Exec time (s) 0 50 100 150 1 GB 10 GB 100 GB 1 TB 10 TB Exec time (s) A B C
Chapter 5 Experimental evaluation 55 Figure 30 depicts the execution times of the three analyzed Machine Learning Frameworks, adding up only the Learning phases (Data preparation, model training and predictions), the query section is common for the three Frameworks and thus, does not permit to analyze the differences of the engines. For very small input sizes (around 1 GB) Mahout is capable to beat both versions of Spark as the lack of initial data cooking - which takes and static amount of time regardless of the input size - and the small amount of data, permits the master node to compute the model using a single core in a very fast manner. Both Spark 1 and Spark 2 show a static execution times regardless of the input data sizes, this behavior rapidly makes Spark take the lead from Mahout in medium data sizes (tens to hundreds of GB). This lead becomes even more noticeable when data actually becomes Big Data (Terabytes) as Spark still shows approximately the same execution times as previously while Mahout grows execution times grows exponentially The explanation is fairly simple: the master node using a single core cannot cope with the amount of data to process. Comparing both versions of Spark does still leave some doubts, technically Spark 2 seems to be slightly faster than Spark 1 but the margins are so small that we cannot straightly conclude the newer version in faster than the older one from this tests. Figure 29. CPU trace of query 5 for Hive and Spark master nodes (Figure 29.A and Figure 29.C) and a Slave instance (Figure 29.B and Figure 29.D) A B C D
Chapter 5 Experimental evaluation 56 Figure 30. Execution times of query 5 combined ML sections for Mahout, Spark ML 1 and Spark ML 2 5.2 Throughput tests The second round of experiments consists on adding concurrency, or, multiple queries running at the same time. Stressing the hardware is one of the best ways to understand the limits of the software and what resources affects the most each engine. The concurrency level is defined as the number of queries emitted by BigBench to the engine at every time, a user defined parameter. The total number of queries executed by the benchmark is defined as #𝑞𝑢𝑒𝑟𝑖𝑒𝑠=$𝑃𝐴𝑅𝐴𝐿𝐿𝐸𝐿_𝑆𝑇𝑅𝐸𝐴𝑀𝑆∗30. A stream is defined as a “thread” that executes the 30 queries of BigBench. The query order is selected arbitrarily by BigBench in function of the number of streams selected by the user, up to 50 streams. Annex C depicts the order of the queries depending on the number of streams. As part of this tests 2, 4 and 8 streams were originally intended to be used as the concurrency level. However, Hive wasn’t able to finish the execution of the 8-query concurrency level so it was decided to compare the engines without using this test. Furthermore, as depicted in the sequential evaluation (Section 5.1), Mahout shows a clear sequential behavior, executing the ML sections of queries 5, 20, 25, 26 and 28 in the Master node instead of in the worker nodes. For that reason, it was decided to compare Hive + Tez against Spark-SQL v1 and v2 using only Spark-ML as Machine Learning engine. Figure 31 overviews the overall execution time, in minutes, of the three engines (Hive + Tez, Spark v1 and Spark v2) when running 2 streams (Throughput-2) and 4 streams (throughput 4). This overview already gives insight of the performance of the engines. For small concurrency levels, Spark 2 offers the best performance overall, being a 10% faster than Hive and a 30% faster than Spark 1. These results reassert the ones obtained in the sequential tests, mainly because resources are probably yet not being maxed out. When doubling the parallelism, Spark 2 takes a great hit in performance, 1 GB 10 GB 100 GB 1 TB 10 TB Mahout 52,232 137,671 406,68 1121,515 3573,467 Spark-1 112,057 117,612 105,982 100,449 116,542 Spark-2 93,342 95,33 95,684 94,379 140,491 3573,467 0 200 400 600 800 1000 1200 1400 Execution time (s)
Chapter 5 Experimental evaluation 57 increasing execution time in a supra-linear manner. Spark 1 increases execution time in linear fashion while Hive increases under linearly, outperforming Spark 2 by a 10% and Spark 1 by almost a 35%. These results show that Hive is more suited for scenarios that require high level of concurrency compared to Spark, which seems to have reached a resource boundary that limits the overall performance. Figure 31. Execution time of concurrency tests with 2 and 4 parallel Streams for Hive using Spark as ML engine, Spark 1 and Spark 2 The next sections describe the performance and resource utilization of the three engines, separating both concurrency levels. 5.2.1 2-Stream concurrency When pairing 2 queries in parallel, requesting data from a 1 TB DB while performing CPU and memory intensive applications, the requirements to the system increase by a huge margin compared to a sequential test. Figure 32 Depicts the CPU usage of the whole cluster, during the execution time of the throughput tests, showing that it maxes out in a spiky manner, getting steady just in a handful of queries for Spark 1. This indicates that nor engine has still maxed out the CPU. Spark 1 is the engine that consistently uses more CPU, in essence, because queries last longer to complete compared to the its counterparts. 310,48 544,28 412,86 811,56 285,93 606,99 0 120 240 360 480 600 720 840 960 Throughput-2 Throughput-4 Execution time (m) Hive + Spark ML 1 Spark 1 Spark 2 Figure 32. CPU traces for 2-Stream concurrency for Hive (Figure 32.A) Spark 1 (Figure 32.B) and Spark 2 (Figure 32) A B C
Chapter 5 Experimental evaluation 64 When running Hive, streams finish in order of complexity, meaning, complex streams tend to take longer to complete. This stepped shape of stream completion seems to indicate that Hive + Tez allocates resources in a “fair” way without penalizing less complex queries in favor of the most complex. Despite this, in totally fair scenario the 1TB execution would take 10 more time than the 100GB, when in reality it takes just a 32% more. This indicates that indeed resources are being assigned depending on complexity, while never suffocating less complex tasks. Spark schedules the execution of the queries in a manner that all streams finish aproximatelly at the same time. The spark he scheduler does a remarkable job as all streams finish with diference of merely a few minutes between them. Resource requirements are well apart from each stream, which means Spark can dynamically analyze the requirements of each individual querie and assign resources accordingly, with the objective of unifying the completion time. As both Spark versions seem to share the same scheduler, this section will focus only on Spark 2. Two new charts are introduced in this section, the first one (Figure 42) shows how many applications are running concurrently at any given time, as an example, in the proposed experiment, a maximum of three queries can be executed concurrently. Applications are also differentiated between streams, so it is possible to analyze which ones have a running query on the system and how much time they take to complete. The second chart (Figure 43) shows the amount of individual tasks running at any given time and to which stream are associated. For Hive, this tasks are executed in containers of 1 CPU and 2GB of memory, so, a total of 345 tasks can be running at any given time. In contrast, Spark maanges tasks internally without Hadoop or user intervention, so it is unknown the number of concurrent tasks and how many resources they have assigned. It’s important to not that this charts show only applications and containers that are actively executed by the engine, discarting any preparation time and latencies between BigBench client and the engine Figure 42 depicts a clear difference between Spark and Hive in he inner execution of queries, Hive is capable of running the maximum number of queries in parallel that can be executied in this experiment -3 queries-, while Spark runs a maximum of two. However, neither engine maintains the concurrency most of the time, specially Spark which seems sequentialize the execution of the queries. Query execution time in Spark seem to follow a complete sequential ordering in which streams rotate the execution of queries which are assigned the complete cluster resources (Figure 42.B and Figure 43.B). When some concurrency is present, very few resources are given to one of the queries, resulting in a very similar completion time. The low level of concurrency and the assignament of the whole cluster resources to individual queries create a situation in which all streams are treated equally, with queries waitting in line, even if they require just a few seconds to execute. This queue approach makes all streams to finish in approximatelly the same time.
Chapter 5 Experimental evaluation 65 0 1 2 3 1 297 593 889 1185 1481 1777 2073 2369 2665 2961 3257 3553 3849 4145 4441 4737 5033 5329 5625 5921 6217 6513 6809 7105 7401 7697 7993 8289 8585 8881 9177 9473 9769 10065 10361 10657 10953 11249 11545 11841 12137 12433 12729 13025 13321 13617 13913 14209 14505 14801 15097 15393 15689 15985 16281 16577 16873 17169 Number of concurrent applications Execution time (s) 100GB Stream 500GB Stream 1TB Stream 0 1 2 3 1 334 667 1000 1333 1666 1999 2332 2665 2998 3331 3664 3997 4330 4663 4996 5329 5662 5995 6328 6661 6994 7327 7660 7993 8326 8659 8992 9325 9658 9991 10324 10657 10990 11323 11656 11989 12322 12655 12988 13321 13654 13987 14320 14653 14986 15319 15652 15985 16318 16651 16984 17317 17650 17983 18316 18649 18982 19315 Number of concurrent applications Execution time (s) 100GB Stream 500GB Stream 1TB Stream Figure 42. Number of concurrent queries in Hive (Figure 422.A) and Spark (Figure 422.B) during the execution of the extended BigBench elasticity test A B
Chapter 5 Experimental evaluation 66 0 50 100 150 200 250 300 350 400 1 292 583 874 1165 1456 1747 2038 2329 2620 2911 3202 3493 3784 4075 4366 4657 4948 5239 5530 5821 6112 6403 6694 6985 7276 7567 7858 8149 8440 8731 9022 9313 9604 9895 10186 10477 10768 11059 11350 11641 11932 12223 12514 12805 13096 13387 13678 13969 14260 14551 14842 15133 15424 15715 16006 16297 16588 16879 17170 100GB Stream 500GB Stream 1TB Stream 0 2 4 6 8 10 12 14 16 18 1 328 655 982 1309 1636 1963 2290 2617 2944 3271 3598 3925 4252 4579 4906 5233 5560 5887 6214 6541 6868 7195 7522 7849 8176 8503 8830 9157 9484 9811 10138 10465 10792 11119 11446 11773 12100 12427 12754 13081 13408 13735 14062 14389 14716 15043 15370 15697 16024 16351 16678 17005 17332 17659 17986 18313 18640 18967 19294 100GB Stream 500GB Stream 1TB Stream Figure 43. Number of concurrent tasks in Hive (Figure 433.A) and Spark (Figure 43.B) during the execution of the extended BigBench elasticity test A B
Chapter 5 Experimental evaluation 67 In contrast with Spark, which divides its resources in 16 concurrent tasks, mostly assigned to a single query, Hive relies entirely in Yarn which assigns “slots” of CPU + memory, with a ceiling of 345 concurrent tasks. Queries are treated in a hybrid fair scheduling. Whenever ready, Hive gets resources from Yarn to assign to all possible queries, in result, during the central part of the experiment, Hive is executing the three streams concurrently. In essence, queries are never waiting in line and once they are ready to start, they are always given resources. However, to maintain a “fair” scheduling the amount of resources assigned to each query depends on its complexity, more complex queries are given more containers. This generates a scenario in which simpler streams finish before complex ones, however, to alleviate the probable enormous time difference, resources are assigned depending on complexity. As a result, Hive generates a “stepped-shape” stream completion. As a side note, the results obtained are heavily dependent on the experiment definition, aka, the number of streams and their size, and the cluster configuration. Increasing the concurrency level in Hive can create one out of two possible scenarios. Theoretically, Yarn could allocate a single container to a single query until maximizing the cluster resources, or in this case, a total of 345 concurrent queries. If so, the “stairshape” completion time would still apply in a more extreme way, as less complex streams would finish before the complex ones. On top of it, due to the extreme concurrency level, complex queries would not benefit from increased number of resources so, the step between streams would increase even further. However, it is likely that Hive and Yarn would limit the number of concurrent queries, assigning resources in function of the complexity (as shown in this experiment), this would create a Spark-like queue situation that would bring the Spark completion shape to Hive. To demonstrate the real outcome, would require more tests and different hardware settings. It is hard to argue which approach is recommended overall as it depends entirely on the workload, the company requirements, commercialization, client SLAs, etc. A Hive-type completion shape is interesting for Cloud companies that want to commercialize query execution, providing better results to those clients paying the most. The Spark-type completion shape is more suited for those scenarios in which all workloads need to be treated equally and none is more important or priority than others.
68 Chapter 6 Conclusions and future work With the boom of Big Data in industry and science, many complex infrastructure solutions have appeared promising blazing fast performance, flawless use of cluster resources and more easy and interactive user experiences. Due to the inherent complexity of the engines and the difficulty on processing big quantities of data, it is impossible to assume a specific engine may outperform all competitors in all conditions. For that reason, in this thesis we propose the ALOJA platform as the state of the art benchmarking solution. During the course of this thesis we demonstrate that ALOJA is able to execute various benchmarking suites on multiple Big Data engines and parametrize any given setting, while also gathering useful data for further analysis in an automatic fashion. ALOJA then, offers a complete automated benchmarking solution that simplifies Big Data benchmarking in any hardware and software configuration and deployment scenario, offering advanced analysis tools. Original Big Data engines like MapReduce or Spark-Scala require expert knowledge of the data and how it is stored, the paradigm used by the engine and its architectural design, or even specific languages like Scala. As a result, very few engineers are able to proficiently make use of this engines. To alleviate this issue, SQL-like engines where introduced, abstracting both the data by using classical relational tables and the language. This allows companies to port their classical DBMS into the Big Data world while allowing their ordinary employees to work in a very similar fashion as they are used to. Furthermore, the new engines allow companies to perform new complex tasks such as Signal Processing, Machine Learning or Natural Language Processing natively. These new engines require specific benchmarks that tests the capabilities of the language, the architecture, optimizations, etc. We introduce BigBench in ALOJA as the de facto benchmark for SQL-like Big Data infrastructure, as it is the first standardized benchmark capable of analyzing beyond the data processing, using ML, NLP and custom User Defined Functions as benchmarking pillars. The two major SQL-like engines available by the date of this thesis, Spark-SQL and Hive, are introduced in ALOJA, parametrized and benchmarked. By means of the engine and benchmark parametrization, we study some of the major configuration parameters of both engines and how they affect performance. Hive offers a more extensive set of user-configurable set of parameters, many of which like Mapper parallelism or table size for MapJoins, show close to none effect on performance. Other parameters, such as Reducer parallelism or table size for multi MapJoins severely affect performance. Spark simplifies the configuration to mainly setting the number distributed agents in charge of running tasks and their resources. This distributed agents, or executors, internally manage jobs while Hive relies on Yarn to assign resources to individual tasks. The resulting experimentation shows that, for the used hardware configuration and workload, Spark performs better when assigning a
69 single executor per cluster node, while Hive requires small packages of 1 single CPU + 𝑇𝑜𝑡𝑎𝑙 𝑐𝑙𝑢𝑠𝑡𝑒𝑟 𝑚𝑒𝑚𝑜𝑟𝑦 𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝐶𝑃𝑈𝑠 of physical memory. Using ALOJA parametrization of BigBench makes possible to execute discrete workloads that allows to analyze the performance of each engine when dealing with very specific tasks such as database scans, CPU intensive operations, in-memory operations and heavy usage of disk and network. These experiments show that Hive provides a better task placement, making use of data locality and overperforming Spark in scan-based workloads. On contrast, the in-memory based engine provides better performance in CPU intensive applications due to a fast data shuffle between DataNodes being able to start the reduce computation before completing the data selection or being able to select data directly from UDF sections, actions which Hive can’t perform. ALOJA can also execute complex BigBench workloads by making use of a concurrency level selected by the user. These workloads have the objective of pushing the boundaries of each engine and detecting possible bottlenecks. By means of these experiments, we discovered that Spark is not well suited to be used when paired with slow rotational disks, which results in an underutilized network and low CPU usage. On the contrary, Hive makes a proper use of all available resources, outperforming Spark when concurrency grows. However, as Hive executes tasks by means of fixed packets of CPU + memory, very complex tasks can overflow the available memory per CPU core, resulting in a more unreliable engine, that requires more overall memory per core, or sacrificing CPU utilization in favor of robustness. Current Big Data benchmarks focus on two types of execution: simple workloads to detect strengths and flaws in very specific scenarios and concurrency tests to push the boundaries of the engines. However, real workloads change in complexity over time, depending in factors such as the time of day or client requirements. For that reason, we propose, as part of this thesis, a BigBench extension that allows to execute concurrency tests with multiple data sizes. The user can select the complexity of every individual stream by specifying its data size. An in-depth analysis of each individual stream and its tasks allows to understand how the engines treat concurrency and how resources are assigned to multiple tasks with variable complexity, in essence, testing how elastic the engines are. By using this extension, we where able to detect that Spark transforms a concurrent set of workloads sent by the client, into a sequential list of tasks, in which tasks wait in queue until they are given the complete cluster resources. Hive on the other hand, shows high level of concurrency and no queueing effect, so, once a task is ready to be executed it is given resources depending on the complexity of the task. These two approaches show a very distinct completion pattern, for Spark, all workloads are treated equally and finish closely in time, regardless of their complexity. Hive, shows a “stairshape” completion pattern in which simple workloads finish before more complex ones. Many other experiments can be performed with the use of ALOJA + BigBench; engine version parametrization allowed to conclude that Spark 2 improves upon most characteristics of the prior version as, better disk and network usage, improved memory
70 management, and more consistent CPU usage makes Spark 2 up to a 40% more performant than Spark 1, in our hardware configuration. Applications on top of infrastructure can also be tested, for example, during this thesis we experimented with two different ML engines: Mahout and Spark ML. ALOJA metrics allowed to detect that Mahout executes its algorithms in the Master node instead of in the desired slave nodes, resulting in no concurrency benefits and underperforming if compared with Spark ML. A close collaboration with the BigBench development team, granted us a developer preview of the Spark ML 2 wrapper for BigBench, the second version resulted to be slightly slower than Spark ML 1. During the course of this thesis we presented ALOJA as the state of the art benchmarking platform of Big Data infrastructure. The addition of BigBench and the extension proposed in this thesis allows ALOJA to further benchmark engines, testing specific scenarios, detect bottlenecks and study their elasticity. The parametrization capabilities of ALOJA and its log and metrics gathering allowed to execute more than 100 experiments, configuring more than 50 parameters. The result of the experimentation evidenced the strengths and flaws of multiple engines and versions in a very tight time frame. 6.1 Future work We are satisfied with the results obtained in this thesis, as we were able to demonstrate that ALOJA is a great tool to perform Big Data benchmarking in fast and convenient manner. However, more analysis and further development can be done in the future. Hive 2 is code incompatible with some BigBench queries and the new Metastore version 2.x is incompatible with any version of Spark, so it is impossible to use Spark ML alongside Hive 2 at the time of writing this thesis. As a further development it would be interesting to further modify BigBench source code to grant Hive 2 execution compatibility. Spark 2 showed a significant increase in performance compared to its prior versions, so, it would be interesting to check whether Hive does the same. BigBench code and its extension are now part of the official ALOJA release, but the Yarn log python analyzer does not. As part of a further development, one of the first steps would be to integrate the parser into the ALOJA framework, so this process is automated for each execution that makes use of Yarn. Finally, a more exhaustive Spark-SQL vs Hive analysis would be interesting by using different cluster configurations, including an HDFS deployment configured to use SSDs instead of rotational HDDs, in order to test whether Spark improves performance in high concurrency workloads. It would also be interesting to analyze how these engines perform in PaaS, platforms with custom software configurations.
References 71 References [1] S. Ghemawat, H. Gobioff, S. Leung. The Google File System. 19th ACM Symposium on Operating Systems Principles, Lake George, New Yor, October, 2003. [2] TPC-DS. http://www.tpc.org/tpc_documents_current_versions/pdf/tpc-ds_v2.7.0.pdf, 2017. [3] TPC-H. http://www.tpc.org/tpc_documents_current_versions/pdf/tpc-h_v2.17.3.pdf, 2017. [4] N.Poggi, J.L. Berral, D. Carrera, N. Vujic, D. Green, J. Blakeley, et al. From performance profiling to predictive analytics while evaluating Hadoop cost-efficiency in aloja. In Big Data (Big Data), 2015 IEEE International Conference on, 2015. [5] N.Poggi, D. Carrera, N. Vujic, J.Blakeley, et al. ALOJA: A systematic study of Hadoop deployment variables to enable automated characterization of cost-effectiveness. In 2014 IEEE Intl. Conf. on Big Data, Big Data 2014, Washington, DC, USA, October 27-30, 2s014. [6] T. Yahoo. Betting on Apache Hive and Yarn. https://yahoodevelopers.tumblr.com/post/85930551108/yahoo-betting-on-apache-hive-tez- and-yarn, 2014 [7] M. G. Noel Yuhanna. Elasticity, autom ation, and pay-as-you-go compel enterprise adoption of Hadoop in the cloud. The Forrester Wave: Big Data Hadoop Cloud Solutions, Q2, 2016. [8] M. P. A. Q. J. P. N. P. J. B. T. Ivanov, T. Rabl. Big Data benchmark compendium. 7th TPC Technology Conference on Performance Evaluation and Benchmarking (TPCTC 2015), USA. [9] BSC. Aloja home page: https://aloja.bsc.es/, 2018 [10] A. Ghazal, T. Rabl, M. Hu, F. Raab, M. Poess, A. Crolotte, and H.-A. Jacobsen. BigBench: Towards an industry standard benchmark for big data analytics. In Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data, SIGMOD ’13, pages 1197-1208, New York, NY, USA, 2013, ACM. [11] R. Radowitz, T. Ivanov. Evaluation of TPC-H on Spark & SparkSQL in ALOJA. Goethe Universität, Frankfurt, October, 2017. [12] T. Ivanov, M. G. Beer. Evaluating Hive and Spark SQL with BigBench. Technical Report No. 2015-2, January, 11, 2016. [13] Spark. Spark-2 overview. http://spark.apache.org/releases/spark-release-2-0-0.html. 2018. [14] N. Poggi, A. Montero, D. Carrera. Characterizing BigBench queries, Hive, and Spark in multicloud environments. TPCTC 2017, pages 55-74. [15] TCP. TPC Express BigBench, TPCx-B, Standard Specification version 1.2.0. http://www.tpc.org/tpc_documents_current_versions/pdf/tpcx-bb_v1.2.0.pdf. Novembre, 2016.
References 72 [16] J.Dean S. Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. OSDI’04: Sixth Symposium on Operating System Design and Implementation, San Francisco, California, December, 2004 [17] Cisco. The Zettabyte Era: Trends and Analysis. https://www.cisco.com/c/en/us/solutions/collateral/service-provider/visual-networking- index-vni/vni-hyperconnectivity-wp.html#_Toc484556817. June, 2017. [18] M. Zaharia, M. Chowdhury, M.J. Franklin, S. Shenker, I. Stoica. Spark: cluster computing with working sets. Proceedings of the 2nd USENIX conference on Hot Topics in cloud computing, 2010, pages 10-10 [19] D. Borthakur. The Hadoop distributed file system: Architecture and design. Hadoop Project Website, vol. 11, page 21, 2007. [20] V. K. Vavilapalli, A. C. Murthy, C. Douglas, S. Agarwal, M. Konar, R. Evans, T. Graves, J. Lowe, H. Shah, S. Seth, B. Saha, C. Curino, O. O’Malley, S. Radia, B. Reed, E. Baldeschwieler. Apache Hadoop YARN: Yet Another Resource Negotiator. Proceeding of the 4th Annual Symposium on Cloud Computing, New York, USA, 2013, pages 5:1-5:16. [21] A. Thusoo, J. S. Sarma, N. Jain, Z. Shao, P. Chakka, N. Zhang, S. Antony, H. Liu, R. Murthy. Hive – a petabyte scale data warehouse using Hadoop. 2010 IEEE 26th International Conference of Data Engineering (ICDE), 2010, pages 996-1005. [22] B. Saha, H. Shah, S. Seth, G. Vijayaraghavanh, A. Murthy, C. Curino. Apache Tez: A unifying framework for Modeling and Building Data Processing Applications. Proceddings of the 2015 ACM SIGMOD International Conference of Management of Data, pages 1357-1369. [23] Apache. Apache Mahout: Scalable machine learning and data mining. http://mahout.apache.org/. 2017. [24] N. Poggi, T. Fenech, A. Montero. ALOJA benchmark execution metrics. https://aloja.bsc.es/metrics/ . 2018 [25] N. Poggi, D. Carrera, J.L. Berral, A. Montero, T. Fenech. ALOJA Big Data Benchmarking platform code repository. https://github.com/Aloja/aloja. 2018.
Annex A Yarn log parsing code 73 Annexes Annex A: Yarn log parsing code #!/usr/bin/env python import sys,os import argparse import re import time import datetime import glob import pprint import csv def get_id(line,type): for word in line.split(): if type == "application" and "application" in word: return word elif type == "container" and "container_" in word: return word def get_times(dict,division=1): start = sys.maxint stop = 0 for key,value in dict.iteritems(): if value["start_time"] < start: start = value["start_time"] if value["stop_time"] > stop: stop = value["stop_time"] duration = float(stop) - float(start) steps = duration/division times = [] for i in xrange (0, int(steps) + 2): times.append(start + (i*division)) return times,start,stop,duration def get_states(dict): states = ["timestamp","RUNNING"] for key,value in dict.iteritems(): for key2 in value.keys(): if key2 not in states and key2 != "stop_time" and key2 != "start_time": states.append(key2) return states def check_timestamp(stop_time,start_time,timestamp,division): if timestamp <= stop_time <= (timestamp + division): return True elif timestamp <= start_time <= (timestamp + division): return True elif start_time <= timestamp and stop_time >= (timestamp + division): return True else: return False def update_dict(dict,id,states,new_state,timestamp): if timestamp not in dict: dict[timestamp] = {} for state in states: if state not in dict[timestamp]: dict[timestamp][state] = [] elif id in dict[timestamp][state]: dict[timestamp][state].remove(id) if id not in dict[timestamp][new_state]: dict[timestamp][new_state].append(id)