Search code examples
distributeddistributed-computingmesosmesosphere

How to stop mesos from offering resources to a framework?


I have a use case where I have 20-30 frameworks runnings on mesos cluster that has over 200 nodes. A lot of the times mesos is offering resources to frameworks that do not want any offers at all. While doing that, it is offering little resources to frameworks that actually need them.

I know there's a function requestResources that a framework can call to ask for resources. However, I couldn't find a function that a framework can use to tell mesos to stop sending it any offers. Is there a way of doing that? Because my frameworks keep getting offers every 100 milliseconds, which is way fast!


Solution

  • When you declineOffer, you can set an optional Filter with refuse_seconds longer than the default 5s. This will mean that after you decline an offer from a node, that Mesos will not offer these resources back to your framework for refuse_seconds.

    Alternatively, if your framework temporarily doesn't want any offers from any nodes, it can call driver.stop(true), and the scheduler will unregister from Mesos but its tasks will keep running for FrameworkInfo.failover_timeout. Once the framework has work to do, it can start/run the driver again to start getting offers again.

    (FYI, requestResources doesn't actually do anything yet.)