HubSpot/Singularity

what does cpu in resources requested in a deploy mean

cabecada opened this issue · 2 comments

this is not an issue as such, but has never cleared me what it means.

when i deploy a task requesting 0.1 cpu, or 1 cpu (on a 8 core machine) what really happens?
the task only gets 0.1 of the 8 cpu? but if the task goes bork, it may utilize all the 8 cpu? or get killed?

i have read https://zcox.wordpress.com/2014/09/17/cpu-resources-in-docker-mesos-and-marathon/
it talks about cpu weight etc.

also when i have a deploy requesting for 3 cpu on a 8 core machine, does it check if the mesos slave has 3 cpu available? or else it will not get deployed?
or is it that if there are two requests of 2 cpu and 3 cpu, 3 cpu task will have "more weight" and will be deployed first ?

sorry for lack of clarity in my queries, but i hope you understand what i am trying to ask?

https://github.com/HubSpot/Singularity/blob/master/Docs/about/requests-and-deploys.md

tl;dr It depends what flags you have on your mesos slave/agent.

In terms of scheduling, you are correct. If one task requesting 3 cpus gets placed on a host with 8, then a task requesting 6 would no longer be able to be placed there because there aren't enough.

In terms of the limits, it depends what isolators you have turned on. If you are using the cgroups cpu isolator for example, it depends on the mesos slave cgroups_enable_cfs flag. If that flag is set, then cpu is a hard limit, and the app will be throttled. It won't be killed, it just will not have access to additional cpu cycles. If that flag is not set, the app is given its requested 'shares' of cpu, but can burst over that, dipping into a more shared pool of cpu. This article has some good examples laid out of cpu sharing in cgroups

thanks Steven. appreciate your quick response.
This is helpful, but i guess i'll have to use stress tool with the mesos flags options to be more confident of the expectation :)