More MapReduce Jimmy Lin The iSchool University of Maryland Tuesday, March 31, 2009 This work is licensed under a Creative Commons Attribution-Noncommercial-Share.

Slides:



Advertisements
Similar presentations
Inner Architecture of a Social Networking System Petr Kunc, Jaroslav Škrabálek, Tomáš Pitner.
Advertisements

MAP REDUCE PROGRAMMING Dr G Sudha Sadasivam. Map - reduce sort/merge based distributed processing Best for batch- oriented processing Sort/merge is primitive.
Parallel Computing MapReduce Examples Parallel Efficiency Assignment
HadoopDB Inneke Ponet.  Introduction  Technologies for data analysis  HadoopDB  Desired properties  Layers of HadoopDB  HadoopDB Components.
Big Data Infrastructure Jimmy Lin University of Maryland Monday, February 9, 2015 Session 3: MapReduce – Basic Algorithm Design This work is licensed under.
大规模数据处理 / 云计算 Lecture 4 – Mapreduce Algorithm Design 彭波 北京大学信息科学技术学院 4/24/2011 This work is licensed under a Creative.
Cloud Computing Lecture #3 More MapReduce Jimmy Lin The iSchool University of Maryland Wednesday, September 10, 2008 This work is licensed under a Creative.
LBSC 690 Session #7 Structured Information: Databases Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under.
MapReduce Algorithm Design Data-Intensive Information Processing Applications ― Session #3 Jimmy Lin University of Maryland Tuesday, February 9, 2010 This.
Hadoop: Nuts and Bolts Data-Intensive Information Processing Applications ― Session #2 Jimmy Lin University of Maryland Tuesday, February 2, 2010 This.
MapReduce and databases Data-Intensive Information Processing Applications ― Session #7 Jimmy Lin University of Maryland Tuesday, March 23, 2010 This work.
Jimmy Lin The iSchool University of Maryland Wednesday, April 15, 2009
Chris Olston Benjamin Reed Utkarsh Srivastava Ravi Kumar Andrew Tomkins Pig Latin: A Not-So-Foreign Language For Data Processing Research.
ACL, June Pairwise Document Similarity in Large Collections with MapReduce Tamer Elsayed, Jimmy Lin, and Douglas W. Oard University of Maryland,
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland Tuesday, June 29, 2010 This work is licensed.
Cloud Computing Lecture #7 Introduction to Ajax Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a.
Ivory : Ivory : Pairwise Document Similarity in Large Collection with MapReduce Tamer Elsayed, Jimmy Lin, and Doug Oard Laboratory for Computational Linguistics.
Google Bigtable A Distributed Storage System for Structured Data Hadi Salimi, Distributed Systems Laboratory, School of Computer Engineering, Iran University.
Data-Intensive Text Processing with MapReduce Jimmy Lin The iSchool University of Maryland Sunday, May 31, 2009 This work is licensed under a Creative.
Homework 2 In the docs folder of your Berkeley DB, have a careful look at documentation on how to configure BDB in main memory. In the docs folder of your.
BigTable CSE 490h, Autumn What is BigTable? z “A BigTable is a sparse, distributed, persistent multidimensional sorted map. The map is indexed by.
HADOOP ADMIN: Session -2
Hadoop Team: Role of Hadoop in the IDEAL Project ●Jose Cadena ●Chengyuan Wen ●Mengsu Chen CS5604 Spring 2015 Instructor: Dr. Edward Fox.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland MLG, January, 2014 Jaehwan Lee.
CS506/606: Problem Solving with Large Clusters Zak Shafran, Richard Sproat Spring 2011 Introduction URL:
Advanced Topics: MapReduce ECE 454 Computer Systems Programming Topics: Reductions Implemented in Distributed Frameworks Distributed Key-Value Stores Hadoop.
SIDDHARTH MEHTA PURSUING MASTERS IN COMPUTER SCIENCE (FALL 2008) INTERESTS: SYSTEMS, WEB.
USING HADOOP & HBASE TO BUILD CONTENT RELEVANCE & PERSONALIZATION Tools to build your big data application Ameya Kanitkar.
Chris Olston Benjamin Reed Utkarsh Srivastava Ravi Kumar Andrew Tomkins Pig Latin: A Not-So-Foreign Language For Data Processing Research.
SOFTWARE SYSTEMS DEVELOPMENT MAP-REDUCE, Hadoop, HBase.
Map Reduce for data-intensive computing (Some of the content is adapted from the original authors’ talk at OSDI 04)
CS525: Special Topics in DBs Large-Scale Data Management Hadoop/MapReduce Computing Paradigm Spring 2013 WPI, Mohamed Eltabakh 1.
HBase A column-centered database 1. Overview An Apache project Influenced by Google’s BigTable Built on Hadoop ▫A distributed file system ▫Supports Map-Reduce.
MapReduce – An overview Medha Atre (May 7, 2008) Dept of Computer Science Rensselaer Polytechnic Institute.
MapReduce: Hadoop Implementation. Outline MapReduce overview Applications of MapReduce Hadoop overview.
Hadoop/MapReduce Computing Paradigm 1 Shirish Agale.
Introduction to Hadoop and HDFS
CSE 486/586 CSE 486/586 Distributed Systems Data Analytics Steve Ko Computer Sciences and Engineering University at Buffalo.
Pairwise Document Similarity in Large Collections with MapReduce Tamer Elsayed, Jimmy Lin, and Douglas W. Oard Association for Computational Linguistics,
Google’s Big Table 1 Source: Chang et al., 2006: Bigtable: A Distributed Storage System for Structured Data.
Map-Reduce-Merge: Simplified Relational Data Processing on Large Clusters Hung-chih Yang(Yahoo!), Ali Dasdan(Yahoo!), Ruey-Lung Hsiao(UCLA), D. Stott Parker(UCLA)
MapReduce Kristof Bamps Wouter Deroey. Outline Problem overview MapReduce o overview o implementation o refinements o conclusion.
Why Not Grab a Free Lunch? Mining Large Corpora for Parallel Sentences to Improve Translation Modeling Ferhan Ture and Jimmy Lin University of Maryland,
Large scale IP filtering using Apache Pig and case study Kaushik Chandrasekaran Nabeel Akheel.
大规模数据处理 / 云计算 Lecture 5 – Mapreduce Algorithm Design 彭波 北京大学信息科学技术学院 7/19/2011 This work is licensed under a Creative.
Chris Olston Benjamin Reed Utkarsh Srivastava Ravi Kumar Andrew Tomkins Pig Latin: A Not-So-Foreign Language For Data Processing Research.
MapReduce Algorithm Design Based on Jimmy Lin’s slides
MapReduce and Data Management Based on slides from Jimmy Lin’s lecture slides ( (licensed.
ISchool, Cloud Computing Class Talk, Oct 6 th Computing Pairwise Document Similarity in Large Collections: A MapReduce Perspective Tamer Elsayed,
Chapter 5 Ranking with Indexes 1. 2 More Indexing Techniques n Indexing techniques:  Inverted files - best choice for most applications  Suffix trees.
CS525: Big Data Analytics MapReduce Computing Paradigm & Apache Hadoop Open Source Fall 2013 Elke A. Rundensteiner 1.
IBM Research ® © 2007 IBM Corporation Introduction to Map-Reduce and Join Processing.
大规模数据处理 / 云计算 Lecture 3 – Mapreduce Algorithm Design 闫宏飞 北京大学信息科学技术学院 7/16/2013 This work is licensed under a Creative.
Hadoop/MapReduce Computing Paradigm 1 CS525: Special Topics in DBs Large-Scale Data Management Presented By Kelly Technologies
MapReduce: Simplified Data Processing on Large Clusters By Dinesh Dharme.
Big Data Infrastructure Week 2: MapReduce Algorithm Design (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0.
Big Data Infrastructure Week 3: From MapReduce to Spark (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0.
BIG DATA/ Hadoop Interview Questions.
COMP7330/7336 Advanced Parallel and Distributed Computing MapReduce - Introduction Dr. Xiao Qin Auburn University
Item Based Recommender System SUPERVISED BY: DR. MANISH KUMAR BAJPAI TARUN BHATIA ( ) VAIBHAV JAISWAL( )
Image taken from: slideshare
Software Systems Development
Spark SQL.
Large-scale file systems and Map-Reduce
RDDs and Spark.
MapReduce Computing Paradigm Basics Fall 2013 Elke A. Rundensteiner
MapReduce Algorithm Design Adapted from Jimmy Lin’s slides.
Ch 4. The Evolution of Analytic Scalability
Charles Tappert Seidenberg School of CSIS, Pace University
Pig and pig latin: An Introduction
Presentation transcript:

More MapReduce Jimmy Lin The iSchool University of Maryland Tuesday, March 31, 2009 This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States See for details

Today’s Topics MapReduce algorithm design Managing dependencies Coordinating mappers and reducers Case study #1: statistical machine translation Case study #2: pairwise similarity comparison Systems integration Back-end and front-end processes RDBMS and Hadoop/HDFS Hadoop “nuts and bolts”

MapReduce Algorithm Design

Managing Dependencies Remember: Mappers run in isolation You have no idea in what order the mappers run You have no idea on what node the mappers run You have no idea when each mapper finishes Tools for synchronization: Ability to hold state in reducer across multiple key-value pairs Sorting function for keys Partitioner Cleverly-constructed data structures

Motivating Example Term co-occurrence matrix for a text collection M = N x N matrix (N = vocabulary size) M ij : number of times i and j co-occur in some context (for concreteness, let’s say context = sentence) Why? Distributional profiles as a way of measuring semantic distance Semantic distance useful for many language processing tasks “You shall know a word by the company it keeps” (Firth, 1957) e.g., Mohammad and Hirst (EMNLP, 2006)

MapReduce: Large Counting Problems Term co-occurrence matrix for a text collection = specific instance of a large counting problem A large event space (number of terms) A large number of events (the collection itself) Goal: keep track of interesting statistics about the events Basic approach Mappers generate partial counts Reducers aggregate partial counts How do we aggregate partial counts efficiently?

First Try: “Pairs” Each mapper takes a sentence: Generate all co-occurring term pairs For all pairs, emit (a, b) → count Reducers sums up counts associated with these pairs Use combiners! Note: in all my slides, I denote a key-value pair as k → v

“Pairs” Analysis Advantages Easy to implement, easy to understand Disadvantages Lots of pairs to sort and shuffle around (upper bound?)

Another Try: “Stripes” Idea: group together pairs into an associative array Each mapper takes a sentence: Generate all co-occurring term pairs For each term, emit a → { b: count b, c: count c, d: count d … } Reducers perform element-wise sum of associative arrays (a, b) → 1 (a, c) → 2 (a, d) → 5 (a, e) → 3 (a, f) → 2 a → { b: 1, c: 2, d: 5, e: 3, f: 2 } a → { b: 1, d: 5, e: 3 } a → { b: 1, c: 2, d: 2, f: 2 } a → { b: 2, c: 2, d: 7, e: 3, f: 2 } +

“Stripes” Analysis Advantages Far less sorting and shuffling of key-value pairs Can make better use of combiners Disadvantages More difficult to implement Underlying object is more heavyweight Fundamental limitation in terms of size of event space

Cluster size: 38 cores Data Source: Associated Press Worldstream (APW) of the English Gigaword Corpus (v3), which contains 2.27 million documents (1.8 GB compressed, 5.7 GB uncompressed)

Conditional Probabilities How do we compute conditional probabilities from counts? Why do we want to do this? How do we do this with MapReduce?

P(B|A): “Pairs” For this to work: Must emit extra (a, *) for every b n in mapper Must make sure all a’s get sent to same reducer (use partitioner) Must make sure (a, *) comes first (define sort order) Must hold state in reducer across different key-value pairs (a, b 1 ) → 3 (a, b 2 ) → 12 (a, b 3 ) → 7 (a, b 4 ) → 1 … (a, *) → 32 (a, b 1 ) → 3 / 32 (a, b 2 ) → 12 / 32 (a, b 3 ) → 7 / 32 (a, b 4 ) → 1 / 32 … Reducer holds this value in memory

P(B|A): “Stripes” Easy! One pass to compute (a, *) Another pass to directly compute P(B|A) a → {b 1 :3, b 2 :12, b 3 :7, b 4 :1, … }

Synchronization in Hadoop Approach 1: turn synchronization into an ordering problem Sort keys into correct order of computation Partition key space so that each reducer gets the appropriate set of partial results Hold state in reducer across multiple key-value pairs to perform computation Illustrated by the “pairs” approach Approach 2: construct data structures that “bring the pieces together” Each reducer receives all the data it needs to complete the computation Illustrated by the “stripes” approach

Issues and Tradeoffs Number of key-value pairs Object creation overhead Time for sorting and shuffling pairs across the network Size of each key-value pair De/serialization overhead Combiners make a big difference! RAM vs. disk and network Arrange data to maximize opportunities to aggregate partial results

Questions?

Case study #1: statistical machine translation

Statistical Machine Translation Conceptually simple: (translation from foreign f into English e) Difficult in practice! Phrase-Based Machine Translation (PBMT) : Break up source sentence into little pieces (phrases) Translate each phrase individually Chris Dyer (Ph.D. student, Linguistics) Aaron Cordova (undergraduate, Computer Science) Alex Mont (undergraduate, Computer Science)

Marianodiounabofetada a labrujaverde Mary not did not no did not give giveaslaptothewitchgreen slap a slap to the to the green witch the witch by Example from Koehn (2006)

i saw the small table vi la mesa pequeña (vi, i saw) (la mesa pequeña, the small table) … Parallel Sentences Word AlignmentPhrase Extraction he sat at the table the service was good Target-Language Text Translation Model Language Model Decoder Foreign Input SentenceEnglish Output Sentence maria no daba una bofetada a la bruja verde mary did not slap the green witch Training Data MT Architecture

The Data Bottleneck

i saw the small table vi la mesa pequeña (vi, i saw) (la mesa pequeña, the small table) … Parallel Sentences Word AlignmentPhrase Extraction he sat at the table the service was good Target-Language Text Translation Model Language Model Decoder Foreign Input SentenceEnglish Output Sentence maria no daba una bofetada a la bruja verde mary did not slap the green witch Training Data MT Architecture We’ve built MapReduce Implementations of these two components!

HMM Alignment: Giza Single-core commodity server

HMM Alignment: MapReduce Single-core commodity server 38 processor cluster

HMM Alignment: MapReduce 38 processor cluster 1/38 Single-core commodity server

What’s the point? The optimally-parallelized version doesn’t exist! It’s all about the right level of abstraction Goldilocks argument

Questions?

Case study #2: pairwise similarity comparison

Pairwise Document Similarity Applications: Clustering Cross-document coreference resolution “more-like-that” queries ~~~~~~~~~~ ~~~~~~~~~~ Tamer Elsayed (Ph.D. student, Computer Science)

Problem Description Consider similarity functions of the form: But, actually… Two step solution in MapReduce: 1. Build inverted index 2. Compute pairwise similarity from postings

Building the Inverted Index Obama Clinton Obama McCain Obama Bush Clinton Obama Bush McCain Clinton Obama Clinton Obama McCain Obama Bush Clinton Map Reduce Shuffling Key-Value Pairs

Generate Pairs Group Pairs Sum Weights Map Reduce Computing Pairwise Similarity Obama Bush McCain Clinton

Analysis Main idea: access postings once O(df 2 ) pairs are generated MapReduce automatically keeps track of partial weights Control effectiveness-efficiency tradeoff by dfCut Drop terms with high document frequencies Has large effect since terms follow Zipfian distribution

Data Source: subset of AQUAINT-2 collection of newswire articles; approximately 900k documents.

Questions?

Systems Integration

Answers?

Systems Integration Issue #1: Front-end and back-end processes

Front-endBack-end Real-timeBatch Customer-facingInternal Well-defined workflow Ad hoc analytics

Server-side software stack DB Server Browser Interface Web Server HTTP response Interactive Web applications AJAX HTTP request Middleware Customers

Typical “Scale Out” Strategies LAMP stack as standard building block Lots of each (load balanced, possibly virtualized): Web servers Application servers Cache servers RDBMS Reliability achieved through replication Most workloads are easily partitioned Partition by user Partition by geography …

Source: Technology Review (July/August, 2008) Database layer: 800 eight-core Linux servers running MySQL (40 TB user data) Caching servers: 15 million requests per second, 95% handled by memcache (15 TB of RAM)

Server-side software stack DB Server Browser Interface Web Server HTTP response Hadoop cluster Interactive Web applications Back-end batch processing AJAX HTTP request Middleware HDFSMapReduce Customers Internal Analysts Browser Interface HTTP response AJAX HTTP request ?

Systems Integration Issue #2: RDBMS and Hadoop/HDFS

BigTable: Google does databases What is it? A sparse, distributed, persistent multidimensional sorted map Why not a traditional RDBMS? Characteristics: Map is indexed by a row key, column key, and a timestamp Each value in the map is an uninterpreted array of bytes Layout: Rows sorted lexicographically Columns grouped by “column family” Atomic read/writes on rows (only) (row:string, column:string, time:int64) → string

“contents” Rows Columns “CNN” t9t9 “anchor:cnnsi.com”“anchor:my.look.ca” “com.cnn.www” “CNN.com” t9t9 “...” t4t4 t6t6 t5t5 Redrawn from Chang et al. (OSDI 2006)

Typical Workflows Large volume reads/writes Scans over subset of rows Random reads/writes

Explicit Choices Does not support a relational model No table-wide integrity constraints No multi-row transactions No joins (!) Simple data model Let client applications control data layout Take advantage of locality: rows (key sort order) and column (column family)

The Bad News…

Rows vs. Columns

The $19 billion question.* *Size of the DBMS market in 2008, as estimated by IDC.

Front-end services ETL Hadoop cluster HDFSMapReduce OLTPOLAP Data warehouse

Source: Wikipedia

Pig Slides adapted from Olston et al. (SIGMOD 2008) M M R R Join, Union Split M M M M R R M M Chains MapReduce It’s all about data flows! What if you need… … and filter, projection, aggregates, sorting, distinct, etc.

Current solution?

UserUrlTime Amycnn.com8:00 Amybbc.com10:00 Amyflickr.com10:05 Fredcnn.com12:00 Example: Find the top 10 most visited pages in each category UrlCategoryPageRank cnn.comNews0.9 bbc.comNews0.8 flickr.comPhotos0.7 espn.comSports0.9 VisitsUrl Info Pig Slides adapted from Olston et al. (SIGMOD 2008)

Load Visits Group by url Foreach url generate count Foreach url generate count Load Url Info Join on url Group by category Foreach category generate top10(urls) Foreach category generate top10(urls) Pig Slides adapted from Olston et al. (SIGMOD 2008)

visits = load ‘/data/visits’ as (user, url, time); gVisits = group visits by url; visitCounts = foreach gVisits generate url, count(visits); urlInfo = load ‘/data/urlInfo’ as (url, category, pRank); visitCounts = join visitCounts by url, urlInfo by url; gCategories = group visitCounts by category; topUrls = foreach gCategories generate top(visitCounts,10); store topUrls into ‘/data/topUrls’; Pig Slides adapted from Olston et al. (SIGMOD 2008)

Load Visits Group by url Foreach url generate count Foreach url generate count Load Url Info Join on url Group by category Foreach category generate top10(urls) Foreach category generate top10(urls) Map 1 Reduce 1 Map 2 Reduce 2 Map 3 Reduce 3 Pig Slides adapted from Olston et al. (SIGMOD 2008)

Relationship to SQL?

Pig SQL MapReduce

Hadoop “nuts and bolts”

Source:

Hadoop Zen Don’t get frustrated (take a deep breath)… Remember this when you experience those moments This is bleeding edge technology: Lots of bugs Stability issues Even lost data To upgrade or not to upgrade (damned either way)? Poor documentation (or none) But… Hadoop is the path to data nirvana

JobTracker TaskTracker Master node Slave node Client

Data Types in Hadoop WritableDefines a de/serialization protocol. Every data type in Hadoop is a Writable. WritableComprableDefines a sort order. All keys must be of this type (but not values). IntWritable LongWritable Text … Concrete classes for different data types.

Input file (on HDFS) InputSplit RecordReader Mapper Partitioner Reducer RecordWriter Output file (on HDFS) Combiner OutputFormat InputFormat extends MapReduceBase implements Mapper implements Partitioner extends MapReduceBase implements Reducer extends MapReduceBase implements Reducer

Complex Data Types in Hadoop How do you implement complex data types? The easiest way: Encoded it as Text, e.g., (a, b) = “a:b” Use regular expressions to parse and extract data Works, but pretty hack-ish The hard way: Define a custom implementation of WritableComprable Must implement: readFields, write, compareTo Computationally efficient, but slow for rapid prototyping Alternatives: Cloud 9 offers two other choices: Tuple and JSON

Questions?