l*****n 发帖数: 246 | 1 已经被两个面试官考到这个知识点了。。。无奈new grads,不懂啊。。。
就是data set很skew,一个map task产生的key很多,造成一个reduce task handle不
了,怎么办?
partition function怎么写合适?还有个面试官说,要我写个combiner。。。不会写啊
,肿么办。。。
被一个奇葩公司店面,一上来就问我这个new grads两道system design题。。我想吐血
啊。。。 | i*******6 发帖数: 107 | 2 明显题目不全,没办法回答。你那几个问号是一个题目还是好几个?你能完整的重复一
下原来的题目吗? | f******y 发帖数: 54 | 3 “data set很skew”,这个现象准确描述是,“相同key的record太多”,
如果是这样的话,这个不关partition问题,因为本质上“相同key的“的数据肯定要在
一个reduce里面的,不管你partition怎么写。
那么怎么解决?
1,combiner确实是个方法,比如以word count为例子,
《hello, 1》,《hello, 1》,《hello, 1》可以合并一条《hello, 3》
2,combiner方法不是什么地方都可以使用,有些不能合并的,就不能使用combiner,那
怎么办?
其实没什么好办法,可能你最开始设计上就有问题而导致skew,也许可以通过多轮
mapreduce解决,这个扯远了。
lz以前没搞过,要你设计确实有点为难。
继续努力,加油! | k********0 发帖数: 6 | 4 Use two map-reduce jobs, the first job does a partial aggregation, then use
a second reduce job to do a final aggregation. This is a typical problem.
Also, you can check the Hive system design, which deals with this problem by
using two map-reduce jobs. | b**********5 发帖数: 7881 | 5 how does one do partial aggregation?let's say the map functions creates
like 1 gazillion key "k", so the data skews heavily on key "k", and one
reducer gets 1 gazillion elements, and can't handle it.
how do u do partial aggregation on those 1 gazillion key "k"? aggregate half
of them first? how do u aggregate half of them? where does the other half
go?
我稍微google了一下mapreduce data skew, 一些paper好像都是要custom partition
, 先估计一下map出来的key的distribution。。。
use
by
【在 k********0 的大作中提到】 : Use two map-reduce jobs, the first job does a partial aggregation, then use : a second reduce job to do a final aggregation. This is a typical problem. : Also, you can check the Hive system design, which deals with this problem by : using two map-reduce jobs.
|
|