Skip to Content
面向MapReduce的Hadoop优化
book

面向MapReduce的Hadoop优化

by Posts & Telecom Press, Khaled Tannir
May 2024
Intermediate to advanced
110 pages
1h 19m
Chinese
Packt Publishing
Content preview from 面向MapReduce的Hadoop优化

第6章 优化MapReduce任务

大多数MapReduce程序都是以数据分析为目的的,因此通常需要花的时间比较长。许多公司正在使用Hadoop在大规模数据集上做高级数据分析,这对运行时间提出了更高的要求。效率问题,尤其是MapReduce的I/O开销,仍然需要高度重视。

在本章中,我们将讨论一些优化技术,比如使用压缩和 Combiner 改善作业的执行。而且,本章还要讲述优化mapper和reducer的代码的基本准则和实用规则,以及采用及复用对象实例的技术。

本章将介绍以下内容:

使用Combiner 的好处;

使用压缩技术的重要性;

学习正确使用Writable 类型;

如何明智地复用类型;

如何优化mapper和reducer的代码。

6.1 使用Combiner

通过使用Combiner可以使MapReduce整体性能得到提升。Combiner等同于本地Reduce操作,可以有效提升全局Reduce操作效率。Combiner可以从根本上优化和最小化键值对的数量,而键值对是通过网络在mapper和reducer之间传输的。Combiner使用Map操作处理键值对输出的中间结果,并不影响map和reduce函数中编写的转换逻辑。

习惯上,把reducer函数当作Combiner是使用Combiner的标准方式。计算逻辑应该符合交换律(运算次序不影响运算结果,如加法)和结合律(应用加法运算的次序不影响结果)。

figure_0083_0061

要了解更多关于交换律和结合律属性的信息,可以浏览以下链接:

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
Python3.0科学计算指南

Python3.0科学计算指南

Posts & Telecom Press, Claus Führer, Jan Erik Solem, Olivier Verdier
自然语言处理与计算语言学

自然语言处理与计算语言学

Posts & Telecom Press, Bhargav Srinivasa-Desikan
高性能Spark

高性能Spark

Holden Karau, Rachel Warren

Publisher Resources

ISBN: 9781836204510