Search code examples
mesosmesosphere

Why does mesos report more allocated CPUs than actual cores?


I'm working with some servers that have 32 cores in them (That's including hyperthreading). However, when I look at the details for the framework for the node, I've seen several that report more than 32 allocated CPUs. Why is that?

Edit 1:

Looking at one of the nodes, /proc/cpuinfo lists the correct number of CPUs. The only framework registered with this node is Marathon and that's where I see the overallocation of CPUs (via the Mesos UI). Mesos does report I have 32 CPUs.


Solution

  • As code comment says it's possible to have more allocated CPUs then actually system has. Framework is accepting offer that need to fit into resources constraints but then slave add some non zero resources for executor. So same could happen with MEM.

    // Default cpu resource given to a command executor.
    constexpr double DEFAULT_EXECUTOR_CPUS = 0.1;
    // Default memory resource given to a command executor.
    constexpr Bytes DEFAULT_EXECUTOR_MEM = Megabytes(32);
    ...
    // Add an allowance for the command executor. This does lead to a
    // small overcommit of resources.
    // TODO(vinod): If a task is using revocable resources, mark the
    // corresponding executor resource (e.g., cpus) to be also
    // revocable. Currently, it is OK because the containerizer is
    // given task + executor resources on task launch resulting in
    // the container being correctly marked as revocable.
    executor.mutable_resources()->MergeFrom(
        Resources::parse(
          "cpus:" + stringify(DEFAULT_EXECUTOR_CPUS) + ";" +
          "mem:" + stringify(DEFAULT_EXECUTOR_MEM.megabytes())).get());
    

    WebUI shows values taken from master/metrics endpoint and values there are calculated form Executor not just tasks.