You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/11/21 19:23:39 UTC
mesos git commit: Improved performance for
`getQuotaRoleAllocatedResources` in allocator.
Repository: mesos
Updated Branches:
refs/heads/master b5c11a2e8 -> 41bd07881
Improved performance for `getQuotaRoleAllocatedResources` in allocator.
In the allocator, `getQuotaRoleAllocatedResources` is trying to omit
dynamic and static reservations, and persistent volumes. But it is
traversing all `Resource` objects from the `Resources` object, strips
the `role` and then using `+=` to add each `Resource` object back.
The `Resources& +=(const Resource&)` operation performs validation of
the `Resource` object which will impact the performance negatively.
This fix is calling `flatten()` directly to strip the `role` for all
of the `Resource` objects and this will not perform validation.
Review: https://reviews.apache.org/r/53929/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/41bd0788
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/41bd0788
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/41bd0788
Branch: refs/heads/master
Commit: 41bd0788109b61aa9430d0ccbef92dd9990619d2
Parents: b5c11a2
Author: Guangya Liu <gy...@gmail.com>
Authored: Mon Nov 21 11:17:58 2016 -0800
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Nov 21 11:17:58 2016 -0800
----------------------------------------------------------------------
src/master/allocator/mesos/hierarchical.cpp | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/41bd0788/src/master/allocator/mesos/hierarchical.cpp
----------------------------------------------------------------------
diff --git a/src/master/allocator/mesos/hierarchical.cpp b/src/master/allocator/mesos/hierarchical.cpp
index c8f9492..3b75949 100644
--- a/src/master/allocator/mesos/hierarchical.cpp
+++ b/src/master/allocator/mesos/hierarchical.cpp
@@ -1355,20 +1355,10 @@ void HierarchicalAllocatorProcess::allocate(
auto getQuotaRoleAllocatedResources = [this](const string& role) {
CHECK(quotas.contains(role));
- // NOTE: `allocationScalarQuantities` omits dynamic reservation and
- // persistent volume info, but we additionally strip `role` here.
- Resources resources;
-
- foreach (Resource resource,
- quotaRoleSorter->allocationScalarQuantities(role)) {
- CHECK(!resource.has_reservation());
- CHECK(!resource.has_disk());
-
- resource.set_role("*");
- resources += resource;
- }
-
- return resources;
+ // NOTE: `allocationScalarQuantities` omits dynamic reservation
+ // and persistent volume info, but we additionally strip `role`
+ // here via `flatten()`.
+ return quotaRoleSorter->allocationScalarQuantities(role).flatten();
};
// Due to the two stages in the allocation algorithm and the nature of