[Hadoop] When do reduce tasks start in Hadoop?

The reduce phase has 3 steps: shuffle, sort, reduce. Shuffle is where the data is collected by the reducer from each mapper. This can happen while mappers are generating data since it is only a data transfer. On the other hand, sort and reduce can only start once all the mappers are done. You can tell which one MapReduce is doing by looking at the reducer completion percentage: 0-33% means its doing shuffle, 34-66% is sort, 67%-100% is reduce. This is why your reducers will sometimes seem "stuck" at 33%-- it's waiting for mappers to finish.

Reducers start shuffling based on a threshold of percentage of mappers that have finished. You can change the parameter to get reducers to start sooner or later.

Why is starting the reducers early a good thing? Because it spreads out the data transfer from the mappers to the reducers over time, which is a good thing if your network is the bottleneck.

Why is starting the reducers early a bad thing? Because they "hog up" reduce slots while only copying data and waiting for mappers to finish. Another job that starts later that will actually use the reduce slots now can't use them.

You can customize when the reducers startup by changing the default value of mapred.reduce.slowstart.completed.maps in mapred-site.xml. A value of 1.00 will wait for all the mappers to finish before starting the reducers. A value of 0.0 will start the reducers right away. A value of 0.5 will start the reducers when half of the mappers are complete. You can also change mapred.reduce.slowstart.completed.maps on a job-by-job basis. In new versions of Hadoop (at least 2.4.1) the parameter is called is mapreduce.job.reduce.slowstart.completedmaps (thanks user yegor256).

Typically, I like to keep mapred.reduce.slowstart.completed.maps above 0.9 if the system ever has multiple jobs running at once. This way the job doesn't hog up reducers when they aren't doing anything but copying data. If you only ever have one job running at a time, doing 0.1 would probably be appropriate.

參考資料:
1. http://stackoverflow.com/questions/11672676/when-do-reduce-tasks-start-in-hadoop
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末敷扫,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子丑婿,更是在濱河造成了極大的恐慌,老刑警劉巖运悲,帶你破解...
    沈念sama閱讀 211,496評(píng)論 6 491
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件它呀,死亡現(xiàn)場(chǎng)離奇詭異海诲,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)页屠,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,187評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門粹胯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人辰企,你說我怎么就攤上這事风纠。” “怎么了蟆豫?”我有些...
    開封第一講書人閱讀 157,091評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵议忽,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我十减,道長(zhǎng)栈幸,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,458評(píng)論 1 283
  • 正文 為了忘掉前任帮辟,我火速辦了婚禮速址,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘由驹。我一直安慰自己芍锚,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,542評(píng)論 6 385
  • 文/花漫 我一把揭開白布蔓榄。 她就那樣靜靜地躺著并炮,像睡著了一般。 火紅的嫁衣襯著肌膚如雪甥郑。 梳的紋絲不亂的頭發(fā)上逃魄,一...
    開封第一講書人閱讀 49,802評(píng)論 1 290
  • 那天,我揣著相機(jī)與錄音澜搅,去河邊找鬼伍俘。 笑死邪锌,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的癌瘾。 我是一名探鬼主播觅丰,決...
    沈念sama閱讀 38,945評(píng)論 3 407
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼妨退!你這毒婦竟也來了妇萄?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,709評(píng)論 0 266
  • 序言:老撾萬榮一對(duì)情侶失蹤碧注,失蹤者是張志新(化名)和其女友劉穎嚣伐,沒想到半個(gè)月后糖赔,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體萍丐,經(jīng)...
    沈念sama閱讀 44,158評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,502評(píng)論 2 327
  • 正文 我和宋清朗相戀三年放典,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了逝变。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 38,637評(píng)論 1 340
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡奋构,死狀恐怖壳影,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情弥臼,我是刑警寧澤宴咧,帶...
    沈念sama閱讀 34,300評(píng)論 4 329
  • 正文 年R本政府宣布,位于F島的核電站径缅,受9級(jí)特大地震影響掺栅,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜纳猪,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,911評(píng)論 3 313
  • 文/蒙蒙 一氧卧、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧氏堤,春花似錦沙绝、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,744評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至购笆,卻和暖如春粗悯,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背由桌。 一陣腳步聲響...
    開封第一講書人閱讀 31,982評(píng)論 1 266
  • 我被黑心中介騙來泰國(guó)打工为黎, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留邮丰,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 46,344評(píng)論 2 360
  • 正文 我出身青樓铭乾,卻偏偏與公主長(zhǎng)得像剪廉,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子炕檩,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,500評(píng)論 2 348

推薦閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,435評(píng)論 0 23
  • swift 詳細(xì)教程 教程地址 GitBook notice qq:391565521 email:zhuha...
    CharlesAir閱讀 355評(píng)論 0 0
  • 燧石手斧斗蒋,舊石器時(shí)代,穆斯特時(shí)期 燧石匕首笛质,新石器時(shí)代泉沾,哥本哈根國(guó)家博物館 母神雕像 維綸多夫維納斯,石灰石妇押,高1...
    渡支閱讀 1,773評(píng)論 0 1
  • 1. 100部電影加影評(píng) 2. 10本書跷究,含2本英文原著,加筆記 3. 3場(chǎng)音樂會(huì)或話劇 4. 探店10家精致餐廳...
    劉彥呈閱讀 199評(píng)論 0 1