1 / 80

大 数据存储与应用 大规模文件系统及 Map Reduce

大 数据存储与应用 大规模文件系统及 Map Reduce. 课程主页: http ://netcomm.bjtu.edu.cn/? page_id=397 陈 一 帅 chenyishuai@gmail.com. 内容. 大数据 传统计算模型 集群计算模型 分布式文件系统 Map-Reduce 原理 算法 矩阵运算 关系代数 扩展 开销计算. 大 数据. 数据特点. 数据本身的特点 数据量大 高维 应用的特点 分析 读多, Append 多 很少更新. 数据量大.

judith
Download Presentation

大 数据存储与应用 大规模文件系统及 Map Reduce

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 大数据存储与应用大规模文件系统及Map Reduce 课程主页:http://netcomm.bjtu.edu.cn/?page_id=397 陈一帅 chenyishuai@gmail.com

  2. 内容 • 大数据 • 传统计算模型 • 集群计算模型 • 分布式文件系统 • Map-Reduce • 原理 • 算法 • 矩阵运算 • 关系代数 • 扩展 • 开销计算

  3. 大数据

  4. 数据特点 • 数据本身的特点 • 数据量大 • 高维 • 应用的特点 • 分析 • 读多,Append多 • 很少更新

  5. 数据量大 150 PB on 50k+ servers running 15k apps processes 20 PB a day (2008) Wayback Machine: 3 PB + 100 TB/month (3/2009) 9 PB of user data +>50 TB/day (11/2011) LHC: ~15 PB a year(at full capacity) 36 PB of user data + 80-90 TB/day (6/2010) S3: 449B objects, peak 290k request/second (7/2011) 640Kought to be enough for anybody. LSST: 6-10 PB a year (~2015)

  6. 示例:全球网页字数统计 • 数据量: • 20+ billion 网页 • 20KB/page,400+ TB

  7. 传统计算模型

  8. 传统计算模型 • 单机 • 分布式/并行计算 • 存储

  9. 单机

  10. 分布式/并行计算 Different programming models Fundamental issues Message Passing Shared Memory scheduling, data distribution, synchronization, inter-process communication, robustness, fault tolerance, … Memory Architectural issues P1 P2 P3 P4 P5 P1 P2 P3 P4 P5 Flynn’s taxonomy (SIMD, MIMD, etc.),network typology, bisection bandwidthUMA vs. NUMA, cache coherence Different programming constructs mutexes, conditional variables, barriers, … masters/slaves, producers/consumers, work queues, … 并行程序 livelock, deadlock, data starvation, priority inversion… dining philosophers, sleeping barbers, cigarette smokers, … (I want my students developing new algorithms, not debugging race conditions) The reality: programmer shoulders the burden of managing concurrency…

  11. 传统存储模型 SAN Compute Nodes NAS What’s the problem here?

  12. 示例:全球网页字数统计 • 数据量: • 20+ billion 网页 • 20KB/page,400+ TB • 磁盘读写速度: 30~35MB/sec • ~4个月 • 特点: • 计算简单:+1 • 问题是数据量大

  13. Google计算模型 Cluster computing

  14. Cluster (集群)计算 • 2011年,Google 1M node • Commodity硬件,有限寿命 (1000天),数量多 (Millions) • 一个节点,既有计算,又有存储

  15. Clustering计算:工作原理 • 多节点合作 • 存一个大文件 • 整个互联网的网页 • 分布式存储 • 分布式文件系统 • 完成一个大工作 • 统计单词频度 • 分布式计算 • Map-Reduce计算模型

  16. 存储结构 Source: Barroso and UrsHölzle (2009)

  17. 各种存储的容量和性能 Source: Barroso and UrsHölzle (2009)

  18. Building Blocks • Commodity硬件,有限寿命 (1000天),数量多 (Millions) • 一个节点,既有计算,又有存储 Source: Barroso and UrsHölzle (2009)

  19. Source: NY Times (6/14/2006)

  20. Anatomy of a Datacenter Source: Barroso and UrsHölzle (2009)

  21. Google Data Center

  22. 分布式文件系统 DFS:Distributed File Sys

  23. 分布式文件系统 • GFS • Google File Sys • HDFS • Hadoop Distributed File Sys • 存的文件有讲究: • 大:GB,TB • Write-once,appended • 不常更新

  24. 分布式文件系统 • 大文件分片 • Chunk:16 ~ 64MB • 多备份 • 2x 或 3x • 放到不同机架上

  25. HDFS Architecture HDFS namenode Application /foo/bar (file name, block id) File namespace HDFS Client block 3df2 (block id, block location) instructions to datanode datanode state (block id, byte range) block data Namenode责任 HDFS datanode HDFS datanode • 文件系统的基本功能:目录结构,permission, • 查询,健康维护 Linux file system Linux file system … … Adapted from (Ghemawatet al., SOSP 2003)

  26. Map-Reduce 原理

  27. Map-Reduce原理 • 基于DFS • Chunk server也就是计算Server • 本地计算,减少通信 • 分布式计算

  28. 示例:全球网页单词计数 • Map-Reduce实现 • DFS存储全球网页 • 在各个存储节点上对本节点存储的网页,进行单词划分:Map • 把各节点上相同的词,收集到一起:Group by key • 求和:Reduce

  29. Map-Reduce

  30. 示例

  31. Map-Reduce

  32. Group by key • Task of Map-Reduce environment • Partition • Hash(word) mod R • R: Reducer个数 • Hash(first letter(word)) mod R

  33. 本地化+ 并行化

  34. 框架的作用 • 工作分配 • 处理节点失败 • 节点间通信

  35. 工作调度 • Task • 状态:Idle,In-progress,Completed • 分配idle task给Worker • Map Worker 完成一个Task,报告 master 工作完成,及中间结果存储的位置(partition好了,每个Reducer 一个中间结果文件) • Master通知Reducer去拿 • Reducer Worker 完成一个Task,报告 master 工作结果 • Master 周期地 Ping worker,检测失败

  36. Google

  37. Pipeline • 把通信时间隐藏掉

  38. 节点失败处理 • Master发现一个Mapper失败,Ping不通 • 已有的中间结果文件拿不到了 • 它的全部工作重做 • Master发现一个Reducer失败 • 完成工作的Output已给了Master • 只有In-progress的task需要重做 • Master失败 • 通知所有worker,放弃已分配的任务

  39. 多少个Mapper,多少个Reducer? • 程序员可配置 • 基本原则: • Mapper数 > 机器数 • 每个Chunk一个Mapper • Mapper小一点的话,失败了,方便重新分配工作 • Reducer的数目 • 比Mapper数少

  40. 存储 + 计算 = Map-Reduce计算模型 namenode job submission node namenode daemon jobtracker tasktracker tasktracker tasktracker datanode daemon datanode daemon datanode daemon Linux file system Linux file system Linux file system … … … slave node slave node slave node

  41. Map-Reduce 算法

  42. 抽象模型 • 把各个网页分为一个个词 关键是:Key

  43. Map-Reduce算法 • 定义不同的Map/Reduce函数,实现各种分布式算法 • 图算法 • 数据挖掘算法 • 矩阵乘法 • 关系代数

  44. Map-Reduce 算法: 矩阵乘法

  45. Map-Reduce: 矩阵乘法 • PageRank • n × n 矩阵 M • n × 1 向量 V • M ×V • 通过key,把计算元素(mijvj)Partition到一个Reducer去 • Key: i

  46. Map-Reduce: 矩阵乘法 • V特别大 • PageRank • n= 20+ Billion • 怎么办? • 把V和M分块 • (i , mijvj)

  47. Map-Reduce: 矩阵乘法 • Key: (i,k)

More Related