mesos / cloudfoundry-mesos

Cloud Foundry on Mesos Framework
Apache License 2.0
107 stars 26 forks source link

Translating Diego Resource to Mesos Resource #1

Open ilackarms opened 8 years ago

ilackarms commented 8 years ago

There's no clear translation between Diego's concept of a Resource, and Mesos' concept of a resource: https://github.com/mesos/cloudfoundry-mesos/blob/85dcd8228b8c70ef802cbb4ab0acb804bb35a73a/scheduler/scheduler_interface.go#L9

We should look into ways to determine the CPU requirement of a Diego task and the Container Capacity of a Mesos Resource Offer.

jianhuiz commented 8 years ago

Diego calculates CPU weights based on app memory usage (256MB~8192MB => 1~100).

In order to mimic this situation, a possible solution could be allocate the CPU at the same proportion of the memory required vs. memory Offered. E.g. allocate 0.5 CPU for a app that requires 1GB memory against an offer with 4 CPUs and 8GB memory, as a result this app gets 1/8 of CPUs and 1/8 of memory. A second app that requires 2GB memory will get 1 CPU, or let's say 0.5 CPU per GB memory.

In Mesos environment, the resource could be used by other frameworks, which means the free CPU Memory ratio will change, in order to get a fairness CPU allocation for all the Diego apps (on the same slave), the CPU allocation per GB memory should be calculated and remain constant when the first task was launched on a slave.