SlideShare a Scribd company logo
www.edureka.co/r-for-analytics
www.edureka.co/mapreduce-design-patterns
Top 3 Design Patterns in MapReduce
Slide 2Slide 2Slide 2 www.edureka.co/mapreduce-design-patterns
Today we will take you through the following:
 Summarization Patterns
 Numerical Summarization
 Filter Patterns
 Finding Top K records
 Join Patterns
 Reduce side join
Agenda
Hands On
Hands On
Hands On
Slide 3Slide 3Slide 3 www.edureka.co/mapreduce-design-patterns
MapReduce Review
Slide 4Slide 4Slide 4 www.edureka.co/mapreduce-design-patterns
Why MapReduce Design Patterns - Question
Let's broach this topic with few questions.
 Will you use standard sorting algorithms on MapReduce framework ?
» Quick Sort, Merge Sort etc. ??? NO
» Why ?
 MapReduce imposes constraints like any other framework
» You have to think in terms of Map tasks and Reduce tasks
» Programmer has little control over many aspects of execution
 But MapReduce does provide a number of techniques for controlling flow of data
Slide 5Slide 5Slide 5 www.edureka.co/mapreduce-design-patterns
MapReduce Paradigm - Constraints (Contd.)
 Programmer has little control over many aspects of execution
» Where a mapper or reducer runs
» When a mapper or reducer begins or finishes
» Which input key-value pairs are processed by a specific mapper
» Which intermediate key-value pairs are processed by a specific reducer
Slide 6Slide 6Slide 6 www.edureka.co/mapreduce-design-patterns
Why MapReduce Design Patterns - Answer
 Because of the constraints discussed in earlier slide
» Design Patterns help you solve problems and people have learnt to solve these problems in the best
possible ways
 Because of the MapReduce techniques for controlling execution & flow of data
» Use these techniques on problems in standard ways that people have already created
 Judicious use of Distributed Cache, Sorting Comparator can help in quite a few algorithms
 Scalability & Efficiency concerns
Slide 7Slide 7Slide 7 www.edureka.co/mapreduce-design-patterns
Summarization Patterns – What is it
 Provides high level aggregate view of data set when visual inspection of whole data not feasible
 Group similar data together and perform an operations like
» Calculating a statistic, indexing, counting etc.
 Apply on a new dataset to quickly understand what's important and what to look closely at
 Example
» Number of hits per hour per location on a website in a web log
» Average length of comments / user in blog comments
» Top ten salary per profession region-wise
Slide 8Slide 8Slide 8 www.edureka.co/mapreduce-design-patterns
Numerical Summarizations – Description
 General Pattern for calculating aggregate statistic on the dataset
 Group records by a key field and calculate a numerical aggregate per group
» Min, max, sum, average, median, standard deviation etc.
 Use Combiner properly for efficient implementation
 Example
» Take advertising actions based on hours users are most active on your site
» Group hourly average amount users spend on your site
 Applicability – Use it when
» You are dealing with numerical data or counting
» The data can be grouped by fields
Slide 9Slide 9Slide 9 www.edureka.co/mapreduce-design-patterns
Numerical Summarizations – Structure
 Mapper
» Output Key = field to group by; Output Value = numerical item to summarize on
» Make sure only relevant items are output from Map to Reduce network traffic
 Combiner
» Use if summarization operation on reducer is Associative & Commutative
» Will reduce the network traffic between Map tasks & Reduce tasks
Slide 10Slide 10Slide 10 www.edureka.co/mapreduce-design-patterns
Numerical Summarizations – Structure (Contd.)
 Partitioner
» Use custom partitioner if you feel skew in the data
» To distribute computation uniformly across reducers
 Reducer
» Each reducer applies summarization function on the data set received on the group key
» Output key = group key; summarization statistic
» Job output is a set of part files containing a single record per reducer input group
Slide 11Slide 11Slide 11 www.edureka.co/mapreduce-design-patterns
Numerical Summarizations – Analogy, Performance
 Performance
» The crux of this pattern – Grouping by key – is what MapReduce provides at it's core
» Performs well when combiner is used properly
» For skewed dataset, use custom partitioner for improved performance
» Use appropriate number of reducers
Slide 12Slide 12Slide 12 www.edureka.co/mapreduce-design-patterns
Numerical Summarizations – Use Cases
 Min/Max/Count
» Analytics to find minimum, maximum, count of an event
 Average/Median/Standard Deviation
» Analytics similar to Min/Max/Count
» Implementation not as straight forward as operations not associative
 Record Count
» Common analytics to get a heartbeat of data flow rate on a particular interval
 Word Count
» Basic Text Analytics of word count in a document
» Hello World of MapReduce
Slide 13Slide 13Slide 13 www.edureka.co/mapreduce-design-patterns
Min/Max/Count Example – Data Flow
Slide 14Slide 14Slide 14 www.edureka.co/mapreduce-design-patterns
DEMO
Min/Max/Count Example
Slide 15Slide 15Slide 15 www.edureka.co/mapreduce-design-patterns
Filtering Patterns – What is it
 Finding a subset of interest from a large data set
 So that further analytics can be applied on this subset
 These patterns don't alter the original dataset
Example:
 Sampling – to get a representative sample to apply on Machine Learning Algorithms
 Selecting all records for a user to apply further analytics
Slide 16Slide 16Slide 16 www.edureka.co/mapreduce-design-patterns
Basic Filtering Pattern – Description
 Acts as a basic filtering abstract pattern for some other patterns
 Filter out records that are not of interest and keep the ones that are
 Parallel processing system like Hadoop is required due to large size of original data set
 Filtered in subset may be large or small
Example: To study behaviour of users between 10-11am filter out records from log file
Applicability – Use it when
 Widely applicable
 Use it when data can be easily parsed to yield a filtering criteria
Slide 17Slide 17Slide 17 www.edureka.co/mapreduce-design-patterns
Basic Filtering Pattern – Structure
Slide 18Slide 18Slide 18 www.edureka.co/mapreduce-design-patterns
Basic Filtering Pattern – Description
Mapper
 Applies filtering criteria to each record it receives
 Outputs records that match filtering in criteria
 Output key/value pairs same as input key/value pairs
Combiner
 Not Required; map only job
Partitioner
 Not Required; map only job
Reducer
 Generally Not Required ; Map Only job
 But can use Identity reducers
Slide 19Slide 19Slide 19 www.edureka.co/mapreduce-design-patterns
Basic Filtering Pattern – Use Cases
 Closer view of data
 Removing low scoring data
 Distributed grep
 Data cleansing
 Simple random sampling
 Tracking a thread of events
Slide 20Slide 20Slide 20 www.edureka.co/mapreduce-design-patterns
Top Ten – Description
 Filter in a fixed and relatively small number (10) of records from a large data set
 Based on a total ordering ranking criteria
 You can manually look at this small number of records to see what's special about them
 Important in terms of how one would implement Top Ten in MapReduce vis-a-vis SQL
» In SQL or any programming language you would sort and then take top 10
» In Map Reduce total order sorting is complex and resource intensive
Example: Top ten users with highest number of comments posted on Stackoverflow in 2014
Slide 21Slide 21Slide 21 www.edureka.co/mapreduce-design-patterns
Top Ten – Applicability
Applicability – Use it when
 A comparator function is available for ranking records
 Number of output records much smaller than input records
» If not, one is better off sorting the whole dataset
Slide 22Slide 22Slide 22 www.edureka.co/mapreduce-design-patterns
Top Ten – Structure
Slide 23Slide 23Slide 23 www.edureka.co/mapreduce-design-patterns
Mapper
 In setup() method initialize an array of size k(=10)
 In map(), insert record field into array in a sorted way
 If sizeOf(array) truncate array to size == 10, keeping highest 10
 In cleanup() read the array and output key = null and value = record
Combiner and custom Partitioner not required
Reducer
 Considering number of output records from mapper is small only 1 reducer is used
 Reducer does things similar to mapper
Top Ten – Structure
Slide 24Slide 24Slide 24 www.edureka.co/mapreduce-design-patterns
Top Ten – Use Cases
 Outlier analysis
 Select interesting data for further BI systems which cannot handle Big Data sets
 Publish interesting dashboards
Slide 25Slide 25Slide 25 www.edureka.co/mapreduce-design-patterns
DEMO
Top Ten Example
Slide 26Slide 26Slide 26 www.edureka.co/mapreduce-design-patterns
Join Patterns – What is it
 Datasets generally exist in multiple sources
 Deriving full-value requires merging them together
 Join Patterns are used for this purpose
 Performing joins on the fly on Big Data can be costly in terms of time
Example: Joining StackOverflow data from Comments & Posts on UserId
Slide 27Slide 27Slide 27 www.edureka.co/mapreduce-design-patterns
Join – Refresher
 Inner Join
 Outer Join
» Left Outer Join
» Right Outer Join
» Full Outer Join
 Anti Join
 Cartesian Product
Slide 28Slide 28Slide 28 www.edureka.co/mapreduce-design-patterns
Reduce Side Join – Description
 Easiest to implement but can be longest to execute
 Supports all types of join operation
 Can join multiple data sources, but expensive in terms of network resources & time
 All data transferred across network
Example : Join PostLinks table data in StackOverflow to Posts data
Slide 29Slide 29Slide 29 www.edureka.co/mapreduce-design-patterns
Reduce Side Join – Description (Contd.)
 Applicability – Use it when
» Multiple large data sets require to be joined
» If one of the data sources is small look at using replicated join
» Different data sources are linked by a foreign key
» You want all join operations to be supported
Slide 30Slide 30Slide 30 www.edureka.co/mapreduce-design-patterns
Reduce Side Join – Structure
Slide 31Slide 31Slide 31 www.edureka.co/mapreduce-design-patterns
Reduce Side Join – Structure (Contd.)
 Mapper
» Output key should reflect the foreign key
» Value can be the whole record and an identifier to identify the source
» Use projection and output only the required number of fields
 Combiner
» Not Required ; No additional benefit
 Partitioner
» User Custom Partitioner if required;
 Reducer
» Reducer logic based on type of join required
» Reducer receives the data from all the different sources per key
Slide 32Slide 32Slide 32 www.edureka.co/mapreduce-design-patterns
Reduce Side Join – Performance
 Performance
» The whole data moves across the network to reducers
» You can optimize by using projection and sending only the required fields
» Number of reducers typically higher than normal
» If you can use any other Join type for your problem, use that instead
Slide 33Slide 33Slide 33 www.edureka.co/mapreduce-design-patterns
DEMO
Reduce Side Join Example
Demo
Questions
Slide 35
Slide 36
Your feedback is vital for us, be it a compliment, a suggestion or a complaint. It helps us to make your
experience better!
Please spare few minutes to take the survey after the webinar.
Survey
Top 3 design patterns in Map Reduce

More Related Content

PDF
Hadoop Design Patterns
 
PDF
Webinar: Tailored Big Data Solutions using MapReduce Design Patterns
PDF
Relational Algebra and MapReduce
PPT
Map Reduce
PPTX
An introduction to Hadoop for large scale data analysis
PPT
SQL Optimization With Trace Data And Dbms Xplan V6
PPTX
EDHREC @ Data Science MD
PDF
Apache Spark
Hadoop Design Patterns
 
Webinar: Tailored Big Data Solutions using MapReduce Design Patterns
Relational Algebra and MapReduce
Map Reduce
An introduction to Hadoop for large scale data analysis
SQL Optimization With Trace Data And Dbms Xplan V6
EDHREC @ Data Science MD
Apache Spark

What's hot (20)

PDF
Applying stratosphere for big data analytics
PDF
Application of MapReduce in Cloud Computing
PPTX
Stratosphere with big_data_analytics
DOC
A Survey on Data Mapping Strategy for data stored in the storage cloud 111
PPTX
Intro to Hybrid Data Warehouse
PPTX
Large-Scale Graph Computation on Just a PC: Aapo Kyrola Ph.D. thesis defense
PPTX
Large-scale Recommendation Systems on Just a PC
PDF
GraphChi big graph processing
PPTX
Analysing of big data using map reduce
PPTX
High Performance Data Analytics with Java on Large Multicore HPC Clusters
PPT
Hadoop Summit 2009 Hive
PDF
A Big-Data Process Consigned Geographically by Employing Mapreduce Frame Work
PPT
Lecture 24
PDF
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink Forward 2015
PDF
Building data fusion surrogate models for spacecraft aerodynamic problems wit...
PDF
Data Structures for Statistical Computing in Python
PPT
Scalable Machine Learning: The Role of Stratified Data Sharding
PDF
Machine Learning - Unsupervised Learning
PPTX
Introduction to Map Reduce
PDF
Reduce Side Joins
Applying stratosphere for big data analytics
Application of MapReduce in Cloud Computing
Stratosphere with big_data_analytics
A Survey on Data Mapping Strategy for data stored in the storage cloud 111
Intro to Hybrid Data Warehouse
Large-Scale Graph Computation on Just a PC: Aapo Kyrola Ph.D. thesis defense
Large-scale Recommendation Systems on Just a PC
GraphChi big graph processing
Analysing of big data using map reduce
High Performance Data Analytics with Java on Large Multicore HPC Clusters
Hadoop Summit 2009 Hive
A Big-Data Process Consigned Geographically by Employing Mapreduce Frame Work
Lecture 24
Gradoop: Scalable Graph Analytics with Apache Flink @ Flink Forward 2015
Building data fusion surrogate models for spacecraft aerodynamic problems wit...
Data Structures for Statistical Computing in Python
Scalable Machine Learning: The Role of Stratified Data Sharding
Machine Learning - Unsupervised Learning
Introduction to Map Reduce
Reduce Side Joins
Ad

Viewers also liked (11)

PDF
A new methodology for large scale nosql benchmarking
PPTX
[150824]symposium v4
PPT
Big Data Analytics with Hadoop with @techmilind
 
PDF
PPTX
MapReduce Design Patterns
PDF
Apache Hadoop YARN - Enabling Next Generation Data Applications
PPTX
MapReduce basic
PPT
Hadoop MapReduce Fundamentals
PPT
Introduction To Map Reduce
PPT
Seminar Presentation Hadoop
PPTX
Introduction to YARN and MapReduce 2
A new methodology for large scale nosql benchmarking
[150824]symposium v4
Big Data Analytics with Hadoop with @techmilind
 
MapReduce Design Patterns
Apache Hadoop YARN - Enabling Next Generation Data Applications
MapReduce basic
Hadoop MapReduce Fundamentals
Introduction To Map Reduce
Seminar Presentation Hadoop
Introduction to YARN and MapReduce 2
Ad

Similar to Top 3 design patterns in Map Reduce (20)

PDF
Mrdp reduce side_join
ODT
ACADILD:: HADOOP LESSON
PDF
MapReduce Algorithm Design
PDF
HUG August 2010: Best practices
PDF
2 mapreduce-model-principles
PDF
MapReduce Algorithm Design - Parallel Reduce Operations
PPT
design mapping lecture6-mapreducealgorithmdesign.ppt
PPTX
Module3 for enginerring students ppt.pptx
PDF
The MapReduce Design Patterns Training in Banhgalore
PPT
MapReduce Design Patterns
PDF
1. Big Data - Introduction(what is bigdata).pdf
PPTX
NOSQL introduction for big data analytics
PPTX
Main map reduce
PPTX
writing Hadoop Map Reduce programs
PPTX
20131011 - Los Gatos - Netflix - Big Data Design Patterns
PDF
Big Data Analytics Chapter3-6@2021.pdf
PDF
Introduction to Big Data
PDF
Scalable Algorithm Design with MapReduce
PPTX
Apache hadoop
Mrdp reduce side_join
ACADILD:: HADOOP LESSON
MapReduce Algorithm Design
HUG August 2010: Best practices
2 mapreduce-model-principles
MapReduce Algorithm Design - Parallel Reduce Operations
design mapping lecture6-mapreducealgorithmdesign.ppt
Module3 for enginerring students ppt.pptx
The MapReduce Design Patterns Training in Banhgalore
MapReduce Design Patterns
1. Big Data - Introduction(what is bigdata).pdf
NOSQL introduction for big data analytics
Main map reduce
writing Hadoop Map Reduce programs
20131011 - Los Gatos - Netflix - Big Data Design Patterns
Big Data Analytics Chapter3-6@2021.pdf
Introduction to Big Data
Scalable Algorithm Design with MapReduce
Apache hadoop

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation theory and applications.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
A Presentation on Artificial Intelligence
PPT
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Encapsulation theory and applications.pdf
A comparative analysis of optical character recognition models for extracting...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
A Presentation on Artificial Intelligence
Teaching material agriculture food technology

Top 3 design patterns in Map Reduce

  • 2. Slide 2Slide 2Slide 2 www.edureka.co/mapreduce-design-patterns Today we will take you through the following:  Summarization Patterns  Numerical Summarization  Filter Patterns  Finding Top K records  Join Patterns  Reduce side join Agenda Hands On Hands On Hands On
  • 3. Slide 3Slide 3Slide 3 www.edureka.co/mapreduce-design-patterns MapReduce Review
  • 4. Slide 4Slide 4Slide 4 www.edureka.co/mapreduce-design-patterns Why MapReduce Design Patterns - Question Let's broach this topic with few questions.  Will you use standard sorting algorithms on MapReduce framework ? » Quick Sort, Merge Sort etc. ??? NO » Why ?  MapReduce imposes constraints like any other framework » You have to think in terms of Map tasks and Reduce tasks » Programmer has little control over many aspects of execution  But MapReduce does provide a number of techniques for controlling flow of data
  • 5. Slide 5Slide 5Slide 5 www.edureka.co/mapreduce-design-patterns MapReduce Paradigm - Constraints (Contd.)  Programmer has little control over many aspects of execution » Where a mapper or reducer runs » When a mapper or reducer begins or finishes » Which input key-value pairs are processed by a specific mapper » Which intermediate key-value pairs are processed by a specific reducer
  • 6. Slide 6Slide 6Slide 6 www.edureka.co/mapreduce-design-patterns Why MapReduce Design Patterns - Answer  Because of the constraints discussed in earlier slide » Design Patterns help you solve problems and people have learnt to solve these problems in the best possible ways  Because of the MapReduce techniques for controlling execution & flow of data » Use these techniques on problems in standard ways that people have already created  Judicious use of Distributed Cache, Sorting Comparator can help in quite a few algorithms  Scalability & Efficiency concerns
  • 7. Slide 7Slide 7Slide 7 www.edureka.co/mapreduce-design-patterns Summarization Patterns – What is it  Provides high level aggregate view of data set when visual inspection of whole data not feasible  Group similar data together and perform an operations like » Calculating a statistic, indexing, counting etc.  Apply on a new dataset to quickly understand what's important and what to look closely at  Example » Number of hits per hour per location on a website in a web log » Average length of comments / user in blog comments » Top ten salary per profession region-wise
  • 8. Slide 8Slide 8Slide 8 www.edureka.co/mapreduce-design-patterns Numerical Summarizations – Description  General Pattern for calculating aggregate statistic on the dataset  Group records by a key field and calculate a numerical aggregate per group » Min, max, sum, average, median, standard deviation etc.  Use Combiner properly for efficient implementation  Example » Take advertising actions based on hours users are most active on your site » Group hourly average amount users spend on your site  Applicability – Use it when » You are dealing with numerical data or counting » The data can be grouped by fields
  • 9. Slide 9Slide 9Slide 9 www.edureka.co/mapreduce-design-patterns Numerical Summarizations – Structure  Mapper » Output Key = field to group by; Output Value = numerical item to summarize on » Make sure only relevant items are output from Map to Reduce network traffic  Combiner » Use if summarization operation on reducer is Associative & Commutative » Will reduce the network traffic between Map tasks & Reduce tasks
  • 10. Slide 10Slide 10Slide 10 www.edureka.co/mapreduce-design-patterns Numerical Summarizations – Structure (Contd.)  Partitioner » Use custom partitioner if you feel skew in the data » To distribute computation uniformly across reducers  Reducer » Each reducer applies summarization function on the data set received on the group key » Output key = group key; summarization statistic » Job output is a set of part files containing a single record per reducer input group
  • 11. Slide 11Slide 11Slide 11 www.edureka.co/mapreduce-design-patterns Numerical Summarizations – Analogy, Performance  Performance » The crux of this pattern – Grouping by key – is what MapReduce provides at it's core » Performs well when combiner is used properly » For skewed dataset, use custom partitioner for improved performance » Use appropriate number of reducers
  • 12. Slide 12Slide 12Slide 12 www.edureka.co/mapreduce-design-patterns Numerical Summarizations – Use Cases  Min/Max/Count » Analytics to find minimum, maximum, count of an event  Average/Median/Standard Deviation » Analytics similar to Min/Max/Count » Implementation not as straight forward as operations not associative  Record Count » Common analytics to get a heartbeat of data flow rate on a particular interval  Word Count » Basic Text Analytics of word count in a document » Hello World of MapReduce
  • 13. Slide 13Slide 13Slide 13 www.edureka.co/mapreduce-design-patterns Min/Max/Count Example – Data Flow
  • 14. Slide 14Slide 14Slide 14 www.edureka.co/mapreduce-design-patterns DEMO Min/Max/Count Example
  • 15. Slide 15Slide 15Slide 15 www.edureka.co/mapreduce-design-patterns Filtering Patterns – What is it  Finding a subset of interest from a large data set  So that further analytics can be applied on this subset  These patterns don't alter the original dataset Example:  Sampling – to get a representative sample to apply on Machine Learning Algorithms  Selecting all records for a user to apply further analytics
  • 16. Slide 16Slide 16Slide 16 www.edureka.co/mapreduce-design-patterns Basic Filtering Pattern – Description  Acts as a basic filtering abstract pattern for some other patterns  Filter out records that are not of interest and keep the ones that are  Parallel processing system like Hadoop is required due to large size of original data set  Filtered in subset may be large or small Example: To study behaviour of users between 10-11am filter out records from log file Applicability – Use it when  Widely applicable  Use it when data can be easily parsed to yield a filtering criteria
  • 17. Slide 17Slide 17Slide 17 www.edureka.co/mapreduce-design-patterns Basic Filtering Pattern – Structure
  • 18. Slide 18Slide 18Slide 18 www.edureka.co/mapreduce-design-patterns Basic Filtering Pattern – Description Mapper  Applies filtering criteria to each record it receives  Outputs records that match filtering in criteria  Output key/value pairs same as input key/value pairs Combiner  Not Required; map only job Partitioner  Not Required; map only job Reducer  Generally Not Required ; Map Only job  But can use Identity reducers
  • 19. Slide 19Slide 19Slide 19 www.edureka.co/mapreduce-design-patterns Basic Filtering Pattern – Use Cases  Closer view of data  Removing low scoring data  Distributed grep  Data cleansing  Simple random sampling  Tracking a thread of events
  • 20. Slide 20Slide 20Slide 20 www.edureka.co/mapreduce-design-patterns Top Ten – Description  Filter in a fixed and relatively small number (10) of records from a large data set  Based on a total ordering ranking criteria  You can manually look at this small number of records to see what's special about them  Important in terms of how one would implement Top Ten in MapReduce vis-a-vis SQL » In SQL or any programming language you would sort and then take top 10 » In Map Reduce total order sorting is complex and resource intensive Example: Top ten users with highest number of comments posted on Stackoverflow in 2014
  • 21. Slide 21Slide 21Slide 21 www.edureka.co/mapreduce-design-patterns Top Ten – Applicability Applicability – Use it when  A comparator function is available for ranking records  Number of output records much smaller than input records » If not, one is better off sorting the whole dataset
  • 22. Slide 22Slide 22Slide 22 www.edureka.co/mapreduce-design-patterns Top Ten – Structure
  • 23. Slide 23Slide 23Slide 23 www.edureka.co/mapreduce-design-patterns Mapper  In setup() method initialize an array of size k(=10)  In map(), insert record field into array in a sorted way  If sizeOf(array) truncate array to size == 10, keeping highest 10  In cleanup() read the array and output key = null and value = record Combiner and custom Partitioner not required Reducer  Considering number of output records from mapper is small only 1 reducer is used  Reducer does things similar to mapper Top Ten – Structure
  • 24. Slide 24Slide 24Slide 24 www.edureka.co/mapreduce-design-patterns Top Ten – Use Cases  Outlier analysis  Select interesting data for further BI systems which cannot handle Big Data sets  Publish interesting dashboards
  • 25. Slide 25Slide 25Slide 25 www.edureka.co/mapreduce-design-patterns DEMO Top Ten Example
  • 26. Slide 26Slide 26Slide 26 www.edureka.co/mapreduce-design-patterns Join Patterns – What is it  Datasets generally exist in multiple sources  Deriving full-value requires merging them together  Join Patterns are used for this purpose  Performing joins on the fly on Big Data can be costly in terms of time Example: Joining StackOverflow data from Comments & Posts on UserId
  • 27. Slide 27Slide 27Slide 27 www.edureka.co/mapreduce-design-patterns Join – Refresher  Inner Join  Outer Join » Left Outer Join » Right Outer Join » Full Outer Join  Anti Join  Cartesian Product
  • 28. Slide 28Slide 28Slide 28 www.edureka.co/mapreduce-design-patterns Reduce Side Join – Description  Easiest to implement but can be longest to execute  Supports all types of join operation  Can join multiple data sources, but expensive in terms of network resources & time  All data transferred across network Example : Join PostLinks table data in StackOverflow to Posts data
  • 29. Slide 29Slide 29Slide 29 www.edureka.co/mapreduce-design-patterns Reduce Side Join – Description (Contd.)  Applicability – Use it when » Multiple large data sets require to be joined » If one of the data sources is small look at using replicated join » Different data sources are linked by a foreign key » You want all join operations to be supported
  • 30. Slide 30Slide 30Slide 30 www.edureka.co/mapreduce-design-patterns Reduce Side Join – Structure
  • 31. Slide 31Slide 31Slide 31 www.edureka.co/mapreduce-design-patterns Reduce Side Join – Structure (Contd.)  Mapper » Output key should reflect the foreign key » Value can be the whole record and an identifier to identify the source » Use projection and output only the required number of fields  Combiner » Not Required ; No additional benefit  Partitioner » User Custom Partitioner if required;  Reducer » Reducer logic based on type of join required » Reducer receives the data from all the different sources per key
  • 32. Slide 32Slide 32Slide 32 www.edureka.co/mapreduce-design-patterns Reduce Side Join – Performance  Performance » The whole data moves across the network to reducers » You can optimize by using projection and sending only the required fields » Number of reducers typically higher than normal » If you can use any other Join type for your problem, use that instead
  • 33. Slide 33Slide 33Slide 33 www.edureka.co/mapreduce-design-patterns DEMO Reduce Side Join Example
  • 34. Demo
  • 36. Slide 36 Your feedback is vital for us, be it a compliment, a suggestion or a complaint. It helps us to make your experience better! Please spare few minutes to take the survey after the webinar. Survey

Editor's Notes