Attributes and their importance:
1) cpu:
a. Mesos uses this value to limit the number of tasks executed on a worker node. A new task will be executed only if cpu requested < total cpu available (as per calculations of mesos and mesos is not fetching this info from actual cpu utilization on the target worker in any way). Every time a new task is executed mesos will keep subtracting the cpu requested from the total cpu number which it maintains locally(and we see the same stats on mesos UI).
b. Along with that the cpu value is translated to Docker’s “--cpu-shares” attribute and hence dictates how much of CPU time is available to that container. Overall it’s just a relative weight attached to container process.
c. Docker does have runtime attributes as “--cpu-quota” which can be used to limit the cpu utilization by containers however mesos doesn’t have the feature to control that right now.
e.g.
Container A with 0.1 and container B with 0.2 cpu-share just means that if both of them are to consume 100% of CPU then A will get 33% of CPU time and B will get 66% of CPU time.
2) Memory:
a. Same as in case of cpu, memory attribute passed via marathon is used by mesos to calculate the free resources on the worker nodes for spinning new tasks.
b. Along with that the memory value from marathon->mesos gets translated to Docker’s “--memory” attribute which defines the upper limit of memory the container can utilize. If it crosses that then it’ll be killed by the Docker daemon.