mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 68808: Avoided dirtying the DRF sorter when an allocation is performed.
Date Thu, 27 Sep 2018 00:49:08 GMT


> On Sept. 26, 2018, 8:43 p.m., Meng Zhu wrote:
> > src/master/allocator/sorter/drf/sorter.cpp
> > Lines 365-369 (patched)
> > <https://reviews.apache.org/r/68808/diff/1/?file=2091850#file2091850line365>
> >
> >     I think we can just work with iterators. It will be more generic and readable.
I will leave that to you.
> 
> Meng Zhu wrote:
>     e.g. something like this:
>     
>     ```
>       while (it != children.begin() &&
>              DRFSorter::Node::compareDRF(current, *std::prev(it))) {
>         std::swap(it, std::prev(it));
>         it--;
>       }
>     
>       while (std::next(it) != children.end() &&
>              *std::next(it)->kind != Node::INACTIVE_LEAF &&
>              DRFSorter::Node::compareDRF(*std::next(it), current)) {
>         std::swap(it, std::next(it));
>         it++;
>       }
>     ```
>     
>     This could be more generic if we want to change the container type to say list.

Sounds good, I'll update per your suggestion!

(Per offline conversation, we need to de-reference in std::swap or use iter_swap).


> On Sept. 26, 2018, 8:43 p.m., Meng Zhu wrote:
> > src/master/allocator/sorter/drf/sorter.cpp
> > Lines 349-352 (original), 371-391 (patched)
> > <https://reviews.apache.org/r/68808/diff/1/?file=2091850#file2091850line371>
> >
> >     How about:
> >     
> >     ```
> >       while (position > 0 &&
> >              DRFSorter::Node::compareDRF(current, children[position - 1])) {
> >         std::swap(children[position], children[position - 1]);
> >         --position;
> >       }
> >     
> >       while (position + 1 < children.size() &&
> >              children[position + 1]->kind != Node::INACTIVE_LEAF &&
> >              DRFSorter::Node::compareDRF(children[position + 1], current)) {
> >         std::swap(children[position], children[position + 1]);
> >         ++position;
> >       }
> >     ```

Yeah that seems nicer, thank you!


- Benjamin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/68808/#review209041
-----------------------------------------------------------


On Sept. 25, 2018, 2:23 a.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/68808/
> -----------------------------------------------------------
> 
> (Updated Sept. 25, 2018, 2:23 a.m.)
> 
> 
> Review request for mesos, Gastón Kleiman and Meng Zhu.
> 
> 
> Bugs: MESOS-9249
>     https://issues.apache.org/jira/browse/MESOS-9249
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This improves performance by ensuring that the DRF sorter can remain
> sorted throughout an allocation cycle. Without this change, we spend
> the majority of time re-sorting throughout an allocation cycle, when
> there are large numbers of clients (roles / frameworks).
> 
> Before with --enable-optimize:
> 
> *HierarchicalAllocator_BENCHMARK_Test.DeclineOffers/21
> Added 1000 frameworks in 28.685387ms
> Added 10000 agents in 3.962511243secs
> round 0 allocate() took 3.183115931secs to make 10000 offers ...
> round 1 allocate() took 3.398068093secs to make 10000 offers ...
> round 2 allocate() took 3.314738469secs to make 10000 offers ...
> 
> After with --enable-optimize:
> 
> *HierarchicalAllocator_BENCHMARK_Test.DeclineOffers/21
> Added 1000 frameworks in 38.145091ms
> Added 10000 agents in 1.791872685secs
> round 0 allocate() took 1.193577545secs to make 10000 offers ...
> round 1 allocate() took 1.288540671secs to make 10000 offers ...
> round 2 allocate() took 1.169376468secs to make 10000 offers ...
> 
> 
> Diffs
> -----
> 
>   src/master/allocator/sorter/drf/sorter.cpp a45f66ff0d77becb6f96f7ff4c288e4ab218e070

> 
> 
> Diff: https://reviews.apache.org/r/68808/diff/1/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message