




已阅读5页,还剩23页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
CS 345A Data Mining,MapReduce,Single-node architecture,Memory,Disk,CPU,Machine Learning, Statistics,“Classical” Data Mining,Commodity Clusters,Web data sets can be very large Tens to hundreds of terabytes Cannot mine on a single server (why?) Standard architecture emerging: Cluster of commodity Linux nodes Gigabit ethernet interconnect How to organize computations on this architecture? Mask issues such as hardware failure,Cluster Architecture,Switch,Each rack contains 16-64 nodes,Switch,Switch,1 Gbps between any pair of nodes in a rack,2-10 Gbps backbone between racks,Stable storage,First order problem: if nodes can fail, how can we store data persistently? Answer: Distributed File System Provides global file namespace Google GFS; Hadoop HDFS; Kosmix KFS Typical usage pattern Huge files (100s of GB to TB) Data is rarely updated in place Reads and appends are common,Distributed File System,Chunk Servers File is split into contiguous chunks Typically each chunk is 16-64MB Each chunk replicated (usually 2x or 3x) Try to keep replicas in different racks Master node a.k.a. Name Nodes in HDFS Stores metadata Might be replicated Client library for file access Talks to master to find chunk servers Connects directly to chunkservers to access data,Warm up: Word Count,We have a large file of words, one word to a line Count the number of times each distinct word appears in the file Sample application: analyze web server logs to find popular URLs,Word Count (2),Case 1: Entire file fits in memory Case 2: File too large for mem, but all pairs fit in mem Case 3: File on disk, too many distinct words to fit in memory sort datafile | uniq c,Word Count (3),To make it slightly harder, suppose we have a large corpus of documents Count the number of times each distinct word occurs in the corpus words(docs/*) | sort | uniq -c where words takes a file and outputs the words in it, one to a line The above captures the essence of MapReduce Great thing is it is naturally parallelizable,MapReduce: The Map Step,Input key-value pairs,Intermediate key-value pairs,k,v,MapReduce: The Reduce Step,Output key-value pairs,MapReduce,Input: a set of key/value pairs User supplies two functions: map(k,v) list(k1,v1) reduce(k1, list(v1) v2 (k1,v1) is an intermediate key/value pair Output is the set of (k1,v2) pairs,Word Count using MapReduce,map(key, value): / key: document name; value: text of document for each word w in value: emit(w, 1),reduce(key, values): / key: a word; value: an iterator over counts result = 0 for each count v in values: result += v emit(result),Distributed Execution Overview,User Program,Data flow,Input, final output are stored on a distributed file system Scheduler tries to schedule map tasks “close” to physical storage location of input data Intermediate results are stored on local FS of map and reduce workers Output is often input to another map reduce task,Coordination,Master data structures Task status: (idle, in-progress, completed) Idle tasks get scheduled as workers become available When a map task completes, it sends the master the location and sizes of its R intermediate files, one for each reducer Master pushes this info to reducers Master pings workers periodically to detect failures,Failures,Map worker failure Map tasks completed or in-progress at worker are reset to idle Reduce workers are notified when task is rescheduled on another worker Reduce worker failure Only in-progress tasks are reset to idle Master failure MapReduce task is aborted and client is notified,How many Map and Reduce jobs?,M map tasks, R reduce tasks Rule of thumb: Make M and R much larger than the number of nodes in cluster One DFS chunk per map is common Improves dynamic load balancing and speeds recovery from worker failure Usually R is smaller than M, because output is spread across R files,Combiners,Often a map task will produce many pairs of the form (k,v1), (k,v2), for the same key k E.g., popular words in Word Count Can save network time by pre-aggregating at mapper combine(k1, list(v1) v2 Usually same as reduce function Works only if reduce function is commutative and associative,Partition Function,Inputs to map tasks are created by contiguous splits of input file For reduce, we need to ensure that records with the same intermediate key end up at the same worker System uses a default partition function e.g., hash(key) mod R Sometimes useful to override E.g., hash(hostname(URL) mod R ensures URLs from a host end up in the same output file,Exercise 1: Host size,Suppose we have a large web corpus Lets look at the metadata file Lines of the form (URL, size, date, ) For each host, find the total number of bytes i.e., the sum of the page sizes for all URLs from that host,Exercise 2: Distributed Grep,Find all occurrences of the given pattern in a very large set of files,Exercise 3: Graph reversal,Given a directed graph as an adjacency list: src1: dest11, dest12, src2: dest21, dest22, Construct the graph in which all the links are reversed,Exercise 4: Frequent Pairs,Given a large set of market baskets, find all frequent pairs Remember definitions from Association Rules lectures,Implementations,Google Not available outside Google Hadoop An open-source implementation in Java Uses HDFS for stable storage Download: /hadoop/ Aster Data Cluster-optimized SQL Database that also implements MapReduce Made available free of charge for this class,Cloud Computing,Ability to rent computing by the hour Additional services e.g., persistent storage We will be using Am
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 精简年终述职报告
- 对供应商的管理
- 保险行业未来发展前景
- 2025年六班级班主任工作方案
- 2025年社区防汛抢险活动方案
- 毕业论文答辩结构化展示
- 2025年幼儿园母亲节方案
- 山东建筑大学《第二外国语(3)》2023-2024学年第二学期期末试卷
- 北京中医药大学东方学院《JavaWeb程序设计实验》2023-2024学年第二学期期末试卷
- 郑州科技学院《英语视听说Ⅲ》2023-2024学年第一学期期末试卷
- 慢性心功能不全的护理查房
- 车辆维修质量保证措施
- 毛中特第一章毛泽东思想及其历史地位课件
- 浙江大学《普通化学》(第6版)笔记和课后习题(含考研真题)详解
- 国际贸易理论与实务(天津财经大学)知到章节答案智慧树2023年
- 教学防灭火新技术 公开课比赛一等奖
- 电磁学知到章节答案智慧树2023年天津大学
- EIM Book 1 Unit 10 Don't give up单元知识要点
- 四年级数学下册教案(先学后教当堂训练)
- 改革开放与新时代智慧树知到答案章节测试2023年同济大学
- 敦煌的艺术智慧树知到答案章节测试2023年
评论
0/150
提交评论