Parallel Nested Loops

Similar documents
Parallel Partition-Based. Parallel Nested Loops. Median. More Join Thoughts. Parallel Office Tools 9/15/2011

The MapReduce Abstraction

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Parallel Programming Concepts

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344

Where We Are. Review: Parallel DBMS. Parallel DBMS. Introduction to Data Management CSE 344

Parallel Computing: MapReduce Jin, Hai

CS 61C: Great Ideas in Computer Architecture. MapReduce

L22: SC Report, Map Reduce

Announcements. Parallel Data Processing in the 20 th Century. Parallel Join Illustration. Introduction to Database Systems CSE 414

CS 345A Data Mining. MapReduce

CSE 344 MAY 2 ND MAP/REDUCE

MapReduce: Simplified Data Processing on Large Clusters

Database Systems CSE 414

Announcements. Optional Reading. Distributed File System (DFS) MapReduce Process. MapReduce. Database Systems CSE 414. HW5 is due tomorrow 11pm

Distributed Computations MapReduce. adapted from Jeff Dean s slides

MapReduce. Kiril Valev LMU Kiril Valev (LMU) MapReduce / 35

Big Data Management and NoSQL Databases

Parallel Programming Principle and Practice. Lecture 10 Big Data Processing with MapReduce

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 10 Parallel Programming Models: Map Reduce and Spark

CS6030 Cloud Computing. Acknowledgements. Today s Topics. Intro to Cloud Computing 10/20/15. Ajay Gupta, WMU-CS. WiSe Lab

Clustering Lecture 8: MapReduce

ECE5610/CSC6220 Introduction to Parallel and Distribution Computing. Lecture 6: MapReduce in Parallel Computing

Map Reduce Group Meeting

Database System Architectures Parallel DBs, MapReduce, ColumnStores

The MapReduce Framework

Introduction to Map Reduce

Introduction to MapReduce

Outline. Distributed File System Map-Reduce The Computational Model Map-Reduce Algorithm Evaluation Computing Joins

MapReduce Spark. Some slides are adapted from those of Jeff Dean and Matei Zaharia

Concurrency for data-intensive applications

Introduction to Data Management CSE 344

Batch Processing Basic architecture

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2015 Lecture 11 Parallel DBMSs and MapReduce

MapReduce: A Programming Model for Large-Scale Distributed Computation

Introduction to MapReduce

Large-Scale GPU programming

Introduction to MapReduce

CSE Lecture 11: Map/Reduce 7 October Nate Nystrom UTA

MI-PDB, MIE-PDB: Advanced Database Systems

Announcements. Database Systems CSE 414. Why compute in parallel? Big Data 10/11/2017. Two Kinds of Parallel Data Processing

1. Introduction to MapReduce

Map-Reduce (PFP Lecture 12) John Hughes

MapReduce: Recap. Juliana Freire & Cláudio Silva. Some slides borrowed from Jimmy Lin, Jeff Ullman, Jerome Simeon, and Jure Leskovec

Distributed Systems. 18. MapReduce. Paul Krzyzanowski. Rutgers University. Fall 2015

Principles of Data Management. Lecture #16 (MapReduce & DFS for Big Data)

Introduction to MapReduce

Map Reduce. Yerevan.

MapReduce. Stony Brook University CSE545, Fall 2016

Map-Reduce. John Hughes

CIS 601 Graduate Seminar Presentation Introduction to MapReduce --Mechanism and Applicatoin. Presented by: Suhua Wei Yong Yu

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2008 Quiz II

Introduction to MapReduce

Huge market -- essentially all high performance databases work this way

CS 345A Data Mining. MapReduce

How to Implement MapReduce Using. Presented By Jamie Pitts

CS MapReduce. Vitaly Shmatikov

Map-Reduce. Marco Mura 2010 March, 31th

CS /5/18. Paul Krzyzanowski 1. Credit. Distributed Systems 18. MapReduce. Simplest environment for parallel processing. Background.

CS-2510 COMPUTER OPERATING SYSTEMS

MapReduce & Resilient Distributed Datasets. Yiqing Hua, Mengqi(Mandy) Xia

CS 138: Google. CS 138 XVII 1 Copyright 2016 Thomas W. Doeppner. All rights reserved.

Advanced Data Management Technologies

Parallel DBMS. Parallel Database Systems. PDBS vs Distributed DBS. Types of Parallelism. Goals and Metrics Speedup. Types of Parallelism

Part A: MapReduce. Introduction Model Implementation issues

CSE 414: Section 7 Parallel Databases. November 8th, 2018

In the news. Request- Level Parallelism (RLP) Agenda 10/7/11

Today s Lecture. CS 61C: Great Ideas in Computer Architecture (Machine Structures) Map Reduce

Advanced Databases. Lecture 15- Parallel Databases (continued) Masood Niazi Torshiz Islamic Azad University- Mashhad Branch

CS 138: Google. CS 138 XVI 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Survey on MapReduce Scheduling Algorithms

MapReduce-style data processing

It also suggests creating more reduce tasks to deal with problems in keeping reducer inputs in memory.

Introduction to MapReduce. Adapted from Jimmy Lin (U. Maryland, USA)

Systems Infrastructure for Data Science. Web Science Group Uni Freiburg WS 2013/14

Cloud Programming. Programming Environment Oct 29, 2015 Osamu Tatebe

"Big Data" Open Source Systems. CS347: Map-Reduce & Pig. Motivation for Map-Reduce. Building Text Index - Part II. Building Text Index - Part I

PLATFORM AND SOFTWARE AS A SERVICE THE MAPREDUCE PROGRAMMING MODEL AND IMPLEMENTATIONS

MapReduce. Simplified Data Processing on Large Clusters (Without the Agonizing Pain) Presented by Aaron Nathan

Big Data Programming: an Introduction. Spring 2015, X. Zhang Fordham Univ.

Cloud Computing CS

CompSci 516: Database Systems

Google: A Computer Scientist s Playground

Google: A Computer Scientist s Playground

Developing MapReduce Programs

MapReduce: Simplified Data Processing on Large Clusters 유연일민철기

Programming Systems for Big Data

Announcements. Reading Material. Map Reduce. The Map-Reduce Framework 10/3/17. Big Data. CompSci 516: Database Systems

MapReduce & HyperDex. Kathleen Durant PhD Lecture 21 CS 3200 Northeastern University

Distributed Systems. COS 418: Distributed Systems Lecture 1. Mike Freedman. Backrub (Google) Google The Cloud is not amorphous

Hadoop Map Reduce 10/17/2018 1

Advanced Database Technologies NoSQL: Not only SQL

Tutorial Outline. Map/Reduce. Data Center as a computer [Patterson, cacm 2008] Acknowledgements

Mitigating Data Skew Using Map Reduce Application

6.830 Lecture Spark 11/15/2017

CSE 544: Principles of Database Systems

Fall 2018: Introduction to Data Science GIRI NARASIMHAN, SCIS, FIU

MapReduce. Cloud Computing COMP / ECPE 293A

Chapter 18: Parallel Databases

Transcription:

Parallel Nested Loops For each tuple s i in S For each tuple t j in T If s i =t j, then add (s i,t j ) to output Create partitions S 1, S 2, T 1, and T 2 Have processors work on (S 1,T 1 ), (S 1,T 2 ), (S 2,T 1 ), and (S 2,T 2 ) Can build appropriate local index on chunk if desired Nice and easy, but How to choose chunk sizes for given S, T, and #processors? There is data duplication, possibly a lot of it Especially undesirable for highly selective joins with small result 61 Parallel Partition-Based Create n partitions of S by hashing each S-tuple s, e.g., to bucket number (s mod n) Create n partitions of T in the same way Run join algorithm on each pair of corresponding partitions Can create partitions of S and T in parallel Choose n = number of processors Each processor locally can choose favorite join algorithm No data replication, but Does not work well for skewed data Limited parallelism if range of values is small 62 1

More Join Thoughts What about non-equi join? Find pairs (s i,t j ) that satisfy a predicate like inequality, band, or similarity (e.g., when s and t are documents) Hash-partitioning will not work any more Now things are becoming really tricky We will discuss these issues in a future lecture. 63 Median Find the median of a set of integers Holistic aggregate function Chunk assigned to a processor might contain mostly smaller or mostly larger values, and the processor does not know this without communicating extensively with the others Parallel implementation might not do much better than sequential one Efficient approximation algorithms exist 64 2

Parallel Office Tools Parallelize Word, Excel, email client? Impossible without rewriting them as multithreaded applications Seem to naturally have low degree of parallelism Leverage economies of scale: n processors (or cores) support n desktop users by hosting the service in the Cloud E.g., Google docs 65 Before exploring parallel algorithms in more depth, how do we know if our parallel algorithm or implementation actually does well or not? 66 3

Measures Of Success If sequential version takes time t, then parallel version on n processors should take time t/n Speedup = sequentialtime / paralleltime Note: job, i.e., work to be done, is fixed Response time should stay constant if number of processors increases at same rate as amount of work Scaleup = workdoneparallel / workdonesequential Note: time to work on job is fixed 67 Things to Consider: Amdahl s Law Consider job taking sequential time 1 and consisting of two sequential tasks taking time t 1 and 1-t 1, respectively Assume we can perfectly parallelize the first task on n processors Parallel time: t 1 /n + (1 t 1 ) Speedup = 1 / (1 t 1 (n-1)/n) t 1 =0.9, n=2: speedup = 1.81 t 1 =0.9, n=10: speedup = 5.3 t 1 =0.9, n=100: speedup = 9.2 Max. possible speedup for t 1 =0.9 is 1/(1-0.9) = 10 68 4

Implications of Amdahl s Law Parallelize the tasks that take the longest Sequential steps limit maximum possible speedup Communication between tasks, e.g., to transmit intermediate results, can inherently limit speedup, no matter how well the tasks themselves can be parallelized If fraction x of the job is inherently sequential, speedup can never exceed 1/x No point running this on an excessive number of processors 69 Performance Metrics Total execution time Part of both speedup and scaleup Total resources (maybe only of type X) consumed Total amount of money paid Total energy consumed Optimize some combination of the above E.g., minimize total execution time, subject to a money budget constraint 70 5

Popular Strategies Load balancing Avoid overloading one processor while other is idle Careful: if better balancing increases total load, it might not be worth it Careful: optimizes for response time, but not necessarily other metrics like $ paid Static load balancing Need cost analyzer like in DBMS Dynamic load balancing Easy: Web search Hard: join 71 Let s see how MapReduce works. 72 6

MapReduce Proposed by Google in research paper Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. OSDI'04: Sixth Symposium on Operating System Design and Implementation, San Francisco, CA, December, 2004 MapReduce implementations like Hadoop differ in details, but main principles are the same 73 Overview MapReduce = programming model and associated implementation for processing large data sets Programmer essentially just specifies two (sequential) functions: map and reduce Program execution is automatically parallelized on large clusters of commodity PCs MapReduce could be implemented on different architectures, but Google proposed it for clusters 74 7

Overview Clever abstraction that is a good fit for many real-world problems Programmer focuses on algorithm itself Runtime system takes care of all messy details Partitioning of input data Scheduling program execution Handling machine failures Managing inter-machine communication 75 Programming Model Transforms set of input key-value pairs to set of output values (notice small modification compared to paper) Map: (k1, v1) list (k2, v2) MapReduce library groups all intermediate pairs with same key together Reduce: (k2, list (v2)) list (k3, v3) Usually zero or one output value per group Intermediate values supplied via iterator (to handle lists that do not fit in memory) 76 8

Example: Word Count Insight: can count each document in parallel, then aggregate counts Final aggregation has to happen in Reduce Need count per word, hence use word itself as intermediate key (k2) Intermediate counts are the intermediate values (v2) Parallel counting can happen in Map For each document, output set of pairs, each being a word in the document and its frequency of occurrence in the document Alternative: output (word, 1 ) for each word encountered 77 Word Count in MapReduce Count number of occurrences of each word in a document collection: map(string key, String value): // key: document name // value: document contents for each word w in value: EmitIntermediate(w, "1"); reduce(string key, Iterator values): // key: a word // values: a list of counts int result = 0; for each v in values: result += ParseInt(v); Emit(AsString(result)); Almost all the coding needed (need also MapReduce specification object with names of input and output files, and optional tuning parameters) 78 9

Execution Overview Data is stored in files Files are partitioned into smaller splits, typically 64MB Splits are stored (usually also replicated) on different cluster machines Master node controls program execution and keeps track of progress Does not participate in data processing Some workers will execute the Map function, let s call them mappers Some workers will execute the Reduce function, let s call them reducers 79 Execution Overview Master assigns map and reduce tasks to workers, taking data location into account Mapper reads an assigned file split and writes intermediate key-value pairs to local disk Mapper informs master about result locations, who in turn informs the reducers Reducers pull data from appropriate mapper disk location After map phase is completed, reducers sort their data by key For each key, Reduce function is executed and output is appended to final output file When all reduce tasks are completed, master wakes up user program 80 10

Execution Overview 81 Master Data Structures Master keeps track of status of each map and reduce task and who is working on it Idle, in-progress, or completed Master stores location and size of output of each completed map task Pushes information incrementally to workers with in-progress reduce tasks 82 11

Example: Equi-Join Given two data sets S=(s 1,s 2, ) and T=(t 1,t 2, ) of integers, find all pairs (s i,t j ) where s i.a=t j.a Can only combine the s i and t j in Reduce To ensure that the right tuples end up in the same Reduce invocation, use join attribute A as intermediate key (k2) Intermediate value is actual tuple to be joined Map needs to output (s.a, s) for each S-tuple s (similar for T-tuples) 83 Equi-Join in MapReduce Join condition: S.A=T.A Map(s) = (s.a, s); Map(t) = (t.a, t) Reduce computes Cartesian product of set of S-tuples and set of T-tuples with same key DFS nodes Mappers Reducers DFS nodes s 1,1 s 5,1 s 3,2 t 3,1 s 5,1 s 3,2 1,(s 5,1) 2,(s 3,2) t 3,1 1,(t 3,1) 1,[(s 5,1)(t 3,1)(s 1,1)(t 8,1)] (s 5,t 3 ) (s 1,t 3 ) (s 1,t 8 ) t 8,1 t 1,2 (k1,v1) s 1,1 t 8,1 t 1,2 1,(s 1,1) 1,(t 8,1) (k2,list(v2)) 2,(t 1,2) 2,[(s 3,2)(t 1,2)] list(v3) list(k2,v2) (s 3,t 1 ) (s 5,t 8 ) Transfer Input Map Transfer Map Output Reduce Transfer Reduce Output 84 12

Comments Programming model might appear very limited But, map and reduce can do anything with their input Could implement a Turing machine inside which could compute anything, but would not result in a good parallel implementation. Challenge: find best MapReduce implementation for a given problem 85 Basic MapReduce Program Design Tasks that can be performed independently on a data object, large number of them: Map Tasks that require combining of multiple data objects: Reduce Sometimes it is easier to start program design with Map, sometimes with Reduce Select keys and values such that the right objects end up together in the same Reduce invocation Might have to partition a complex task into multiple MapReduce sub-tasks 86 13