I am running my application as a docker container in both Docker Swarm UCP (using compose.yml file) as well as in Mesos (using marathon.json file).
I have added the resource constraints in both the files.
compose.yml:
resources:
limits:
cpus: '0.50'
memory: 50M
reservations:
cpus: '0.25'
memory: 20M
marathon.json:
"cpus": 0.50,
"mem": 128.0,
"disk": 5.0
What I found out is memory is the hard limit and cpu is the soft limit. i.e. cpu limit is only for weight and priority. If mesos cpu is 1 and if two applications are running one with 0.4 cpu and the other with 0.6 cpu then app one will get 40% of the cpu cycles and app two will get 60% of the cpu cycles.
Then what is the use of limit and reservation in compose.yml file here?
Now I am trying to understand below things
How does this resource constraints work exactly?
What happens when the container exceeds these values?