Cloud Computing. Leonidas Fegaras University of Texas at Arlington. Web Data Management and XML L3b: Cloud Computing 1

Similar documents
Cloud Computing. Leonidas Fegaras University of Texas at Arlington. Web Data Management and XML L12: Cloud Computing 1

Computing as a Utility. Cloud Computing. Why? Good for...

Motivation. Map in Lisp (Scheme) Map/Reduce. MapReduce: Simplified Data Processing on Large Clusters

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

CS427 Multicore Architecture and Parallel Computing

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

Introduction to MapReduce. Instructor: Dr. Weikuan Yu Computer Sci. & Software Eng.

CS 525 Advanced Distributed Systems Spring 2018

Outline. What is Big Data? Hadoop HDFS MapReduce Twitter Analytics and Hadoop

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

CSE6331: Cloud Computing

The MapReduce Abstraction

Cloud Programming. Programming Environment Oct 29, 2015 Osamu Tatebe

Hadoop. copyright 2011 Trainologic LTD

Clustering Lecture 8: MapReduce

Chapter 5. The MapReduce Programming Model and Implementation

PARLab Parallel Boot Camp

Distributed Computations MapReduce. adapted from Jeff Dean s slides

Google: A Computer Scientist s Playground

Google: A Computer Scientist s Playground

Introduction to Map/Reduce. Kostas Solomos Computer Science Department University of Crete, Greece

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

Introduction to Map Reduce

On the Convergence of Cloud Computing and Desktop Grids

Cloud Computing CS

Cloud Computing. Up until now

Data-Intensive Computing with MapReduce

Introduction to Hadoop. Owen O Malley Yahoo!, Grid Team

Clustering Documents. Case Study 2: Document Retrieval

COMP Parallel Computing. Lecture 22 November 29, Datacenters and Large Scale Data Processing

Big Data landscape Lecture #2

Programming Models MapReduce

Map- reduce programming paradigm

CS 61C: Great Ideas in Computer Architecture. MapReduce

Big Data Analytics. 4. Map Reduce I. Lars Schmidt-Thieme

UNIT V PROCESSING YOUR DATA WITH MAPREDUCE Syllabus

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

Clustering Documents. Document Retrieval. Case Study 2: Document Retrieval

Big Data Management and NoSQL Databases

Part II: Software Infrastructure in Data Centers: Distributed Execution Engines

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

Parallel Data Processing with Hadoop/MapReduce. CS140 Tao Yang, 2014

Introduction to MapReduce

EE657 Spring 2012 HW#4 Zhou Zhao

Map-Reduce in Various Programming Languages

Map Reduce Group Meeting

Lecture 11 Hadoop & Spark

CS 470 Spring Parallel Algorithm Development. (Foster's Methodology) Mike Lam, Professor

Parallel Computing: MapReduce Jin, Hai

HDFS: Hadoop Distributed File System. CIS 612 Sunnie Chung

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

CS 345A Data Mining. MapReduce

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

MapReduce-style data processing

TITLE: PRE-REQUISITE THEORY. 1. Introduction to Hadoop. 2. Cluster. Implement sort algorithm and run it using HADOOP

CSE6331: Cloud Computing

Introduction to HDFS and MapReduce

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

Introduction to Hadoop. Scott Seighman Systems Engineer Sun Microsystems

Introduction to Data Management CSE 344

Introduction to MapReduce

HADOOP FRAMEWORK FOR BIG DATA

MapReduce: Simplified Data Processing on Large Clusters

Introduction to Hadoop

Introduction to Map/Reduce & Hadoop

MapReduce Simplified Data Processing on Large Clusters

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

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

MI-PDB, MIE-PDB: Advanced Database Systems

The Technology Behind. Slides organized by: Sudhanva Gurumurthi

MapReduce. U of Toronto, 2014

CPSC 426/526. Cloud Computing. Ennan Zhai. Computer Science Department Yale University

Parallel Processing - MapReduce and FlumeJava. Amir H. Payberah 14/09/2018

Internet Measurement and Data Analysis (13)

Introduction to MapReduce

Semantics with Failures

Systems Infrastructure for Data Science. Web Science Group Uni Freiburg WS 2012/13

The MapReduce Framework

Map Reduce. Yerevan.

itpass4sure Helps you pass the actual test with valid and latest training material.

Database Applications (15-415)

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

Cloud Computing and Hadoop Distributed File System. UCSB CS170, Spring 2018

Informa)on Retrieval and Map- Reduce Implementa)ons. Mohammad Amir Sharif PhD Student Center for Advanced Computer Studies

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

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

BigData and Map Reduce VITMAC03

Improving the MapReduce Big Data Processing Framework

HDFS Federation. Sanjay Radia Founder and Hortonworks. Page 1

MapReduce, Hadoop and Spark. Bompotas Agorakis

Parallel Programming Concepts

Overview. Why MapReduce? What is MapReduce? The Hadoop Distributed File System Cloudera, Inc.

BigData and MapReduce with Hadoop

Distributed Filesystem

Programming Systems for Big Data

The amount of data increases every day Some numbers ( 2012):

2/26/2017. The amount of data increases every day Some numbers ( 2012):

Data Clustering on the Parallel Hadoop MapReduce Model. Dimitrios Verraros

Yuval Carmel Tel-Aviv University "Advanced Topics in Storage Systems" - Spring 2013

Using the Cloud to Crunch Your Data. Adrian Cockcro,

Transcription:

Cloud Computing Leonidas Fegaras University of Texas at Arlington Web Data Management and XML L3b: Cloud Computing 1

Computing as a Utility Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (network bandwidth, data storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction Key idea: Move computing functions into large shared data centers Gives the illusion of infinite resources on demand Pay-as-you-go (as needed), no upfront cost Elasticity: scale up or down, based on current needs Automatically manages fault tolerance, redundancy, storage, load balancing, geographic distribution, security, software updates, etc Web Data Management and XML L3b: Cloud Computing 2

Why? Sharing resources among applications utilizes these resources better While the resource needs of an application may vary dramatically, the sum of the resource needs of many independent applications varies much less Upfront setup cost is amortized over many applications Cost is proportional to use Improved service levels, fault tolerance, and availability Rapid prototyping and market testing Security infrastructure, better protection against network attacks Self-service deployment Web Data Management and XML L3b: Cloud Computing 3

Good for... Web hosting Deployment of data-intensive web services especially those with unpredictable load... that require high availability Store massive amounts of data (backups, videos, logs, etc) Off-line analysis of massive data Large computing jobs on demand jobs that require many CPUs Alternatives: Peer-to-peer computing (edge computing) BitTorrent, multi-user games, Skype Grid computing Web Data Management and XML L3b: Cloud Computing 4

Current Trends Cloud providers: Amazon, Google, Yahoo!, Microsoft,... they provide infrastructure and/or deployment platform they offer them as web services and are billed on a utility basis Amazon web services Simple Storage Service (SS3) Elastic Compute Cloud (EC2) Elastic MapReduce Google App Engine plus many office applications (Google docs), email etc Web Data Management and XML L3b: Cloud Computing 5

Challenges Data security Have to depend on the security provided by the cloud host Data protection against other applications Protection against the cloud host A cloud is a high value target to hackers Data ownership issues Moving sensitive data to the cloud Performance variability Lack of Quality of Service (QoS) guarantees Data transfer bottlenecks Financial cost Web Data Management and XML L3b: Cloud Computing 6

MapReduce Simplified Data Processing on Large Clusters, by Dean and Ghermawat, Google Inc: A simple and powerful interface that enables automatic parallelization and distribution of large-scale computations, combined with an implementation of this interface that achieves high performance on large clusters of commodity PCs The following slides are based on Dan Weld s class at U. Washington (who in turn made his slides based on those by Jeff Dean, Sanjay Ghemawat, Google, Inc.) Web Data Management and XML L3b: Cloud Computing 7

Motivation Large-Scale Data Processing Want to use 1000s of CPUs But don t want the hassle of managing things MapReduce provides Automatic parallelization & distribution Fault tolerance I/O scheduling Monitoring & status updates Web Data Management and XML L3b: Cloud Computing 8

Map/Reduce Map/Reduce A programming model used in functional programming languages Many data parallel problems can be phrased this way Easy to distribute across nodes Nice retry/failure semantics Web Data Management and XML L3b: Cloud Computing 9

Map in Lisp (Scheme) (map f list [list 2 list 3 ]) (map square (1 2 3 4)) (1 4 9 16) (reduce + (1 4 9 16)) (+ 16 (+ 9 (+ 4 1) ) ) 30 (reduce + (map square (map l 1 l 2 )))) Web Data Management and XML L3b: Cloud Computing 10

Map/Reduce ala Google map(key, val) is run on each item in set emits new-key / new-val pairs reduce(key, vals) is run for each unique key emitted by map() vals is a value list that contains all values associated with the same key emits final output Web Data Management and XML L3b: Cloud Computing 11

Counting Words in Documents Input consists of (url, contents) pairs map(key=url, val=contents): For each word w in contents, emit (w, 1 ) reduce(key=word, values=uniq_counts): Sum all 1 s in values list Emit result (word, sum) Web Data Management and XML L3b: Cloud Computing 12

Count, illustrated map(key=url, val=contents): For each word w in contents, emit (w, 1 ) reduce(key=word, values=uniq_counts): Sum all 1 s in values list Emit result (word, sum) see bob throw see spot run see 1 bob 1 run 1 see 1 spot 1 throw 1 bob 1 run 1 see 2 spot 1 throw 1 Web Data Management and XML L3b: Cloud Computing 13

Grep Input consists of (url+offset, single line) map(key=url+offset, val=line): If contents matches regexp, emit (line, 1 ) reduce(key=line, values=uniq_counts): Don t do anything; just emit line Web Data Management and XML L3b: Cloud Computing 14

Reverse Web-Link Graph Map For each URL linking to target, Output <target, source> pairs Reduce Concatenate list of all source URLs Outputs: <target, list (source)> pairs Web Data Management and XML L3b: Cloud Computing 15

MapReduce Programs In Google Source Tree Example uses: distributed grep distributed sort web link-graph reversal term-vector / host web access log stats inverted index construction document clustering machine learning statistical machine translation......... Web Data Management and XML L3b: Cloud Computing 16

Typical cluster: 100s/1000s of 2-CPU x86 machines, 2-4 GB of memory Limited bisection bandwidth Storage is on local IDE disks GFS: distributed file system manages data (SOSP'03) Job scheduling system: jobs made up of tasks, scheduler assigns tasks to machines Implementation is a C++ library linked into user programs Web Data Management and XML L3b: Cloud Computing 17

Execution How is this distributed? Partition input key/value pairs into chunks, run map() tasks in parallel After all map()s are complete, consolidate all emitted values for each unique emitted key Now partition space of output map keys, and run reduce() in parallel If map() or reduce() fails, re-execute! Web Data Management and XML L3b: Cloud Computing 18

Job Processing TaskTracker 0 TaskTracker 1 TaskTracker 2 JobTracker grep TaskTracker 3 TaskTracker 4 TaskTracker 5 1. Client submits grep job, indicating code and input files 2. JobTracker breaks the input file into k chunks, (in this case 6) and assigns work to tasktrackers. 3. After map(), tasktrackers exchange map-output to build reduce() keyspace 4. JobTracker breaks reduce() keyspace into m chunks (in this case 6). Assigns work. 5. reduce() output may go to NDFS Web Data Management and XML L3b: Cloud Computing 19

Execution Web Data Management and XML L3b: Cloud Computing 20

Parallel Execution Web Data Management and XML L3b: Cloud Computing 21

Fault Tolerance / Workers Handled via re-execution Detect failure via periodic heartbeats Re-execute completed + in-progress map tasks Why? Re-execute in progress reduce tasks Task completion committed through master Robust: lost 1600/1800 machines once, finished ok Semantics in presence of failures Web Data Management and XML L3b: Cloud Computing 22

Refinement: Redundant Execution Slow workers significantly delay completion time Other jobs consuming resources on machine Bad disks w/ soft errors transfer data slowly Weird things: processor caches disabled (!!) Solution: Near end of phase, spawn backup tasks Whichever one finishes first "wins" Dramatically shortens job completion time Web Data Management and XML L3b: Cloud Computing 23

Refinement: Locality Optimization Master scheduling policy: Asks GFS for locations of replicas of input file blocks Map tasks typically split into 64MB (GFS block size) Map tasks scheduled so GFS input block replica are on same machine or same rack Effect Thousands of machines read input at local disk speed Without this, rack switches limit read rate Web Data Management and XML L3b: Cloud Computing 24

Refinement: Skipping Bad Records Map/Reduce functions sometimes fail for particular inputs Best solution is to debug & fix Not always possible ~ third-party source libraries On segmentation fault: Send UDP packet to master from signal handler Include sequence number of record being processed If master sees two failures for same record: Next worker is told to skip the record Web Data Management and XML L3b: Cloud Computing 25

Other Refinements Sorting guarantees within each reduce partition Compression of intermediate data Combiner Useful for saving network bandwidth Local execution for debugging/testing User-defined counters Web Data Management and XML L3b: Cloud Computing 26

Performance Tests run on cluster of 1800 machines: 4 GB of memory Dual-processor 2 GHz Xeons with Hyperthreading Dual 160 GB IDE disks Gigabit Ethernet per machine Bisection bandwidth approximately 100 Gbps Two benchmarks: MR_GrepScan 1010 100-byte records to extract records matching a rare pattern (92K matching records) MR_SortSort 1010 100-byte records (modeled after TeraSort benchmark) Web Data Management and XML L3b: Cloud Computing 27

MR_Grep Locality optimization helps: 1800 machines read 1 TB at peak ~31 GB/s W/out this, rack switches would limit to 10 GB/s Startup overhead is significant for short jobs Web Data Management and XML L3b: Cloud Computing 28

MR_Sort Normal No backup tasks 200 processes killed Backup tasks reduce job completion time a lot! System deals well with failures Web Data Management and XML L3b: Cloud Computing 29

Experience Rewrote Google's production indexing System using MapReduce Set of 10, 14, 17, 21, 24 MapReduce operations New code is simpler, easier to understand 3800 lines C++ 700 MapReduce handles failures, slow machines Easy to make indexing faster add more machines Web Data Management and XML L3b: Cloud Computing 30

Usage in Aug 2004 Number of jobs 29,423 Average job completion time 634 secs Machine days used 79,186 days Input data read Intermediate data produced Output data written 3,288 TB 758 TB 193 TB Average worker machines per job 157 Average worker deaths per job 1.2 Average map tasks per job 3,351 Average reduce tasks per job 55 Unique map implementations 395 Unique reduce implementations 269 Unique map/reduce combinations 426 Web Data Management and XML L3b: Cloud Computing 31

An open-source project for reliable, scalable, distributed computing, developed by Apache http://hadoop.apache.org/ Hadoop includes these subprojects: Hadoop Common: The common utilities that support the other Hadoop subprojects. HDFS: A distributed file system that provides high throughput access to application data. MapReduce: A software framework for distributed processing of large data sets on compute clusters. Hive: A data warehouse infrastructure that provides data summarization and ad hoc querying. Pig: A high-level data-flow language and execution framework for parallel computation. The following slides are based on the Yahoo! Hadoop tutorial http://developer.yahoo.com/hadoop/tutorial/ Web Data Management and XML L3b: Cloud Computing 32

HDFS In a Hadoop cluster, data is distributed to all the nodes of the cluster as it is being loaded in The Hadoop Distributed File System (HDFS) splits large data files into chunks which are managed by different nodes in the cluster each chunk is replicated across several machines data is conceptually record-oriented which data operated on by a node is chosen based on its locality to the node moving computation to the data, instead of moving the data to the computation Web Data Management and XML L3b: Cloud Computing 33

HDFS The design of HDFS is based on the design of the Google File System (GFS) HDFS is a block-structured file system individual files are broken into blocks of a fixed size (default is 64MB) Blocks are stored across a cluster of one or more machines with data storage capacity Individual machines in the cluster are referred to as DataNodes A file can be made of several blocks, and they are not necessarily stored on the same machine the target machines which hold each block are chosen randomly on a block-by-block basis files do not become unavailable by the loss of any one of those machines each block is replicated across a number of machines (3, by default) Metadata are stored reliably and synchronized by a single machine, called the NameNode Web Data Management and XML L3b: Cloud Computing 34

Isolated computation tasks Records are processed in isolation by tasks called Mappers The output from the Mappers is then brought together into a second set of tasks called Reducers, where results from different mappers can be merged together Web Data Management and XML L3b: Cloud Computing 35

A Closer Look Web Data Management and XML L3b: Cloud Computing 36

Stages of a MapReduce program InputFormat: describes how input files are split up and read Selects the files or other objects that should be used for input Defines the InputSplits that break a file into tasks Provides a factory for RecordReader objects that read the file Mapper: Given a key and a value, the map() method emits (key, value) pair(s) which are forwarded to the Reducers Shuffle: moving map outputs to the reducers Each reducer is associated with a different key space (a partition) all values for the same key are sent to the same partition default partitioner: key-hash-value % number-of-reducers Sort: The set of intermediate keys in a partition is sorted before they are presented to the Reducer Reduce: For each different key in the partition assigned to a Reducer, the Reducer's reduce() method is called once OutputFormat: The (key, value) pairs are written to output files Web Data Management and XML L3b: Cloud Computing 37

The Optional Combiner Web Data Management and XML L3b: Cloud Computing 38

A simple MapReduce program Word Count: how many times different words appear in a set of files? High-Level MapReduce Word Count: mapper (filename, file-contents): for each word in file-contents: emit (word, 1) reducer (word, values): sum = 0 for each value in values: sum = sum + value emit (word, sum) Expected output: sweet 1 this 2 is 2 the 2 foo 1 bar 1 Web Data Management and XML L3b: Cloud Computing 39

Java Source of the Mapper public static class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); public void map( LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { String line = value.tostring(); StringTokenizer itr = new StringTokenizer(line); while (itr.hasmoretokens()) { word.set(itr.nexttoken()); output.collect(word, one); } } } Web Data Management and XML L3b: Cloud Computing 40

The Reducer public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce( Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { int sum = 0; while (values.hasnext()) { sum += values.next().get(); } output.collect(key, new IntWritable(sum)); } } Web Data Management and XML L3b: Cloud Computing 41

The Driver public void run(string inputpath, String outputpath) throws Exception { JobConf conf = new JobConf(WordCount.class); conf.setjobname("wordcount"); // the keys are words (strings) conf.setoutputkeyclass(text.class); // the values are counts (ints) conf.setoutputvalueclass(intwritable.class); conf.setmapperclass(mapclass.class); conf.setreducerclass(reduce.class); FileInputFormat.addInputPath(conf, new Path(inputPath)); FileOutputFormat.setOutputPath(conf, new Path(outputPath)); } JobClient.runJob(conf); Web Data Management and XML L3b: Cloud Computing 42

A Join between Employee and Department class Employee implements Writable { public String name; public int dno; public String address; Employee ( String n, int d, String a ) { name = n; dno = d; address = a; } public void write ( DataOutput out ) { out.writeint(dno); out.writeutf(name); out.writeutf(address); } public void readfields ( DataInput in ) { dno = in.readint(); name = in.readutf(); address = in.readutf(); } } class Department implements Writable { public String name; public int dno; Department ( String n, int d ) { name = n; dno = d; } public void write ( DataOutput out ) { out.writeint(dno); out.writeutf(name); } public void readfields ( DataInput in ) { dno = in.readint(); name = in.readutf(); } } Web Data Management and XML L3b: Cloud Computing 43

Need also to Serialize the Map Output class Result implements Writable { public String ename; public String dname; Result ( String en, String dn ) { ename = en; dname = dn; } public void write ( DataOutput out ) { out.writeutf(ename); out.writeutf(dname); } public void readfields ( DataInput in ) { ename = in.readutf(); dname = in.readutf(); } public String tostring () { return ename+" "+dname; } } Web Data Management and XML L3b: Cloud Computing 44

Join Requires two Mappers public class Join { public static class EmployeeMapper extends Mapper<Object, Text, IntWritable, EmpDept >{ public void map ( Object key, Text value, Context context ) { Scanner s = new Scanner(value.toString()).useDelimiter(","); Employee e = new Employee(s.next(),s.nextInt(),s.next()); context.write(new IntWritable(e.dno),new EmpDept(e)); s.close(); } } public static class DepartmentMapper extends Mapper<Object, Text, IntWritable, EmpDept >{ public void map ( Object key, Text value, Context context ) { Scanner s = new Scanner(value.toString()).useDelimiter(","); Department d = new Department(s.next(),s.nextInt()); context.write(new IntWritable(d.dno),new EmpDept(d)); s.close(); } } Web Data Management and XML L3b: Cloud Computing 45

The Join Reducer public static class ResultReducer extends Reducer<IntWritable, EmpDept, IntWritable, Result> { static Vector<Employee> emps = new Vector(); static Vector<Department> depts = new Vector(); public void reduce ( IntWritable key, Iterable<EmpDept> values, Context context ) { emps.clear(); depts.clear(); for (EmpDept v: values) if (v.tag == 0) emps.add(v.employee); else depts.add(v.department); for ( Employee e: emps ) for ( Department d: depts ) context.write(key,new Result(e.name,d.name)); } } Web Data Management and XML L3b: Cloud Computing 46