I think you misunderstand. I'm not looking to change the container resource 
allocation, I'm looking to have the program in the container make adjustments 
(changing static buffer allocations based on memory limits or adjusting the 
number of threads based on cpu allocation). But I need a way to communicate the 
resource limits to the app in the container.



________________________________
From: haosdent [[email protected]]
Sent: Wednesday, September 23, 2015 10:56 AM
To: [email protected]
Subject: RE: how does resource allocation work with docker?


 >Is there a way for a process in the docker container to determine how many 
 >cpus it has been allocated?
Because docker limit the resource before start the container, I think there 
isn't a way to change container resource usage after it has already run. You 
only could allocate resource before launch a container so far.

On Sep 23, 2015 10:31 PM, "Clarke, Trevor" 
<[email protected]<mailto:[email protected]>> wrote:

That's just the scheduler...I did locate the appropriate docker run call and it 
appears that mesos cpu offer * 1024 is used as the cpu share so there's no hard 
enforcement of total cpus but the scheduler block is scaled to the number of 
requested cpus. It also appears there's no way to determine the cpu share from 
within docker without explicitly passing an environment variable, etc.

________________________________
From: Guangya Liu [[email protected]<mailto:[email protected]>]
Sent: Wednesday, September 23, 2015 9:41 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: how does resource allocation work with docker?

Hi Clarke,

You can take a look at the framework for docker here 
https://github.com/apache/mesos/blob/master/src/examples/docker_no_executor_framework.cpp<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_apache_mesos_blob_master_src_examples_docker-5Fno-5Fexecutor-5Fframework.cpp&d=AwMFaQ&c=jF7FvYH6t0RX1HrEjVCgHQ&r=BZAdW7eZ7BA-TVm8CsncxQ&m=myFl_koVz_iyPrvAE5EQBW4Cmn4ocS6C5KCd07WzvjA&s=PWUrWtXV7HgaC4GxJ0HstRpy_b9dqvCptTljtTzQrx0&e=>

All of the resource limitations for a docker task should be defined in the 
framework.

Thanks,

Guangya

On Wed, Sep 23, 2015 at 9:33 PM, Clarke, Trevor 
<[email protected]<mailto:[email protected]>> wrote:
When a framework accepts an offer and starts a docker task, how does mesos 
enforce the task's allocated cpus? Is CPU share used and scaled appropriately? 
Are cpu sets explicitly specified to limit execution to the allocated cpus? Is 
there a way for a process in the docker container to determine how many cpus it 
has been allocated? (so it can adjust fan-out size, etc. for optimal execution)


This message and any enclosures are intended only for the addressee. Please
notify the sender by email if you are not the intended recipient. If you are
not the intended recipient, you may not use, copy, disclose, or distribute this
message or its contents or enclosures to any other person and any such actions
may be unlawful. Ball reserves the right to monitor and review all messages
and enclosures sent to or from this email address.



This message and any enclosures are intended only for the addressee. Please
notify the sender by email if you are not the intended recipient. If you are
not the intended recipient, you may not use, copy, disclose, or distribute this
message or its contents or enclosures to any other person and any such actions
may be unlawful. Ball reserves the right to monitor and review all messages
and enclosures sent to or from this email address.



This message and any enclosures are intended only for the addressee.  Please 
notify the sender by email if you are not the intended recipient.  If you are 
not the intended recipient, you may not use, copy, disclose, or distribute this 
message or its contents or enclosures to any other person and any such actions 
may be unlawful.  Ball reserves the right to monitor and review all messages 
and enclosures sent to or from this email address.

Reply via email to