[ 
https://issues.apache.org/jira/browse/MESOS-6200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lei Xu updated MESOS-6200:
--------------------------
    Description: 
The Docker executor maybe could support soft/hard resource limit to enable more 
flexible resources sharing among the applications.

||  || CPU || Memory ||
| hard limit| --cpu-period & --cpu-quota | --memory & --memory-swap|
| soft limit| --cpu-shares | --memory-reservation|

And now the task protobuf message has only one resource struct that used to 
describe the cgroup limit, and the docker executor handle is like the following:

{code}
  if (resources.isSome()) {
    // TODO(yifan): Support other resources (e.g. disk).
    Option<double> cpus = resources.get().cpus();
    if (cpus.isSome()) {
      uint64_t cpuShare =
        std::max((uint64_t) (CPU_SHARES_PER_CPU * cpus.get()), MIN_CPU_SHARES);
      argv.push_back("--cpu-shares");
      argv.push_back(stringify(cpuShare));
    }

    Option<Bytes> mem = resources.get().mem();
    if (mem.isSome()) {
      Bytes memLimit = std::max(mem.get(), MIN_MEMORY);
      argv.push_back("--memory");
      argv.push_back(stringify(memLimit.bytes()));
    }
  }
{code}

I hope that the executor and the protobuf message could separate the resource 
to the two parts: soft and hard. Then the user could set 2 levels resource 
limits for the docker.

  was:
The Docker executor maybe could support soft/hard resource limit to enable more 
flexible resources sharing among the applications.

||  || CPU || Memory ||
| hard limit| --cpu-shares| --memory & --memory-swap|
| soft limit| --cpu-period & --cpu-quota | --memory-reservation|

And now the task protobuf message has only one resource struct that used to 
describe the cgroup limit, and the docker executor handle is like the following:

{code}
  if (resources.isSome()) {
    // TODO(yifan): Support other resources (e.g. disk).
    Option<double> cpus = resources.get().cpus();
    if (cpus.isSome()) {
      uint64_t cpuShare =
        std::max((uint64_t) (CPU_SHARES_PER_CPU * cpus.get()), MIN_CPU_SHARES);
      argv.push_back("--cpu-shares");
      argv.push_back(stringify(cpuShare));
    }

    Option<Bytes> mem = resources.get().mem();
    if (mem.isSome()) {
      Bytes memLimit = std::max(mem.get(), MIN_MEMORY);
      argv.push_back("--memory");
      argv.push_back(stringify(memLimit.bytes()));
    }
  }
{code}

I hope that the executor and the protobuf message could separate the resource 
to the two parts: soft and hard. Then the user could set 2 levels resource 
limits for the docker.


> Hope mesos support soft and hard cpu/memory resource in the task
> ----------------------------------------------------------------
>
>                 Key: MESOS-6200
>                 URL: https://issues.apache.org/jira/browse/MESOS-6200
>             Project: Mesos
>          Issue Type: Improvement
>          Components: cgroups, containerization, docker, scheduler api
>    Affects Versions: 0.28.2
>         Environment: CentOS 7 
> Kernel 3.10.0-327.28.3.el7.x86_64
> Mesos 0.28.2
> Docker 1.11.2
>            Reporter: Lei Xu
>
> The Docker executor maybe could support soft/hard resource limit to enable 
> more flexible resources sharing among the applications.
> ||  || CPU || Memory ||
> | hard limit| --cpu-period & --cpu-quota | --memory & --memory-swap|
> | soft limit| --cpu-shares | --memory-reservation|
> And now the task protobuf message has only one resource struct that used to 
> describe the cgroup limit, and the docker executor handle is like the 
> following:
> {code}
>   if (resources.isSome()) {
>     // TODO(yifan): Support other resources (e.g. disk).
>     Option<double> cpus = resources.get().cpus();
>     if (cpus.isSome()) {
>       uint64_t cpuShare =
>         std::max((uint64_t) (CPU_SHARES_PER_CPU * cpus.get()), 
> MIN_CPU_SHARES);
>       argv.push_back("--cpu-shares");
>       argv.push_back(stringify(cpuShare));
>     }
>     Option<Bytes> mem = resources.get().mem();
>     if (mem.isSome()) {
>       Bytes memLimit = std::max(mem.get(), MIN_MEMORY);
>       argv.push_back("--memory");
>       argv.push_back(stringify(memLimit.bytes()));
>     }
>   }
> {code}
> I hope that the executor and the protobuf message could separate the resource 
> to the two parts: soft and hard. Then the user could set 2 levels resource 
> limits for the docker.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to