MapReduce on YARN Job Execution



Similar documents
Hadoop Distributed File System (HDFS) Overview

Virtual Machine (VM) For Hadoop Training

Hadoop Streaming coreservlets.com and Dima May coreservlets.com and Dima May

Advanced Java Client API

Map Reduce Workflows

6. How MapReduce Works. Jari-Pekka Voutilainen

HBase Java Administrative API

HDFS Installation and Shell

HBase Key Design coreservlets.com and Dima May coreservlets.com and Dima May

Apache Pig Joining Data-Sets

How MapReduce Works 資碩一 戴睿宸

Hadoop Introduction coreservlets.com and Dima May coreservlets.com and Dima May

YARN and how MapReduce works in Hadoop By Alex Holmes

Java with Eclipse: Setup & Getting Started

The Google Web Toolkit (GWT): The Model-View-Presenter (MVP) Architecture Official MVP Framework

Hadoop. History and Introduction. Explained By Vaibhav Agarwal

Android Programming: Installation, Setup, and Getting Started

JHU/EP Server Originals of Slides and Source Code for Examples:

HDFS - Java API coreservlets.com and Dima May coreservlets.com and Dima May

Weekly Report. Hadoop Introduction. submitted By Anurag Sharma. Department of Computer Science and Engineering. Indian Institute of Technology Bombay

H2O on Hadoop. September 30,

Open source software framework designed for storage and processing of large scale data on clusters of commodity hardware

Data-intensive computing systems

The Google Web Toolkit (GWT): Declarative Layout with UiBinder Basics

Big Data Technology Core Hadoop: HDFS-YARN Internals

Overview. Big Data in Apache Hadoop. - HDFS - MapReduce in Hadoop - YARN. Big Data Management and Analytics

HADOOP PERFORMANCE TUNING

Building Web Services with Apache Axis2

Official Android Coding Style Conventions

A very short Intro to Hadoop

Apache Hadoop YARN: The Nextgeneration Distributed Operating. System. Zhijie Shen & Jian Hortonworks

Prepared By : Manoj Kumar Joshi & Vikas Sawhney

Pro Apache Hadoop. Second Edition. Sameer Wadkar. Madhu Siddalingaiah

Fair Scheduler. Table of contents

Sujee Maniyam, ElephantScale

Hadoop Architecture. Part 1

Istanbul Şehir University Big Data Camp 14. Hadoop Map Reduce. Aslan Bakirov Kevser Nur Çoğalmış

Map Reduce & Hadoop Recommended Text:

What We Can Do in the Cloud (2) -Tutorial for Cloud Computing Course- Mikael Fernandus Simalango WISE Research Lab Ajou University, South Korea

Apache Hadoop. Alexandru Costan

HADOOP MOCK TEST HADOOP MOCK TEST II

Introduction to Hadoop. New York Oracle User Group Vikas Sawhney

How to Install and Configure EBF15328 for MapR or with MapReduce v1

Apache HBase. Crazy dances on the elephant back

Hadoop Certification (Developer, Administrator HBase & Data Science) CCD-410, CCA-410 and CCB-400 and DS-200

Hadoop: A Framework for Data- Intensive Distributed Computing. CS561-Spring 2012 WPI, Mohamed Y. Eltabakh

International Journal of Advancements in Research & Technology, Volume 3, Issue 2, February ISSN

The Google Web Toolkit (GWT): Overview & Getting Started

YARN, the Apache Hadoop Platform for Streaming, Realtime and Batch Processing

Big Data Management and NoSQL Databases

How To Use Hadoop

Hadoop Fair Scheduler Design Document

Extending Hadoop beyond MapReduce

Hadoop implementation of MapReduce computational model. Ján Vaňo

Cloud Computing. Lectures 10 and 11 Map Reduce: System Perspective

Introduction to Hadoop HDFS and Ecosystems. Slides credits: Cloudera Academic Partners Program & Prof. De Liu, MSBA 6330 Harvesting Big Data

CURSO: ADMINISTRADOR PARA APACHE HADOOP

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Big Data With Hadoop

Managed Beans II Advanced Features

Complete Java Classes Hadoop Syllabus Contact No:

Rational Application Developer Performance Tips Introduction

Lecture 3 Hadoop Technical Introduction CSE 490H

Hadoop Design and k-means Clustering

Large scale processing using Hadoop. Ján Vaňo

Cloudera Manager Health Checks

Deploying Hadoop with Manager

CSE 590: Special Topics Course ( Supercomputing ) Lecture 10 ( MapReduce& Hadoop)

Android Programming Basics

The Hadoop Distributed File System

The Hadoop Distributed File System

Hadoop/MapReduce. Object-oriented framework presentation CSCI 5448 Casey McTaggart

CS455 - Lab 10. Thilina Buddhika. April 6, 2015

Hadoop Ecosystem Overview. CMSC 491 Hadoop-Based Distributed Computing Spring 2015 Adam Shook

Application Security

Hadoop 2.6 Configuration and More Examples

Extreme Computing. Hadoop MapReduce in more detail.

BigData. An Overview of Several Approaches. David Mera 16/12/2013. Masaryk University Brno, Czech Republic

Hadoop Parallel Data Processing

Mr. Apichon Witayangkurn Department of Civil Engineering The University of Tokyo

Capacity Scheduler Guide

COURSE CONTENT Big Data and Hadoop Training

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Welcome to the unit of Hadoop Fundamentals on Hadoop architecture. I will begin with a terminology review and then cover the major components

Architecture of Next Generation Apache Hadoop MapReduce Framework

Web Applications. Originals of Slides and Source Code for Examples:

Lecture 5: GFS & HDFS! Claudia Hauff (Web Information Systems)! ti2736b-ewi@tudelft.nl

Professional Hadoop Solutions

Hadoop. Apache Hadoop is an open-source software framework for storage and large scale processing of data-sets on clusters of commodity hardware.

Android Programming: 2D Drawing Part 1: Using ondraw

Working With Hadoop. Important Terminology. Important Terminology. Anatomy of MapReduce Job Run. Important Terminology

The Hadoop Eco System Shanghai Data Science Meetup

Mesos: A Platform for Fine- Grained Resource Sharing in Data Centers (II)

<Insert Picture Here> Big Data

Transcription:

2012 coreservlets.com and Dima May MapReduce on YARN Job Execution Originals of slides and source code for examples: http://www.coreservlets.com/hadoop-tutorial/ Also see the customized Hadoop training courses (onsite or at public venues) http://courses.coreservlets.com/hadoop-training.html Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location. 2012 coreservlets.com and Dima May For live customized Hadoop training (including prep for the Cloudera certification exam), please email info@coreservlets.com Taught by recognized Hadoop expert who spoke on Hadoop several times at JavaOne, and who uses Hadoop daily in real-world apps. Available at public venues, or customized versions can be held on-site at your organization. Courses developed and taught by Marty Hall JSF 2.2, PrimeFaces, servlets/jsp, Ajax, jquery, Android development, Java 7 or 8 programming, custom mix of topics Courses Customized available in any state Java or country. EE Training: Maryland/DC http://courses.coreservlets.com/ area companies can also choose afternoon/evening courses. Hadoop, Courses Java, developed JSF 2, PrimeFaces, and taught Servlets, by coreservlets.com JSP, Ajax, jquery, experts Spring, (edited Hibernate, by Marty) RESTful Web Services, Android. Spring, Hibernate/JPA, GWT, Hadoop, HTML5, RESTful Web Services Developed and taught by well-known author and developer. At public venues or onsite at your location. Contact info@coreservlets.com for details

Agenda YARN Components Details of MapReduce Job Execution Job Submission Job Initialization Tasks Assignment Tasks' Memory Status Updates Failure Recovery 4 YARN Yet Another Resource Negotiator (YARN) Responsible for Cluster Resource Management Scheduling Various applications can run on YARN MapReduce is just one choice http://wiki.apache.org/hadoop/poweredbyyarn Also referred to as MapReduce2.0, NextGen MapReduce Some of these names are deceiving as YARN doesn t have to be tied to MapReduce 5

YARN vs. Old MapReduce 6 Prior to YARN Hadoop had JobTracker and TaskTracker daemons JobTracker is responsible for handling resources and tasks progress monitoring/management Dealing with failed tasks Task Bookkeeping JobTracker based approach had drawbacks Scalability Bottleneck 4,000+ nodes Cluster Resource sharing and allocation flexibility Slot based approach (ex. 10 slots per machine no matter how small or big those tasks are) In 2010 Yahoo! started designing next generation MapReduce => YARN Sample YARN Daemons Deployments with HDFS and HBase Resource History Server Namenode HBase Master Namenode Management Management Management Data Data Data... Data Region Server Region Server Region Server Region Server 7 1 2 3 N

MapReduce on YARN Components Client submits MapReduce Job Resource controls the use of resources across the Hadoop cluster runs on each node in the cluster; creates execution container, monitors container s usage MapReduce Application Master Coordinates and manages MapReduce Jobs; negotiates with Resource to schedule tasks; the tasks are started by (s) HDFS shares resources and jobs artifacts between YARN components 8 MapReduce Job Execution on YARN your code 1 Run Job Job object 2 Get new application Submit application 4 Resource Client JVM Client Start MRAppMaster container 5 Management 9 Copy Job Resources HDFS 3 Get Input Splits 7 Source: Tom White. Hadoop: The Definitive Guide. O'Reilly Media. 2012 6 Create Container MR AppMaster X 8 Request Resources 9 Start container 11 Acquire Job Resources 10 Create container YarnChild 12 execute MapTask or ReduceTask X Task JVM

10 MapReduce on YARN Job Execution 1. Client submits MapReduce job by interacting with Job objects; Client runs in it s own JVM 2. Job s code interacts with Resource to acquire application meta-data, such as application id 3. Job s code moves all the job related resources to HDFS to make them available for the rest of the job 4. Job s code submits the application to Resource 5. Resource chooses a with available resources and requests a container for MRAppMaster 6. allocates container for MRAppMaster; MRAppMaster will execute and coordinate MapReduce job 7. MRAppMaster grabs required resource from HDFS, such as Input Splits; these resources were copied there in step 3 MapReduce Job Execution on YARN 8. MRAppMaster negotiates with Resource for available resources; Resource will select that has the most resources 9. MRAppMaster tells selected to start Map and Reduce tasks 10. creates YarnChild containers that will coordinate and run tasks 11.YarnChild acquires job resources from HDFS that will be required to execute Map and Reduce tasks 12. YarnChild executes Map and Reduce tasks 11

MapReduce Job Submission Use org.apache.hadoop.mapreduce.job class to configure the job Submit the job to the cluster and wait for it to finish. job.waitforcompletion(true) The YARN protocol is activated when mapreduce.framework.name property in mapred-site.xml is set to yarn Client code in client JVM 12 13 MapReduce Job Submission Steps 1. Application Id is retrieved from Resource 2. Job Client verifies output specification of the job Delegates to OutputFormat - you may have seen annoying messages that output directory already exists 3. Computes Input Splits Can optionally generate in the cluster good use case for jobs with many splits (yarn.app.mapreduce.am.compute-splits-incluster property) 4. Copy Job Resources to HDFS Jar files, configurations, input splits 5. Job Submission

MapReduce Job Submission Components your code 1 Run Job Job object 2 Get new application Submit application 4 Resource Client JVM Client Start MRAppMaster container 5 Management 14 Copy Job Resources HDFS 3 Get Input Splits 7 Source: Tom White. Hadoop: The Definitive Guide. O'Reilly Media. 2012 6 Create Container MR AppMaster X 8 Request Resources 9 Start container 11 Acquire Job Resources 10 Create container YarnChild 12 execute MapTask or ReduceTask X Job Initialization Steps 1. Resource receives request for a new application 2. Resource delegates to its internal component Scheduler There are various schedulers available 3. Scheduler requests a container for an Application Master process MapReduce s Application Master is MRAppMaster 4. MRAppMaster initializes its internal objects and executes a job by negotiating with Resource 15

MRAppMaster Initialization Steps 1. Creates internal bookkeeping objects to monitor progress 2. Retrieves Input Splits These were created by the client and copied onto HDFS 3. Creates tasks Map tasks per split Reduce tasks based on mapreduce.job.reduces property 4. Decides how to run the tasks In case of a small job, it will run all tasks in MRAppMaster s JVM; this job is called uberized or uber Execute tasks on 5. Execute the tasks 16 MapReduce Job Initialization Components your code 1 Run Job Job object 2 Get new application Submit application 4 Resource Client JVM Client Start MRAppMaster container 5 Management 17 Copy Job Resources HDFS 3 Get Input Splits 7 Source: Tom White. Hadoop: The Definitive Guide. O'Reilly Media. 2012 6 Create Container MR AppMaster X 8 Request Resources 9 Start container 11 Acquire Job Resources 10 Create container YarnChild 12 execute MapTask or ReduceTask X

MRAppMaster and Uber Job 18 If a job is too small the MRAppMaster will execute map and reduce tasks within the same JVM The idea that distributed task allocation and management overhead exceeds the benefits of executing tasks in parallel Will Uberize if all of these conditions are met: 1. Less than 10 mappers (mapreduce.job.ubertask.maxmaps property) 2. A single Reducer (mapreduce.job.ubertask.maxreduces property) 3. Input size less than 1 HDFS block (mapreduce.job.ubertask.maxbytes property) Execution of Jobs as Uber can be disabled Set mapreduce.job.ubertask.enable property to false Task Assignment Only applicable to non-uber Jobs MRAppMaster negotiates container for map and reduce tasks from Resource, request carry: data locality information (hosts & racks) which was computed by InputFormat and stored inside InputSplits Memory requirements for a task Scheduler on Resource utilizes provided information to make a decision on where to place these tasks Attempts locality: Ideally placing tasks on the same nodes where the data to process resides. Plan B is to place within the same rack 19

20 Fine-Grained Memory Model for Tasks In YARN, administrators and developers have a lot of control over memory management Typically there is one per machine Task Containers that run Map and Reduce tasks Multiple tasks can execute on a single Scheduler Minimum and maximum allocations controls JVM Heap Allocate memory for your code Virtual Memory Prevent tasks from monopolizing machines Memory Model: allocates containers that run Map and Reduce tasks The sum of all the containers can not exceed configured threshold will not allocate a container if there isn t enough available memory The memory allocation limit is configurable per Set yarn.nodemanager.resource.memory-mb property in yarn-default.xml Default is 8,192MB Configured once at start-up 21

Memory Model: Task s Memory Control the physical memory limit for each Job Physically limit what map and reduce tasks are allowed to allocate All of the physical memory usage must fall below the configured value Container Memory Usage = JVM Heap Size + JVM Perm Gen + Native Libraries + Memory used by spawned processes A Task is killed if it exceeds its allowed physical memory Specified by job-specific properties: mapreduce.map.memory.mb property for map tasks mapreduce.reduce.memory.mb property for reduce tasks Default memory is set to 1024 22 Memory Model: Scheduler Some schedulers enforce maximum and minimum values for memory allocations Must request between the configured minimum and maximum allocation values In increments of minimum value Default thresholds are scheduler specific For CapacityScheduler: min=1024mb, max=10240mb Allowed to request between 1024 and 10240MB for task in increments of 1024MB Can be adjusted via properties in yarn-site.xml yarn.scheduler.capacity.minimum-allocation-mb yarn.scheduler.capacity.maximum-allocation-mb 23

Memory Model: JVM Heap Recall that mapreduce.map.memory.mb and mapreduce.reduce.memory.mb properties set the limit for map and reduce containers Container s Memory Usage = JVM Heap Size + JVM Perm Gen + Native Libraries + Memory used by spawned processes JVM Heap size can be specified by job specific properties: mapreduce.reduce.java.opts mapreduce.map.java.opts Example: mapreduce.map.java.opts=-xmx2g 24 Memory Model: Virtual Memory 25 From top command documentation, Virtual Memory "includes all code, data and shared libraries plus pages that have been swapped out" Virtual Memory allocation is limited by A Task is killed if it exceeds it s allowed Virtual Memory Configured in multiples of physical memory Be default, it s 2.1 of container s physical memory Ex: If a container is configured to 1G of physical memory then it will not be able to exceed 2.1G of Virtual Memory Adjust via yarn.nodemanager.vmem-pmem-ratio property in yarn-site.xml Configured once at start-up

Memory Model Example Let s say you want to configure Map task s heap to be 512MB and reduce 1G Client s Job Configuration Heap Size: mapreduce.map.java.opts=-xmx512 mapreduce.reduce.java.opts=-xmx1g Container Limit, assume extra 512MB over Heap space is required mapreduce.map.memory.mb=1024 mapreduce.reduce.memory.mb=1536 YARN Configuration yarn-site.xml 10 Gigs per => 10 mappers or 6 reducers (or some combination) yarn.nodemanager.resource.memory-mb=10240 Adjust Scheduler property to allow allocation at 512MB increments yarn.scheduler.capacity.minimum-allocation-mb=512 Virtual Memory limit = 2.1 of configured physical memory 2150.4MB for Map tasks 3225.6MB for Reduce tasks 26 Task Execution 27 MRAppMaster requests to start container(s) Containers and (s) have already been chosen in the previous step For each task (s) start container a java process with YarnChild as the main class YarnChild is executed in the dedicated JVM Separate user code from long running Hadoop Daemons YarnChild copies required resource locally Configuration, jars, etc.. YarnChild executes map or reduce tasks

MapReduce Task Execution Components your code 1 Run Job Job object 2 Get new application Submit application 4 Resource Client JVM Client Start MRAppMaster container 5 Management 28 Copy Job Resources HDFS 3 Get Input Splits 7 Source: Tom White. Hadoop: The Definitive Guide. O'Reilly Media. 2012 6 Create Container MR AppMaster X 8 Request Resources 9 Start container 11 Acquire Job Resources 10 Create container YarnChild 12 execute MapTask or ReduceTask X Status Updates 29 Tasks report status to MRAppMaster Maintain umbilical interface Poll every 3 seconds MRAppMaster accumulates and aggregates the information to assemble current status of the job Determines if the job is done Client (Job object) polls MRAppMaster for status updates Every second by default, Configure via property mapreduce.client.progressmonitor.pollinterval Resource Web UI displays all the running YARN applications where each one is a link to Web UI of Application Master In this case MRAppMaster Web UI

MapReduce Status Updates your code Client JVM Client Job object Resource Management Poll for status MR AppMaster YarnChild 30 HDFS Source: Tom White. Hadoop: The Definitive Guide. O'Reilly Media. 2012 Update status MapTask or ReduceTask X Task JVM Failures Failures can occur in Tasks Application Master MRAppMaster Resource 31

Task Failures Most likely offender and easiest to handle Task s exceptions and JVM crashes are propagated to MRAppMaster Attempt (not a task) is marked as failed Hanging tasks will be noticed, killed Attempt is marked as failed Control via mapreduce.task.timeout property Task is considered to be failed after 4 attempts Set for map tasks via mapreduce.map.maxattempts Set for reduce tasks via mapreduce.reduce.maxattempts 32 Application Master Failures - MRAppMaster MRAppMaster Application can be re-tried By default will not re-try and will fail after a single application failure Enable re-try by increasing yarn.resourcemanager.am.max-retries property Resource recieves heartbeats from MRAppMaster and can restart in case of failure(s) Restarted MRAppMaster can recover latest state of the tasks Completed tasks will not need to be re-run To enable set yarn.app.mapreduce.am.job.recovery.enable property to true 33

Failure Failed will not send heartbeat messages to Resource Resource will black list a that hasn t reported within 10 minutes Configure via property: yarn.resourcemanager.nm.liveness-monitor.expiryinterval-ms Usually there is no need to change this setting Tasks on a failed are recovered and placed on healthy s 34 Blacklisting by MRAppMaster MRAppMaster may blacklist s if the number of failures is high on that node MRAppMaster will attempt to reschedule tasks on a blacklisted onto Healthy s Blacklisting is per Application/Job therefore doesn t affect other Jobs By default blacklisting happens after 3 failures on the same node Adjust default via mapreduce.job.maxtaskfailures.per.tracker 35

Resource Failures The most serious failure = downtime Jobs or Tasks can not be launched Resource was designed to automatically recover Incomplete implementation at this point Saves state into persistent store by configuring yarn.resourcemanager.store.class property The only stable option for now is in-memory store org.apache.hadoop.yarn.server.resourcemanager.recover y.memstore Zookeeper based implementation is coming You can track progress via https://issues.apache.org/jira/browse/mapreduce-4345 36 Job Scheduling By default FIFO scheduler is used First In First Out Supports basic priority model: VERY_LOW, LOW, NORMAL, HIGH, and VERY_HIGH Two ways to specify priority mapreduce.job.priority property job.setpriority(jobpriority.high) Specify scheduler via yarn.resourcemanager.scheduler.class property CapacityScheduler FairScheduler 37

Job Completion After MapReduce application completes (or fails) MRAppMaster and YARN Child JVMs are shut down Management and metrics information is sent from MRAppMaster to the MapReduce History Server History server has a similar Web UI to YARN Resource and MRAppMaster By default runs on port 19888 http://localhost:19888/jobhistory Resource UI auto-magically proxies to the proper location, MRAppMaster if an application is running and History Server after application s completion May get odd behavior (blank pages) if you access an application as it s moving its management from MRAppMaster to History Server 38 2012 coreservlets.com and Dima May Wrap-Up Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location.

Summary We learned about YARN Components We discussed MapReduce Job Execution Job Submission Job Initialization Tasks Assignment Tasks' Memory Status Updates Failure Recovery 40 2012 coreservlets.com and Dima May Questions? More info: http://www.coreservlets.com/hadoop-tutorial/ Hadoop programming tutorial http://courses.coreservlets.com/hadoop-training.html Customized Hadoop training courses, at public venues or onsite at your organization http://courses.coreservlets.com/course-materials/java.html General Java programming tutorial http://www.coreservlets.com/java-8-tutorial/ Java 8 tutorial http://www.coreservlets.com/jsf-tutorial/jsf2/ JSF 2.2 tutorial http://www.coreservlets.com/jsf-tutorial/primefaces/ PrimeFaces tutorial http://coreservlets.com/ JSF 2, PrimeFaces, Java 7 or 8, Ajax, jquery, Hadoop, RESTful Web Services, Android, HTML5, Spring, Hibernate, Servlets, JSP, GWT, and other Java EE training Customized Java EE Training: http://courses.coreservlets.com/ Hadoop, Java, JSF 2, PrimeFaces, Servlets, JSP, Ajax, jquery, Spring, Hibernate, RESTful Web Services, Android. Developed and taught by well-known author and developer. At public venues or onsite at your location.