获取 Yarn 应用程序的内存、CPU 和磁盘使用情况

Get the memory, CPU and disk usage for Yarn application

我想问一下在我 运行 一个 Yarn 应用程序之后,如何获得该应用程序的总内存和 CPU 使用情况。

我曾经使用资源管理器UI来获取所有信息。 但是除了从 UI 获取这些信息之外,还有什么 我可以用来获取信息的命令。

使用yarn application -status命令,您可以获得应用程序的Aggregate Resource Allocation

例如当我键入 yarn application -status application_1452267331813_0009(对于我完成的申请之一)时,返回的行之一是:

Aggregate Resource Allocation : 46641 MB-seconds, 37 vcore-seconds

这会在几秒钟内给出聚合内存和 CPU 分配。您可以查看此答案:,以了解此输出的含义。

除此之外,截至目前,没有其他内存或 CPU 相关指标通过 CLI 公开。

命令 yarn top 给出了应用程序级别的资源利用率和经过的 运行 时间。

查看此线程以了解将输出通过管道传输到文件的方法

--帮助信息:

usage: yarn top

-cols Number of columns on the terminal

-delay The refresh delay(in seconds), default is 3 seconds

-help Print usage; for help while the tool is running press 'h' + Enter

-queues Comma separated list of queues to restrict applications

-rows Number of rows on the terminal

-types Comma separated list of types to restrict applications, case sensitive(though the display is lower case)

-users Comma separated list of users to restrict applications

'yarn top' is a tool to help cluster administrators understand cluster usage better. Some notes about the implementation:

  1. Fetching information for all the apps is an expensive call for the RM. To prevent a performance degradation, the results are cached for 5 seconds, irrespective of the delay value. Information about the NodeManager(s) and queue utilization stats are fetched at the specified delay interval. Once we have a better understanding of the performance impact, this might change.

  2. Since the tool is implemented in Java, you must hit Enter for key presses to be processed.