> On July 6, 2016, 6:24 p.m., Jiang Yan Xu wrote:
> > src/tests/hierarchical_allocator_tests.cpp, line 3629
> > <https://reviews.apache.org/r/49617/diff/1/?file=1436562#file1436562line3629>
> >
> >     Looks like our test doesn't use `offerCount` at all?
> >     
> >     If we keep `offerCount` we can log how many total offers are generated 
> > at the end of the test. It's not an essential metric but I guess it would 
> > be nice to confirm.

Yes this is why I kept it here, I was using it while debugging. I'll add it as 
a metric at the end.


> On July 6, 2016, 6:24 p.m., Jiang Yan Xu wrote:
> > src/tests/hierarchical_allocator_tests.cpp, line 3704
> > <https://reviews.apache.org/r/49617/diff/1/?file=1436562#file1436562line3704>
> >
> >     Use `std::lround`?
> >     
> >     This math here would be equivalent but it would be nice if we don't 
> > have to explain it. :)

So lround rounds down I want to do a std::ceil without having to cast the 
double. For instance 103 frameworks, I want batches of 21 rather than 20. Also 
for the case of frameworkCount=1 lround will give me batch size 0 and I get an 
infinite loop.


> On July 6, 2016, 6:24 p.m., Jiang Yan Xu wrote:
> > src/tests/hierarchical_allocator_tests.cpp, line 3708
> > <https://reviews.apache.org/r/49617/diff/1/?file=1436562#file1436562line3708>
> >
> >     Single space around `+=`.
> >     
> >     More importantly, will this exclude the frameworks numbered after the 
> > last "full-sized" batch? i.e., framework 5-8 if frameworkCount == 9?
> >     
> >     I suggest we restructure the loop as described below.

I overlooked this, but we will want:

for (unsigned i = batchStart; i < batchEnd && i < frameworkCount; i++) with the 
above comment for the ceiling. so in the case of 103 frameworks I hit 84 with a 
batchend of 105 and I'll terminate both inner loops at i < 103.


> On July 6, 2016, 6:24 p.m., Jiang Yan Xu wrote:
> > src/tests/hierarchical_allocator_tests.cpp, lines 3711-3725
> > <https://reviews.apache.org/r/49617/diff/1/?file=1436562#file1436562line3711>
> >
> >     1. We should recover resources after the whole batch is finished and 
> > not after each `activateFramework` is called, as this is often the case in 
> > realistic scenarios.
> >     2. If we don't `settle()` then vector is actually not thread-safe so I 
> > think we need to settle here.
> >     
> >     How about this for the entire loop?
> >     
> >     ```
> >       for (unsigned batchStart = 0;
> >            batchStart < frameworkCount;
> >            batchStart += batchSize) {
> >         unsigned batchEnd = min(batchStart + batchSize, frameworkCount);
> >       
> >         // Activate all frameworks in this batch to trigger allocations.
> >         for (unsigned i = batchStart; i < batchEnd; i++) {
> >           allocator->activateFramework(frameworks[i].id());
> >         }
> >     
> >         // Suppress offers in this batch after all activations. This is
> >         // requires another message round trip between schedulers and the
> >         // master following the activation.
> >         for (unsigned i = batchStart; i < batchEnd; i++) {
> >           allocator->suppressOffers(frameworks[k].id());
> >         }
> >     
> >         // Make sure all resources are offered. This avoids data races in
> >         // the offers vector.
> >         Clock::settle();
> >     
> >         foreach (auto offer, offers) {
> >           allocator->recoverResources(
> >               offer.frameworkId, 
> >               offer.slaveId,
> >               offer.resources, 
> >               None());
> >         }
> >     
> >         offers.clear();
> >       }
> >     ```

added a termination condition  for (unsigned i = batchStart; i < batchEnd && i 
< frameworkCount; i++) {

to account for all frameworkCount cases. 

Also, I recover offers there because only framework 1 of the batch will get an 
offer, so we will get 1005 offers for the whole of a test run with 1000 agents 
the 5 being the 5 batches of activate/suppress. What do you think?


- Jacob


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


On July 8, 2016, 1:06 a.m., Jacob Janco wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49617/
> -----------------------------------------------------------
> 
> (Updated July 8, 2016, 1:06 a.m.)
> 
> 
> Review request for mesos, Joris Van Remoortere and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-5780
>     https://issues.apache.org/jira/browse/MESOS-5780
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> - This benchmark measures latency to stability of
>   the allocator following disconnection and
>   reconnection of all frameworks.
> - In this scenario, frameworks are offered resources
>   and suppressed in batches.
> 
> 
> Diffs
> -----
> 
>   src/tests/hierarchical_allocator_tests.cpp 
> 0498cd5e54b0e4b87a767585a77699653aa52179 
> 
> Diff: https://reviews.apache.org/r/49617/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Jacob Janco
> 
>

Reply via email to