This is an automated email from the ASF dual-hosted git repository.

mzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new d13be84  Randomized the agents in the second allocation stage.
d13be84 is described below

commit d13be8432180d3b64947a320fa0c11340dba029a
Author: Meng Zhu <[email protected]>
AuthorDate: Wed May 8 16:58:02 2019 -0700

    Randomized the agents in the second allocation stage.
    
    Before this patch, agents are randomized before the 1st
    allocation stage (the quota allocation stage) but not in
    the 2nd stage. One perceived issue is that resources on
    the agents in the front of the queue are likely to be mostly
    allocated in the 1st stage, leaving only slices of resources
    available for the second stage. Thus we may see consistently
    low quality offers for role/frameworks that get allocated first
    in the 2nd stage.
    
    This patch randomizes the agents again before the 2nd stage to
    to "spread out" the effect of the 1st stage allocation.
    
    Review: https://reviews.apache.org/r/70613
---
 src/master/allocator/mesos/hierarchical.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/master/allocator/mesos/hierarchical.cpp 
b/src/master/allocator/mesos/hierarchical.cpp
index 64a076d..708c444 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -2005,6 +2005,11 @@ void HierarchicalAllocatorProcess::__allocate()
   // are not part of the headroom (and therefore can't be used to satisfy
   // quota guarantees).
 
+  // We randomize the agents here to "spread out" the effect of the first
+  // stage, which tends to allocate from the front of the agent list more
+  // so than the back.
+  std::random_shuffle(slaveIds.begin(), slaveIds.end());
+
   foreach (const SlaveID& slaveId, slaveIds) {
     CHECK(slaves.contains(slaveId));
     Slave& slave = slaves.at(slaveId);

Reply via email to