Cse 344 May 2nd – Map/reduce.

Slides:



Advertisements
Similar presentations
MAP REDUCE PROGRAMMING Dr G Sudha Sadasivam. Map - reduce sort/merge based distributed processing Best for batch- oriented processing Sort/merge is primitive.
Advertisements

Overview of MapReduce and Hadoop
Spark: Cluster Computing with Working Sets
Data Warehousing 1 Lecture-25 Need for Speed: Parallelism Methodologies Virtual University of Pakistan Ahsan Abdullah Assoc. Prof. & Head Center for Agro-Informatics.
CS347: MapReduce CS Motivation for Map-Reduce Distribution makes simple computations complex Communication Load balancing Fault tolerance … What.
Distributed Computations
MapReduce: Simplified Data Processing on Large Clusters Cloud Computing Seminar SEECS, NUST By Dr. Zahid Anwar.
Google’s Map Reduce. Commodity Clusters Web data sets can be very large – Tens to hundreds of terabytes Cannot mine on a single server Standard architecture.
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.
Google’s Map Reduce. Commodity Clusters Web data sets can be very large – Tens to hundreds of terabytes Standard architecture emerging: – Cluster of commodity.
Distributed Computations MapReduce
L22: SC Report, Map Reduce November 23, Map Reduce What is MapReduce? Example computing environment How it works Fault Tolerance Debugging Performance.
MapReduce : Simplified Data Processing on Large Clusters Hongwei Wang & Sihuizi Jin & Yajing Zhang
Advanced Topics: MapReduce ECE 454 Computer Systems Programming Topics: Reductions Implemented in Distributed Frameworks Distributed Key-Value Stores Hadoop.
MapReduce.
MapReduce. Web data sets can be very large – Tens to hundreds of terabytes Cannot mine on a single server Standard architecture emerging: – Cluster of.
Map Reduce and Hadoop S. Sudarshan, IIT Bombay
Map Reduce for data-intensive computing (Some of the content is adapted from the original authors’ talk at OSDI 04)
Parallel Programming Models Basic question: what is the “right” way to write parallel programs –And deal with the complexity of finding parallelism, coarsening.
CS525: Special Topics in DBs Large-Scale Data Management Hadoop/MapReduce Computing Paradigm Spring 2013 WPI, Mohamed Eltabakh 1.
MapReduce: Simplified Data Processing on Large Clusters Jeffrey Dean and Sanjay Ghemawat.
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.
MAP REDUCE : SIMPLIFIED DATA PROCESSING ON LARGE CLUSTERS Presented by: Simarpreet Gill.
MapReduce How to painlessly process terabytes of data.
MapReduce M/R slides adapted from those of Jeff Dean’s.
Benchmarking MapReduce-Style Parallel Computing Randal E. Bryant Carnegie Mellon University.
MapReduce Kristof Bamps Wouter Deroey. Outline Problem overview MapReduce o overview o implementation o refinements o conclusion.
By Jeff Dean & Sanjay Ghemawat Google Inc. OSDI 2004 Presented by : Mohit Deopujari.
Chapter 5 Ranking with Indexes 1. 2 More Indexing Techniques n Indexing techniques:  Inverted files - best choice for most applications  Suffix trees.
MapReduce Computer Engineering Department Distributed Systems Course Assoc. Prof. Dr. Ahmet Sayar Kocaeli University - Fall 2015.
IBM Research ® © 2007 IBM Corporation Introduction to Map-Reduce and Join Processing.
C-Store: MapReduce Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 22, 2009.
MapReduce: Simplified Data Processing on Large Clusters By Dinesh Dharme.
CS 440 Database Management Systems Parallel DB & Map/Reduce Some slides due to Kevin Chang 1.
CPT-S Advanced Databases 11 Yinghui Wu EME 49.
COMP7330/7336 Advanced Parallel and Distributed Computing MapReduce - Introduction Dr. Xiao Qin Auburn University
Lecture 3 – MapReduce: Implementation CSE 490h – Introduction to Distributed Computing, Spring 2009 Except as otherwise noted, the content of this presentation.
Image taken from: slideshare
CS 440 Database Management Systems
Some slides adapted from those of Yuan Yu and Michael Isard
CS 540 Database Management Systems
Hadoop Aakash Kag What Why How 1.
Distributed Programming in “Big Data” Systems Pramod Bhatotia wp
Large-scale file systems and Map-Reduce
Parallel Databases.
Hadoop MapReduce Framework
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing MapReduce - Introduction Dr. Xiao Qin Auburn.
Introduction to MapReduce and Hadoop
Evaluation of Relational Operations
MapReduce Computing Paradigm Basics Fall 2013 Elke A. Rundensteiner
Database Applications (15-415) Hadoop Lecture 26, April 19, 2016
MapReduce Simplied Data Processing on Large Clusters
April 30th – Scheduling / parallel
湖南大学-信息科学与工程学院-计算机与科学系
February 26th – Map/Reduce
Hadoop Basics.
Map reduce use case Giuseppe Andronico INFN Sez. CT & Consorzio COMETA
Cse 344 May 4th – Map/Reduce.
Ch 4. The Evolution of Analytic Scalability
Distributed System Gang Wu Spring,2018.
Chapters 15 and 16b: Query Optimization
Cloud Computing MapReduce, Batch Processing
Introduction to MapReduce
Wednesday, 5/8/2002 Hash table indexes, physical operators
CS639: Data Management for Data Science
Big Data Analysis MapReduce.
COS 518: Distributed Systems Lecture 11 Mike Freedman
MapReduce: Simplified Data Processing on Large Clusters
Presentation transcript:

Cse 344 May 2nd – Map/reduce

Administrivia HW5 Due Tonight Practice midterm Section tomorrow Exam review

Performance Metrics for Parallel DBMSs Nodes = processors, computers Speedup: More nodes, same data  higher speed Scaleup: More nodes, more data  same speed

Linear v.s. Non-linear Speedup Ideal ×1 ×5 ×10 ×15 # nodes (=P)

Linear v.s. Non-linear Scaleup Batch Scaleup Ideal ×1 ×5 ×10 ×15 # nodes (=P) AND data size

Why Sub-linear Speedup and Scaleup? Startup cost Cost of starting an operation on many nodes Interference Contention for resources between nodes Skew Slowest node becomes the bottleneck

Interconnection Network Shared Nothing Cluster of commodity machines on high-speed network Called "clusters" or "blade servers” Each machine has its own memory and disk: lowest contention. Example: Google Because all machines today have many cores and many disks, shared- nothing systems typically run many "nodes” on a single physical machine. Easy to maintain and scale Most difficult to administer and tune. Interconnection Network P P P M M M D D D We discuss only Shared Nothing in class

Approaches to Parallel Query Evaluation Purchase pid=pid cid=cid Customer Product Purchase pid=pid cid=cid Customer Product Purchase pid=pid cid=cid Customer Product Inter-query parallelism Transaction per node Good for transactional workloads Inter-operator parallelism Operator per node Good for analytical workloads Intra-operator parallelism Operator on multiple nodes Good for both? Purchase pid=pid cid=cid Customer Product Purchase pid=pid cid=cid Customer Product We study only intra-operator parallelism: most scalable CSE 344 - 2017au

Distributed Query Processing Data is horizontally partitioned on many servers Operators may require data reshuffling First let’s discuss how to distribute data across multiple nodes / servers

Horizontal Data Partitioning Servers: 1 2 P . . . K A B …

Horizontal Data Partitioning Servers: 1 2 P . . . K A B … K A B … K A B … K A B … Which tuples go to what server?

Horizontal Data Partitioning Block Partition: Partition tuples arbitrarily s.t. size(R1)≈ … ≈ size(RP) Hash partitioned on attribute A: Tuple t goes to chunk i, where i = h(t.A) mod P + 1 Recall: calling hash fn’s is free in this class Range partitioned on attribute A: Partition the range of A into -∞ = v0 < v1 < … < vP = ∞ Tuple t goes to chunk i, if vi-1 < t.A < vi

Uniform Data v.s. Skewed Data Let R(K,A,B,C); which of the following partition methods may result in skewed partitions? Block partition Hash-partition On the key K On the attribute A Range partition Uniform Uniform Assuming good hash function E.g. when all records have the same value of the attribute A, then all records end up in the same partition May be skewed Keep this in mind in the next few slides

Parallel Execution of RA Operators: Grouping Data: R(K,A,B,C) Query: γA,sum(C)(R) How to compute group by if: R is hash-partitioned on A ? R is block-partitioned ? R is hash-partitioned on K ? Discuss hash partition first (no slides)

Parallel Execution of RA Operators: Grouping Data: R(K,A,B,C) Query: γA,sum(C)(R) R is block-partitioned or hash-partitioned on K R1 R2 . . . RP Reshuffle R on attribute A Run grouping on reshuffled partitions R1’ R2’ RP’ . . .

Speedup and Scaleup But only if the data is without skew! Consider: Query: γA,sum(C)(R) Runtime: only consider I/O costs If we double the number of nodes P, what is the new running time? Half (each server holds ½ as many chunks) If we double both P and the size of R, what is the new running time? Same (each server holds the same # of chunks) But only if the data is without skew!

Skewed Data R(K,A,B,C) Informally: we say that the data is skewed if one server holds much more data that the average E.g. we hash-partition on A, and some value of A occurs many times Then the server holding that value will be skewed

Parallel Execution of RA Operators: Partitioned Hash-Join Data: R(K1, A, B), S(K2, B, C) Query: R(K1, A, B) ⋈ S(K2, B, C) Initially, both R and S are partitioned on K1 and K2 R1, S1 R2, S2 . . . RP, SP Reshuffle R on R.B and S on S.B R’1, S’1 R’2, S’2 . . . R’P, S’P Each server computes the join locally

Parallel Join Illustration Data: R(K1,A, B), S(K2, B, C) Query: R(K1,A,B) ⋈ S(K2,B,C) Parallel Join Illustration R1 S1 R2 S2 K1 B 1 20 2 50 K2 B 101 50 102 K1 B 3 20 4 K2 B 201 20 202 50 Partition M1 M2 Shuffle on B R1’ S1’ R2’ S2’ K1 B 1 20 3 4 K2 B 201 20 K1 B 2 50 K2 B 101 50 102 202 ⋈ ⋈ Local Join M1 M2

Broadcast Join Why would you want to do this? Data: R(A, B), S(C, D) Query: R(A,B) ⋈B=C S(C,D) Broadcast Join Broadcast S Reshuffle R on R.B R1 R2 . . . RP S R’1, S R’2, S . . . R’P, S Why would you want to do this?

Example Parallel Query Plan Order(oid, item, date), Line(item, …) Example Parallel Query Plan Find all orders from today, along with the items ordered SELECT * FROM Order o, Line i WHERE o.item = i.item AND o.date = today() join o.item = i.item select date = today() scan scan Item i Order o

Parallel Query Plan Node 1 Node 2 Node 3 hash h(o.item) select Order(oid, item, date), Line(item, …) join select scan date = today() o.item = i.item Order o Parallel Query Plan Node 1 Node 2 Node 3 hash h(o.item) select date=today() scan Order o Node 1 Node 2 Node 3

Parallel Query Plan Node 1 Node 2 Node 3 hash hash hash h(i.item) Order(oid, item, date), Line(item, …) join scan date = today() o.item = i.item Order o Item i Parallel Query Plan Node 1 Node 2 Node 3 hash hash hash h(i.item) h(i.item) h(i.item) scan scan scan Item i Item i Item i Node 1 Node 2 Node 3

Example Parallel Query Plan Order(oid, item, date), Line(item, …) Example Parallel Query Plan join join join o.item = i.item o.item = i.item o.item = i.item Node 1 Node 2 Node 3 contains all orders and all lines where hash(item) = 3 contains all orders and all lines where hash(item) = 2 contains all orders and all lines where hash(item) = 1

Motivation We learned how to parallelize relational database systems While useful, it might incur too much overhead if our query plans consist of simple operations MapReduce is a programming model for such computation First, let’s study how data is stored in such systems

Distributed File System (DFS) For very large files: TBs, PBs Each file is partitioned into chunks, typically 64MB Each chunk is replicated several times (≥3), on different racks, for fault tolerance Implementations: Google’s DFS: GFS, proprietary Hadoop’s DFS: HDFS, open source

MapReduce Google: paper published 2004 Free variant: Hadoop MapReduce = high-level programming model and implementation for large-scale parallel data processing

Typical Problems Solved by MR Read a lot of data Map: extract something you care about from each record Shuffle and Sort Reduce: aggregate, summarize, filter, transform Write the results Paradigm stays the same, change map and reduce functions for different problems

Data Model Files! A file = a bag of (key, value) pairs A MapReduce program: Input: a bag of (inputkey, value) pairs Output: a bag of (outputkey, value) pairs

Step 1: the MAP Phase User provides the MAP-function: Input: (input key, value) Ouput: bag of (intermediate key, value) System applies the map function in parallel to all (input key, value) pairs in the input file

Step 2: the REDUCE Phase User provides the REDUCE function: Input: (intermediate key, bag of values) Output: bag of output (values) System groups all pairs with the same intermediate key, and passes the bag of values to the REDUCE function

Example Counting the number of occurrences of each word in a large collection of documents Each Document The key = document id (did) The value = set of words (word) 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)); map(String key, String value): // key: document name // value: document contents for each word w in value: EmitIntermediate(w, “1”);

MAP REDUCE (did1,v1) (did2,v2) (did3,v3) . . . . Shuffle (w1,1) (w2,1) … Shuffle (w1, (1,1,1,…,1)) (w2, (1,1,…)) (w3,(1…)) … (w1, 25) (w2, 77) (w3, 12) …