比如說又以下資料:
a a a a a a a a a a a a a a a a a a a a b
a a a a a a a c c b b c h h f d s h j
需要做wordcount,但是會有一個問題存在:a特别多,負責處理a這個單詞資料的reduce worker就會很累(負載不均衡,過大)
這時有一種解決辦法就是使用Combiner,其實Combiner和Reducer的寫法一模一樣,隻不過Combiner是提供給map task使用的而Reducer是提供給reduce使用的。Combiner的作用是在将任務交給Reducer使用之前做一些合并操作,減輕Reducer的負擔,但是這種方法解決負載的問題也不是很好。而且這種方法一般也不會輕易使用,因為這種方法存在一些問題(如下圖):