[Hadoop]Hadoop上Data Locality

Hadoop上的Data Locality是指数据与Mapper任务运行时数据的距离接近程度(Data Locality in Hadoop refers to the“proximity” of the data with respect to the Mapper tasks working on the data.

1. why data locality is imporant?

当数据集存储在HDFS中时,它被划分为块并存储在Hadoop集群中的DataNode上。当在数据集执行MapReduce作业时,各个Mappers将处理这些块(输进行入分片处理)。如果Mapper不能从它执行的节点上获取数据,数据需要通过网络从具有这些数据的DataNode拷贝到执行Mapper任务的节点上(the data needs to be copied over the network from the DataNode which has the data to the DataNode which is executing the Mapper task)。假设一个MapReduce作业具有超过1000个Mapper,在同一时间每一个Mapper都试着去从集群上另一个DataNode节点上拷贝数据,这将导致严重的网络阻塞,因为所有的Mapper都尝试在同一时间拷贝数据(这不是一种理想的方法)。因此,将计算任务移动到更接近数据的节点上是一种更有效与廉价的方法,相比于将数据移动到更接近计算任务的节点上(it is always effective and cheap to move the computation closer to the data than to move the data closer to the computation)。

2. How is data proximity defined?

当JobTracker(MRv1)或ApplicationMaster(MRv2)接收到运行作业的请求时,它查看集群中的哪些节点有足够的资源来执行该作业的Mappers和Reducers。同时需要根据Mapper运行数据所处位置来考虑决定每个Mapper执行的节点(serious consideration is made to decide on which nodes the individual Mappers will be executed based on where the data for the Mapper is located)。

3. Data Local

当数据所处的节点与Mapper执行的节点是同一节点,我们称之为Data Local。在这种情况下,数据的接近度更接近计算( In this case the proximity of the data is closer to the computation.)。JobTracker(MRv1)或ApplicationMaster(MRv2)首选具有Mapper所需要数据的节点来执行Mapper。

4. Rack Local

虽然Data Local是理想的选择,但由于受限于集群上的资源,并不总是在与数据同一节点上执行Mapper(Although Data Local is the ideal choice, it is not always possible to execute the Mapper on the same node as the data due to resource constraints on a busy cluster)。在这种情况下,优选地选择在那些与数据节点在同一机架上的不同节点上运行Mapper( In such instances it is preferred to run the Mapper on a different node but on the same rack as the node which has the data.)。在这种情况下,数据将在节点之间进行移动,从具有数据的节点移动到在同一机架上执行Mapper的节点,这种情况我们称之为Rack Local。

5. Different Rack

在繁忙的群集中,有时Rack Local也不可能。在这种情况下,选择不同机架上的节点来执行Mapper,并且将数据从具有数据的节点复制到在不同机架上执行Mapper的节点。这是最不可取的情况。

  



优秀的个人博客,低调大师

微信关注我们

原文链接:https://yq.aliyun.com/articles/632209

转载内容版权归作者及来源网站所有!

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

相关文章

发表评论

资源下载

更多资源
Mario,低调大师唯一一个Java游戏作品

Mario,低调大师唯一一个Java游戏作品

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Oracle Database,又名Oracle RDBMS

Oracle Database,又名Oracle RDBMS

Oracle Database,又名Oracle RDBMS,或简称Oracle。是甲骨文公司的一款关系数据库管理系统。它是在数据库领域一直处于领先地位的产品。可以说Oracle数据库系统是目前世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小、微机环境。它是一种高效率、可靠性好的、适应高吞吐量的数据库方案。

Java Development Kit(Java开发工具)

Java Development Kit(Java开发工具)

JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。

Sublime Text 一个代码编辑器

Sublime Text 一个代码编辑器

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。