已阅读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-2030血管内超声(IVUS)在冠状动脉慢性闭塞病变中的应用价值报告
- 2025-2030葡萄酒酿造行业市场现状供需评估投资评估规划分析研究调查报告
- 2025-2030葡萄牙葡萄酒产业市场供应需求研究及品牌国际化发展报告
- 岳阳2025年湖南岳阳职业技术学院招聘教师及管理人员13人笔试历年参考题库附带答案详解
- 2025年新版西学中医考试试题及答案
- 宜昌2025年湖北宜昌市远安县事业单位面向村主职干部专项招聘3人笔试历年参考题库附带答案详解
- 安徽2025年安徽中医药大学第一附属医院高层次人才招聘36人笔试历年参考题库附带答案详解
- 天津2025年天津音乐学院博士岗位招聘11人笔试历年参考题库附带答案详解
- 天津2025年天津市津南区教育系统招聘高层次教育人才2人笔试历年参考题库附带答案详解
- 天津2025年天津市人民医院招聘185人笔试历年参考题库附带答案详解
- 初中寒假前心理健康教育主题班会课件
- 事业编退休报告申请书
- 原发性骨髓纤维化2026
- 半导体厂务项目工程管理 课件 项目6 净化室系统的设计与维护
- 河南省洛阳强基联盟2025-2026学年高二上学期1月月考英语试题含答案
- 2026年中考数学模拟试卷试题汇编-尺规作图
- 玻璃钢水箱安装详细技术方案
- 山东省烟台市开发区2024-2025学年上学期期末八年级数学检测题(含答案)
- 桂花香包制作课件
- 社会工作本科毕业论文
- (2025年)架子工考试模拟题(带答案)
评论
0/150
提交评论