专栏名称: About云
about云-为热爱云开发技术人员提供最全面的信息传播和服务平台
目录
相关文章推荐
内蒙古市场监管  ·  你点我检 放心“宵”费 ·  昨天  
内蒙古市场监管  ·  你点我检 放心“宵”费 ·  昨天  
安天集团  ·  大年初八丨安天拓痕给您拜年了 ·  3 天前  
福州新闻网  ·  公开遴选!福州市委网信办发布最新公告! ·  3 天前  
今靖江  ·  热搜第一!微信又上新功能 ·  3 天前  
今靖江  ·  热搜第一!微信又上新功能 ·  3 天前  
51好读  ›  专栏  ›  About云

扩展Yarn资源模型详解1

About云  · 公众号  ·  · 2018-01-15 16:07

正文


问题导读

1.countable资源是指哪些?
2.noncountable资源,本文列举了什么资源?
3.标签是否为资源?
4.如何实现扩展YARN资源模型?



转载注明来自about云
本文链接:

http://www.aboutyun.com/forum.php?mod=viewthread&tid=23794

概述
当前Yarn支持各种资源类型:比如:
disk( YARN2139),https://issues.apache.org/jira/browse/yarn-2139
network( YARN2140), https://issues.apache.org/jira/browse/YARN-2140
和HDFS bandwidth( YARN2681).https://issues.apache.org/jira/browse/YARN-2681

本文档提出了将YARN资源模型扩展为更加灵活的模型,使其更容易添加新的countable类型的资源。它还考虑了“resource profiles”的相关方面,这些资源配置文件允许用户容易地指定它们需要的容器资源。当添加对新资源类型的支持时,有两个方面需要考虑调度和隔离。 本文档仅涉及调度方面。

背景

在YARN中添加一个新的countable资源类型是一个相当复杂的过程。 需要进行大量的工作来修改ProtocolBuffers文件以及相应的Java源代码。 这必须通过修改 DominantResourceCalculator类添加对新资源类型的支持。 另外,许多不相关的测试用例都必须修改,因为他们使用了esource.newInstance(memory,,vcores))函数。此外,大多数新的资源类型被视为相同,只是名称不同而已。 总而言之,需要修改37个源文件来增加对新磁盘资源类型的支持;而对于未来的资源类型,类似的(可能更大的)将不得不进行修改,而且大部分更改将与之前的更改相同, 唯一的区别是变量的名称。
我们建议更改资源模型以支持可由群集管理员定义的任意、countable资源。 当我们谈到countable资源时,我们指的是资源的分配和释放是一个简单的减法和加法操作的资源类型。 我们不会在此版本的文档中涵盖专用资源,如端口【ports】或不可数量【noncountable】的资源(如标签)。 然而,我们的建议并没有排除增加对标签等资源类型的支持,这种工作可以作为未来工作的一部分来进行。

扩展YARN资源模型

ResourceManager
在我们提出的模型中,我们添加一个新的配置文件“resourcetypes.xml“,管理员可以使用它来添加新的资源类型。 ResourceManager(RM)“resource-types.xml”来确定启用调度的资源类型集合。 这些配置可以在yarn-site.xml配置,但是在一个单独的文件中指定它们可能会更清晰。 资源配置文件必须包含内存和vcore作为资源类型以防止功能的任何损失。 管理员可以添加任意新的资源类型,只要他们代表的资源是countable。

resource-types.xml样例如下

[XML] 纯文本查看 复制代码

?

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
< configuration >
< property >
< name >yarn.scheduler.resourcetypes name >
< value >memory,cpu value >
property >
< property >
< name >yarn.scheduler.resourcetypes.memory.name name >
< value >yarn.io/memory value >
property >
< property >
< name >yarn.scheduler.resourcetypes.memory.units name >
< value >MB value >
property >
< property >
< name >yarn.scheduler.resourcetypes.memory.type name >
< value >countable value >
property >
< property >
< name >yarn.scheduler.resourcetypes.memory.enabled name >
< value >true value >
property >
< property >
< name >yarn.scheduler.resourcetypes.cpu.name name >
< value >yarn.io/cpu value >
property >
< property >
< name >yarn.scheduler.resourcetypes.cpu.units name >
< value >vcores value >
property >
< property >
< name >yarn.scheduler.resourcetypes.cpu.type name >
< value >countable value >
property >
< property >
< name >yarn.scheduler.resourcetypes.cpu.enabled name >
< value >true value >
property >
< configuration >


“yarn.io/memory”和“yarn.io/cpu”映射到YARN当前支持的现有内存和vcore资源类型。 资源名称与Kubernetes资源模型中的资源名称相似(链接位于参考部分)。

NodeManager
类似的,我们建议添加一个新的文件“nodere-sources.xml“,来指定节点的资源使用量。跟“resource-type.xml”类似,这些配置可以在yarn-site.xml文件中设置。但是在单独的文件中指定它们可能会更清晰。

下面是node-resources.xml样例

[XML] 纯文本查看 复制代码

?

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
< configuration >
< property >
< name >yarn.nodemanager.resourcetypes name >
< value >memory,cpu value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.memory.name name >
< value >yarn.io/memory value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.memory.units name >
< value >MB value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.memory.type name >
< value >countable value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.memory.available name >
< value >32 value >
< property >
< name >yarn.nodemanager.resourcetypes.cpu name >
< value >yarn.io/cpu value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.cpu.units name >
< value >vcores value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.cpu.type name >
< value >countable value >
property >
< property >
< name >yarn.nodemanager.resourcetypes.cpu.available name >
< value >8 value >
property >
< configuration >


NodeStatusUpdaterImpl类将被修改为报告“noderesources.xml”文件中指定的所有资源的值,而不仅仅是当前的内存和CPU

Resource类和DominantResourceCalculator
建议在Yarn的资源模型添加新的函数。

[Bash shell] 纯文本查看 复制代码

?

1
2
public static Resource newInstance(Map
resources)


弃用

[Bash shell] 纯文本查看 复制代码

?

1
public static Resource newInstance(int memory, int vcores)


ResourceTypeInformation类的定义是:

[Bash shell] 纯文本查看 复制代码

?

1
2
3
4
5
6
public class ResourceTypeInformation {






请到「今天看啥」查看全文