You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mesos.apache.org by Andrew Ortman <an...@impossibleventures.com> on 2014/11/24 07:14:32 UTC

CFS for Docker Containers running on Mesos?

Hi all!

I’ve been toying around this evening with CPU resource isolation in Mesos - specifically with the Docker Containerizer.

It seems the Docker Containerizer (via experimentation and peeking at the source) modifies the relative CPU weight for the docker containers running on the slave in order to isolate the container's CPU usage. This of course isn’t a hard limit, and allows services to burst up to the full resources of the slave as long as no other tasks are consuming resources running on that server. It looks like the cpu isolator for the Mesos containerizer already has support for cgroup/cpu isolation and even an ability to enable CFS support via the command line flag —cgroups_enable_cfs. When I enable this flag, the Docker Containerizer doesn’t seem to use it at all or pass it onto the container at all. After googling, I came across this post: https://groups.google.com/forum/#!topic/docker-user/UF0GxTp3NHI where Hamilton was able to set the the relevant cgroup parameters to the docker daemon in order to provide a hard CPU limit on a running docker container.

I’m fairly new to Mesos - so I apologize if something obvious is flying right over my head :-) Does anyone have any advice / suggestions / thoughts on achieving such a hard CPU cap for docker containers running on Mesos? This isn’t a blocker for me - I am purely curious

Thanks!


Re: CFS for Docker Containers running on Mesos?

Posted by Andrew Ortman <an...@impossibleventures.com>.
Hi Tim - thanks - that helps out a lot

I went ahead and created the ticket MESOS-2154. It also like Marathon will support passing those LXC parameters in the 0.7.6 release (https://github.com/mesosphere/marathon/issues/747) which I believe is coming up very soon

Andrew

On Nov 24, 2014, at 1:56 AM, Tim Chen <ti...@mesosphere.io>> wrote:

Hi Andrew,

The Docker containerizer right now simply calls the docker cli cpu and memory parameters and let the Docker daemon set the cgroup shares accordingly, allow we do go behind the docker daemon to perform updates on the share amount.

We didn't port the existing Mesos containerizer CFS support into the Docker containerizer as it wasn't something we did at v1, and can be integrated into Docker containerizer as well. If you like to see this feature please add a ticket in JIRA about this.

The work around for now is to perform exactly what you saw in the docker user forum, since from 0.21.0 we support passing arbitrary key/value params to Docker containerizer you can also launch docker daemon with lxc backend and pass the cfs params as part of your docker task launch.

Let me know if you have any more questions,

Tim

On Sun, Nov 23, 2014 at 10:14 PM, Andrew Ortman <an...@impossibleventures.com>> wrote:
Hi all!

I’ve been toying around this evening with CPU resource isolation in Mesos - specifically with the Docker Containerizer.

It seems the Docker Containerizer (via experimentation and peeking at the source) modifies the relative CPU weight for the docker containers running on the slave in order to isolate the container's CPU usage. This of course isn’t a hard limit, and allows services to burst up to the full resources of the slave as long as no other tasks are consuming resources running on that server. It looks like the cpu isolator for the Mesos containerizer already has support for cgroup/cpu isolation and even an ability to enable CFS support via the command line flag —cgroups_enable_cfs. When I enable this flag, the Docker Containerizer doesn’t seem to use it at all or pass it onto the container at all. After googling, I came across this post: https://groups.google.com/forum/#!topic/docker-user/UF0GxTp3NHI where Hamilton was able to set the the relevant cgroup parameters to the docker daemon in order to provide a hard CPU limit on a running docker container.

I’m fairly new to Mesos - so I apologize if something obvious is flying right over my head :-) Does anyone have any advice / suggestions / thoughts on achieving such a hard CPU cap for docker containers running on Mesos? This isn’t a blocker for me - I am purely curious

Thanks!




Re: CFS for Docker Containers running on Mesos?

Posted by Tim Chen <ti...@mesosphere.io>.
Hi Andrew,

The Docker containerizer right now simply calls the docker cli cpu and
memory parameters and let the Docker daemon set the cgroup shares
accordingly, allow we do go behind the docker daemon to perform updates on
the share amount.

We didn't port the existing Mesos containerizer CFS support into the Docker
containerizer as it wasn't something we did at v1, and can be integrated
into Docker containerizer as well. If you like to see this feature please
add a ticket in JIRA about this.

The work around for now is to perform exactly what you saw in the docker
user forum, since from 0.21.0 we support passing arbitrary key/value params
to Docker containerizer you can also launch docker daemon with lxc backend
and pass the cfs params as part of your docker task launch.

Let me know if you have any more questions,

Tim

On Sun, Nov 23, 2014 at 10:14 PM, Andrew Ortman <
andrew@impossibleventures.com> wrote:

>  Hi all!
>
>  I’ve been toying around this evening with CPU resource isolation in
> Mesos - specifically with the Docker Containerizer.
>
>  It seems the Docker Containerizer (via experimentation and peeking at
> the source) modifies the relative CPU weight for the docker containers
> running on the slave in order to isolate the container's CPU usage. This of
> course isn’t a hard limit, and allows services to burst up to the full
> resources of the slave as long as no other tasks are consuming resources
> running on that server. It looks like the cpu isolator for the Mesos
> containerizer already has support for cgroup/cpu isolation and even an
> ability to enable CFS support via the command line flag
> —cgroups_enable_cfs. When I enable this flag, the Docker Containerizer
> doesn’t seem to use it at all or pass it onto the container at all. After
> googling, I came across this post:
> https://groups.google.com/forum/#!topic/docker-user/UF0GxTp3NHI where
> Hamilton was able to set the the relevant cgroup parameters to the docker
> daemon in order to provide a hard CPU limit on a running docker container.
>
>  I’m fairly new to Mesos - so I apologize if something obvious is flying
> right over my head :-) Does anyone have any advice / suggestions / thoughts
> on achieving such a hard CPU cap for docker containers running on Mesos?
> This isn’t a blocker for me - I am purely curious
>
>  Thanks!
>
>