9

Google的Sawzall,Yahoo的Pig和微软的Dryad

 3 years ago
source link: https://blog.csdn.net/accesine960/article/details/1598729
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Google的Sawzall,Yahoo的Pig和微软的Dryad

Google的Sawzall,Yahoo的Pig和微软的Dryad

欢迎订阅作者微博

Greg 最近写了篇介绍Google,Yahoo,微软三大巨头公司分布式架构的Blog。这就是:Google的Sawzall,Yahoo的Pig 猪和微软的Dryad

这真是一个信息爆炸的时代,在这个大背景里消耗CPU最多的计算会越来越多从“软件本身性能提升”逐渐转移到信息处理的过程中。描述计算速度提高的摩尔定 律,据说现在还仍然有效,可 ”Andy giveth, and Bill taketh away“ 的名言似乎应该改为:"Andy giveth, and google(...) taketh away" 了。

言归正传,Yahoo猪年行大礼,在五一期间放出了:PIG 猪 。(猪非彼 ) Yahoo Pig 是一个运行在HadoopDoug Cutting 在06年3月份加入了Yahoo )上的并行处理架构,有了Pig 使得普通的程序员具有了分析处理gigantic数据集的能力。附带一下 Hadoop 基本进入了实用阶段 Amazon 的 EC2S3已经在使用了Hadoop了。
Yahoo Pig 有如下特点:
1、专注于于大量数据集分析(ad-hoc analysis , ad-hoc 代表:a solution that has been custom designed for a specific problem);
2、运行在集群的计算架构上,Yahoo Pig 提供了多层抽象,简化并行计算让普通用户使用;这些抽象完成自动把用户请求queries翻译成有效的并行评估计划,然后在物理集群上执行这些计划;
3、提供类似 SQL 的操作语法;
4、开放源代码;

从对 Yahoo Pig 的了解来看,推荐大家使用,Google Sawzall 和 Microsoft Dryad 就别指望了。
Google Sawzall 是google labs 很早就释放出来了,虽然两者都是定位于分布式并行计算的架构,实现方式却大相径庭。
Sawzall 是基于MapReduce 的,变成语法类似于 java 和 c 语言。

下面是 Sawzall 代码的例子:

proto "querylog.proto"
static RESOLUTION: int = 5; # minutes; must be divisor of 60
log_record: QueryLogProto = input;
queries_per_degree: table sum[t: time][lat: int][lon: int] of int;
loc: Location = locationinfo(log_record.ip);
if (def(loc)) {
  t: time = log_record.time_usec;
  m: int = minuteof(t); # within the hour
  m = m - m % RESOLUTION;
  t = trunctohour(t) + time(m * int(MINUTE));
  emit queries_per_degree[t][int(loc.lat)][int(loc.lon)] <- 1;
}

下面是Pig 代码的例子:

a = COGROUP QueryResults BY url, Pages BY url;
b = FOREACH a GENERATE FLATTEN(QueryResults.(query, position)), FLATTEN(Pages.pagerank);
c = GROUP b BY query;
d = FILTER c BY checkTop5(*);

很显然,如果大家需要对结构化(半结构化)的数据进行分析处理时 Pig 的 SQL 的语法更便于掌握。

具体参考Yahoo Pig 的其他例子:

Pig Latin Examples:
Example 1: Word Count
Example 2: Map/Reduce
Example 3: Pages and Queries
Example 4: PageRank


无独有偶,微软的Dryad 集成Linq (随着.net 2.0 正式发布了) 后叫: DryadLINQ 。从个人角度讲我一直看好 Linq 这个产品,出身Aders不说,程序语言和数据处理合2为1对简单的Insert ,update ,delete,query 完全应该集成起来。这一点也是我喜欢Rails的原因吧。

目前微软的  Dryad 已经在 Microsoft's AdCenter 投入使用。
我想用Yahoo Pig 的话,做 Log 分析应该比较适合。

参考资料:
sourcelab
Dryad: Distributed Data-Parallel Programs from Sequential Building Blocks

MapReduce BBS  

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK