本文介绍了在mesos中查找活动框架当前的资源使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个 HTTP端点将帮助我找到所有活动框架的当前资源利用率?

Which HTTP endpoint will help me to find all the active frameworks current resource utilization?

我们想要这些信息是因为我们想动态扩展Mesos集群,并且我们的算法需要有关每个活动框架正在使用哪些资源的信息.

We want this information because we want to dynamically scale Mesos cluster and our algorithm needs information regarding what resources each active framework is using.

推荐答案

我认为专注于框架并不是您真正想要的.您所追求的可能是Mesos Slave利用率,可以通过调用来请求

I think to focus on the frameworks is not really what you would want to to. What you're after is probably the Mesos Slave utilization, which can be requested via calling

http://{mesos-master}:5050/master/state-summary

在JSON答案中,您将找到一个slaves属性,其中包含一个从属对象数组:

In the JSON answer, you'll find a slaves property which contains an array of slave objects:

{
    "hostname": "192.168.0.3",
    "cluster": "mesos-hw-cluster",
    "slaves": [{
        "id": "bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-S2",
        "pid": "slave(1)@192.168.0.1:5051",
        "hostname": "192.168.0.1",
        "registered_time": 1456826950.99075,
        "resources": {
            "cpus": 12.0,
            "disk": 1840852.0,
            "mem": 63304.0,
            "ports": "[31000-32000]"
        },
        "used_resources": {
            "cpus": 5.75,
            "disk": 0.0,
            "mem": 14376.0,
            "ports": "[31000-31000, 31109-31109, 31267-31267, 31699-31699, 31717-31717, 31907-31907, 31979-31980]"
        },
        "offered_resources": {
            "cpus": 0.0,
            "disk": 0.0,
            "mem": 0.0
        },
        "reserved_resources": {},
        "unreserved_resources": {
            "cpus": 12.0,
            "disk": 1840852.0,
            "mem": 63304.0,
            "ports": "[31000-32000]"
        },
        "attributes": {},
        "active": true,
        "version": "0.27.1",
        "TASK_STAGING": 0,
        "TASK_STARTING": 0,
        "TASK_RUNNING": 7,
        "TASK_FINISHED": 18,
        "TASK_KILLED": 27,
        "TASK_FAILED": 3,
        "TASK_LOST": 0,
        "TASK_ERROR": 0,
        "framework_ids": ["bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-0000", "bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-0002"]
    },
    ...
}

您可以遍历所有从属对象,并通过汇总resources来计算总体资源使用量,然后减去used_resources的摘要.

You could iterate over all the slave objects and calculate the overall ressource usage by summarizing the resources and then subtract the summary of the used_resources.

请参见

  • http://mesos.apache.org/documentation/latest/endpoints/master/state-summary/
  • http://mesos.apache.org/documentation/latest/endpoints/

这篇关于在mesos中查找活动框架当前的资源使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 23:17