Google云计算技术Bigtable_国外课件
最新2019-云计算第二章2-4教学ppt-PPT课件

Google账户 ——开发应用程序必须拥有一个Google账户
App Engine服务——Google App Engine提供了一些服务
开发流程 ——Google App Engine开发应用程序必须遵守一定的开发
流程
配额和限制 ——Google账户提供的免费空间和流量有一定的配额和
自01己的其接ta应他口S用计上to程r算通e数机过序据;HT只T库P能或来在H存0TT标储2P准S应
用程序运行期间持续存在
03
(几秒之内完成)
同时,请求处理的
来的进数行据
序不能在自己的响
发送后产生子进程
执行代码
Google App Engine SDK
➢使用SDK时,可以在本地计算机上模拟包括所有Google App Engine服务的网络服务器应用程序,该SDK包括Google App Engine中的所有API和库。该网络服务器还可以模拟沙盒环境
沙盒给用o网应p行用gp开户l址用写程eE发应抓程n入序Ag人pi代用取序操pn码程无作eA员的EP序法,n上I提文和g只对只i的供n件电能能eG文沙了提o系子通读o件一供g统邮盒l,过取e进件的个对并应GAo虚用拟户的进环行境如,下这限个制环境使应用 应网程用络序程请与序求其只时他有才在运响行
开发者服且开务该发A应P使I用来程用访序的问必程互须序联使相网用中隔Da离,从而保证每个使用者可以且安响全应地时开间发必须极
➢使用Python实现,这个开发套件可以在装有Python 2.5的任 何平台上面运行,包括Windows、Mac OS X和Linux等,开发人 员可以在Python网站上获得适合自己系统的Python
GOOGLE bigtable

GOOGLE bigtable摘要bigtable是设计来分布存储大规模结构化数据的,从设计上它可以扩展到上2^50字节,分布存储在几千个普通服务器上.Google的很多项目使用BT来存储数据,包括网页查询,google earth和google金融.这些应用程序对BT的要求各不相同:数据大小(从URL到网页到卫星图象)不同,反应速度不同(从后端的大批处理到实时数据服务).对于不同的要求,BT都成功的提供了灵活高效的服务.在本文中,我们将描述BT的数据模型.这个数据模型让用户动态的控制数据的分布和结构.我们还将描述BT的设计和实现.1.介绍在过去两年半里,我们设计,实现并部署了BT.BT是用来分布存储和管理结构化数据的.BT的设计使它能够管理2^50 bytes(petabytes)数据,并可以部署到上千台机器上.BT完成了以下目标:应用广泛,可扩展,高性能和高可用性(high availability). 包括google analytics, google finance, orkut, personalized search, writely和google earth在内的60多个项目都使用BT.这些应用对BT的要求各不相同,有的需要高吞吐量的批处理,有的需要快速反应给用户数据.它们使用的BT集群也各不相同,有的只有几台机器,有的有上千台,能够存储2^40字节(terabytes)数据.BT在很多地方和数据库很类似:它使用了很多数据库的实现策略.并行数据库[14]和内存数据库[13]有可扩展性和高性能,但是BT的界面不同.BT不支持完全的关系数据模型;而是为客户提供了简单的数据模型,让客户来动态控制数据的分布和格式{就是只存储字串,格式由客户来解释},并允许客户推断底层存储数据的局部性{以提高访问速度}.数据下标是行和列的名字,数据本身可以是任何字串.BT的数据是字串,没有解释{类型等}.客户会在把各种结构或者半结构化的数据串行化{比如说日期串}到数据中.通过仔细选择数据表示,客户可以控制数据的局部化.最后,可以使用BT模式来控制数据是放在内存里还是在硬盘上.{就是说用模式,你可以把数据放在离应用最近的地方.毕竟程序在一个时间只用到一块数据.在体系结构里,就是:locality, locality, locality}第二节描述数据模型细节.第三节关于客户API概述.第四节简介BT依赖的google框架.第五节描述BT的实现关键部分.第6节叙述提高BT性能的一些调整.第7节提供BT性能的数据.在第8节,我们提供BT的几个使用例子,第9节是经验教训.在第10节,我们列出相关研究.最后是我们的结论.2.数据模型BT是一个稀疏的,长期存储的{存在硬盘上},多维度的,排序的映射表.这张表的索引是行关键字,列关键字和时间戳.每个值是一个不解释的字符数组.{数据都是字符串,没类型,客户要解释就自力更生吧}.(row:string, column:string,time:int64)->string {能编程序的都能读懂,不翻译了}//彼岸翻译的第二节我们仔细查看过好些类似bigtable的系统之后定下了这个数据模型。
谷歌BigTable数据库

谷歌BigTable数据库Bigtable包括了三个主要的组件:链接到客户程序中的库、一个Master服务器和多个Tablet服务器。
针对系统工作负载的变化情况,BigTable可以动态的向集群中添加(或者删除)Tablet服务器。
Master服务器主要负责以下工作:为Tablet服务器分配Tablets、检测新加入的或者过期失效的Table服务器、对Tablet服务器进行负载均衡、以及对保存在GFS上的文件进行垃圾收集。
除此之外,它还处理对模式的相关修改操作,例如建立表和列族。
每个Tablet服务器都管理一个Tablet的集合(通常每个服务器有大约数十个至上千个Tablet)。
每个Tablet服务器负责处理它所加载的Tablet的读写操作,以及在Tablets过大时,对其进行分割。
和很多Single-Master类型的分布式存储系统【17.21】类似,客户端读取的数据都不经过Master服务器:客户程序直接和Tablet服务器通信进行读写操作。
由于BigTable的客户程序不必通过Master服务器来获取Tablet的位臵信息,因此,大多数客户程序甚至完全不需要和Master服务器通信。
在实际应用中,Master服务器的负载是很轻的。
一个BigTable集群存储了很多表,每个表包含了一个Tablet的集合,而每个Tablet包含了某个范围内的行的所有相关数据。
初始状态下,一个表只有一个Tablet。
随着表中数据的增长,它被自动分割成多个Tablet,缺省情况下,每个Tablet的尺寸大约是100MB到200MB。
我们使用一个三层的、类似B+树[10]的结构存储Tablet的位臵信息(如图4)。
第一层是一个存储在Chubby中的文件,它包含了Root Tablet的位臵信息。
Root Tablet包含了一个特殊的METADATA表里所有的Tablet 的位臵信息。
METADATA表的每个Tablet包含了一个用户Tablet的集合。
google云计算系列课程第一讲:介绍PPT课件

8
Parallel vs. Distributed
Parallel computing can mean:
Vector processing of data Multiple CPUs in a single computer
3
Computer Speedup
Moonsistors on a chip doubles every 18 months, for the same cost” (1965)
Image: Tom’s Hardware and not subject to the Creative 4 Commons license applicable to the rest of this work.
applicable to the rest of this work.
10
A Brief History… 1985-95
“Massively parallel architectures” start rising in prominence
Distributed computing is multiple CPUs across many computers over the network
9
A Brief History… 1975-85
Parallel computing was favored in the early years
1
Course Overview
5 lectures
1 Introduction 2 Technical Side: MapReduce & GFS 2 Theoretical: Algorithms for distributed
BigTable分享ppt

改进策略
Q&A
?
root tablet 不分裂,因此保持三层结构不会变成四层、五层、六层…… metadata table 存储的也是key/value对
◦ ◦ ◦ key 是 一个tablet 的table 标石和talet的尾部标记 value是tablet的位置信息 一个meta 行大概1kb内存数据
128MB metadata tablets, is sufficient to address 2^34 tablets 客户端会cache tablet location信息,但具体没看懂
摘要
简介
数据模型
BigTable的数据模型 一个例子 Row Column Family Timestamps
数据模型
例子
例子
Row
Column Family
TimeStamps
客户端API(read的例子)
Scanner scanner(T); Scanner * stream; stream = scanner.FetchColumnFamily("anchor"); stream->SetReturnAllVersions(); scanner.Lookup("n.www"); for(; !stream->Done(); stream->next()){ printf("%s %s %lld %s\n", scanner.RowName(), stream->ColumnName(), stream->MicorTimestamp(), stream->Value() ); }
Google云计算技术MapReduce国外课件

failure because their output is stored on the local disk. ◦ Master failure: redo ◦ Semantics in the presence of failures:
result += ParseInt(v); Emit(AsString(result));
More Examples
Distributed grep:
◦ Map: (key, whole doc/a line) (the matched line, key)
◦ Reduce: identity function
outputs to achieve this property.
MapReduce: Fault Tolerance
Handled via re-execution of tasks.
Task completion committed through master
What happens if Mapper fails ?
◦ Re-execute completed + in-progress map tasks
What happens if Reducer fails ?
◦ Re-execute in progress reduce tasks
What happens if Master fails ?
◦ Potential trouble !!
Thousands of machines read input at local disk speed
google云计算原理1精品PPT课件

星辰急便董事长 陈平
马云
17
Google云计算原理
Google云计算的背景
18
Google与Microsoft的战争
19
冲突之源
Google和微软之间日益激烈的对立将是一场史诗般 的企业战争,将对两家公司的成功和发展产生重要 影响,并规定着消费者和企业如何工作、购物、通 讯,以及“他们过的数字生活”
29
Google云计算应用场景
Google Wave
◦ 信息分享、协作、发布平台
30
Google云计算应用场景
隶属于PaaS的Google云计算
◦ 属于部署在云端的应用执行环境 ◦ 支持Python和Java两种语言 ◦ 通过SDK提供Google的各种服务,如图形、MAIL和数据存
储等 ◦ 用户可快速、廉价(可免费使用限定的流量和存储)地部
Microsoft CEO 史蒂夫.鲍尔默
◦ 高速宽带连接会象Google断言的那样普及和可 靠吗?
◦ 企业、大学、消费者会让Google保存他们的资 料吗?
22
Google的秘密武器
应用规模对于系统架构设计的重要性 Google应用的特性
◦ 海量用户+海量数据 ◦ 需要具备较强的可伸缩性 ◦ 如何又快又好地提供服务?
中小企业、大学、消费者会相对迅速地转 向基于Web的“云计算”技术
新的赢利模式
◦ 低廉的云计算给Google带来更多的流量,进而带 来更多的广告收入
承认“云计算”不会在一夜之间普及
◦ 大公司通常会慢慢地改变自己的习惯 ◦ 其它问题,例如“飞机问题”,以及在不能上网
时用户如何工作。
Google CEO 埃立克.施米特
课件05多结构化数据管理google BIG TABLE

Bigtable构件——Chubby
Chubby提供了一个名字空间,里面包括目录和小文件。 每个目录或文件可以看作一个锁,读写文件的操作都是原子 的。 bby客户程序库提供对Chubby文件的一致性缓存: 每个Chubby客户程序都维护一个与Chubby服务的会话( session)并持有租约,如果客户程序不能在租约到期的时 间内重新签订会话的租约,则该会话过期失效。 ↓ 会话失效,则客户程序拥有的锁和打开的文件句柄都失 效。
18
API——查找与更新
客户程序可以遍历多个列族 Scanner scanner(T); ScanStream *stream; //选择列族 stream = scanner.FetchColumnFamily(“anchor”); stream->SetReturnAllVersions( ); scanner.Lookup(“n.www”);//选择行 for (; !stream->Done(); stream->Next()) { printf(“%s %s %lld %s\n”, scanner.RowName(), stream->ColumnName(), stream->MicroTimestamp(), stream->Value()); }//遍历n.www行anchor列族的所有版本值。
14
数据模型——时间戳
每一个数据项都可以包含同一份数据的不同版本, 通过时间戳(int64)来索引。 时间戳赋值: 1)通过Bigtable(可表示精确到毫秒的“实时”时 间) 2)由应用程序自己生成具有唯一性的时间戳。
数据项中不同版本的数据按照时间戳倒序排序( 最新的数据排在最前面)。
15
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
4
Performance Improvements
• Tablet Recovery
– perform compaction on tablet before offloading to another tablet server – 2 minor compactions to remove need for recovery tablet server to deal with recovery log entries – No synchronization needed to read from SSTable – Only memtable is mutable – Use mark-and-sweep garbage collection for SSTables in METADATA table – Split tablets quickly by letting child tables share SSTable of parent tablet
• Write operations increase the size of memtable and commit log
– Longer log, longer recovery
Performance Improvements
• Locality group (grouping multiple column families)
Motivation
• High scalability
Bigtable: A Distributed Storage System for Structured Data
April 21, 2;;<
– Scale to petabytes of data – Thousands of machines
• Bloom filters
– Bloom filters for a particular locality group in SSTable – Reduce need to read from disk if SSTable not in memory
• tablets are offloaded to other tablet servers in case of failure rebuild tablets by reading and applying mutations from commit log • sort commit log • partition log into chunks to allow parallelism • two log writing threads per tablet server to prevent hiccups due to GFS latency
– A _tablet` is a row range (set of ordered rows)
Implementation
• Client library • Master Server
– – – – – Only 1 master everyK guaranteed by Chubby Assigning tablets to tablet servers Detecting additionRexpiration of tablet servers Balancing load of tablet servers Garbage collection of GFS files
• High performance • High availability • Wide applicability
– 6; Google products using Bigtable (Analytics, Finance, Earth, OrkutK)
• Monitor temporal changes
– Block Cache
• High level cache to store key-value pairs returned by SSTable to tablet server • Useful when reading same data over and over again • Low level cache to store blocks read from GFS • Useful when reading data close to data recently read
– (row:string, column:string, time:int64) string
The Data Model
1
API
• Enables read, write, delete of tables, column families, rows, column family metadata (access control)
• Caching
– Improve read performance using 2-level cache – Scan Cache
Performance Improvements
• Commit-log
– single commit log per tablet server – append mutations to single file; co-mingling mutations for different tablets – complicates recovery
• METADATA tablets define logical Tables • Table (logical grouping)
– Tablet (S)
• Tablet Log (1)
– Written on GFS
• Tablet Servers
• memtable (1)
• Location of root tablet is in maБайду номын сангаасter lock file.
Tablet Assignment
• Master keeps track of the set of live tablet servers and tablet assignments
– When tablet server starts it acquires a lock on a unique file in a specific directory.
Tablet Serving
• Master pings for liveness of tablet server
– Failure: tablet reports that it has lost its lock or fails to reach the server
3
Compactions
– In memory
• SSTable (S)
– Written on GFS, immutatable.
– 1; to 1;;; tablets in 1 tablet server – Handles readRwrite request from client application – Splits tablets when tablets grow too large
Overview
• Similar to database, but no relational data model essentially a key value store • Sparse, distributed, persistent, multidimensional sorted map
Building Blocks
• Chubby
– Distributed locking service – Uses Paxos algorithm for consensus
• GFS
– Runs on same box as Bigtable – Underlying file system
• Can use regex for row and column matching
• memtable row is copy-on-write • reads and writes occur in parallel
Real Applications
• Google Analytics • Google Earth • Personalized Search
• Exploiting Immutability
Lessons
• Expect failures
– – – – – – – Fail-stop failures Memory and network corruption Clock skews Hung machines Extended and asymmetric network partitions Failures in underlying components (Chubby) Overflow of GFS quotas
RR Open the table Table ST = OpenOrDie("RbigtableRwebRwebtable"); RR Write a new anchor and delete an old anchor RowMutation r1(T, "n.www"); r1.Set("anchor:", "CNN"); r1.Delete("anchor:"); Operation op; Apply([op, [r1);
– separate SSTable for each locality group – segregation of column families which are not usually accessed together more efficient reads – some SSTables can be declared to be in-memory (loaded lazily) – compress each SSTable block separately for a locality group (can read portions of SSTable wRo decompressing entire thing) – two pass compression scheme (1st pass Bentley and McIlroy’s scheme; 2nd pass fast compression algorithm) – emphasize speed over space reduction