> On 七月 29, 2016, 8:35 p.m., Benjamin Mahler wrote: > > src/tests/resources_tests.cpp, lines 2515-2523 > > <https://reviews.apache.org/r/50380/diff/1/?file=1451856#file1451856line2515> > > > > Can we make the initial resources another parameter? I believe Klaus > > took this approach initially but I had removed 'initial' to simplify the > > patch. > > > > If we make it a parameter we can have initial ports only for the port > > test case. > > Guangya Liu wrote: > Hi Ben, one quick question want to get some comments from you. Regarding > to your comments, what about set `initial` resources for all resources types > including `scalar`, `range`, `reservations` and then for the new added > `contain` benchmark test, I can simply check if the `initial` contains > `resources`, what do you think of this approach? > > Benjamin Mahler wrote: > For the contains test, how about we start with three parameters: (a, b, > numContains) > > Then we do `a.contains(b)` numContains times and `b.contains(a)` > numContains times? > > Guangya Liu wrote: > So do you mean that I need to introduce some new parameters for > `contains` benchmark test as following? > > ``` > struct Parameter > { > Resources resources1; > Resources resources2; > size_t numContains; > }; > ``` > > My thinking is want to levearaget the current parameters and do not > introduce new parameters: > ``` > struct Parameter > { > Resources initial; > Resources resources; > size_t totalOperations; > }; > ``` > > Then I will do `initial.contains(resources)` and > `resources.contains(initial)` for `totalOperations` times. > > For `Filters` or `Filtering` test, I will do `resources.nonRevocable()` > for `totalOperations` times. > > What do you think?
Ben, any comments for this, this will impact how we implement the benchmark test for both `contains` and `filter`, thanks. - Guangya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50380/#review144175 ----------------------------------------------------------- On 七月 30, 2016, 9:10 a.m., Guangya Liu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/50380/ > ----------------------------------------------------------- > > (Updated 七月 30, 2016, 9:10 a.m.) > > > Review request for mesos, Benjamin Mahler and Klaus Ma. > > > Bugs: MESOS-5898 > https://issues.apache.org/jira/browse/MESOS-5898 > > > Repository: mesos > > > Description > ------- > > When run benchmark test for `ports` resources, the `-=` and `-` only > consumed about 10ms, this cannot reflect the real time of operating > 1000 `ports` with `-=` and `-`. > > The root cause is that the current calculation is always using same > port range, with port, the formula for `+` is `a+a+a+a+...+a==a`; > for `-`, it will be `a-a=0` and `0-a=0`. > > With `0-a=0`, the code here > https://github.com/apache/mesos/blob/master/src/common/values.cpp#L544 > will cause there is no validation as the `left` is empty after the > `ports` was subtracted to 0. > > The fix is adding a new parameter `inital` act as the intial resources > for differente benchmark test. For `ports` resource, using an initial > `ports` which is different from the `resources`, this can make sure > the`ports` resources will never be subtracted to 0. > > > Diffs > ----- > > src/tests/resources_tests.cpp 4111e080b84079e100b731c9a56861b204f17388 > > Diff: https://reviews.apache.org/r/50380/diff/ > > > Testing > ------- > > make > make check > > Before fix: > ``` > [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 > Took 2.844742secs to perform 1000 'total += r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 9ms to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, > 10-11, 13-14, 16-17, 1... > Took 2.977936secs to perform 1000 'total = total + r' operations on > ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 9576us to perform 1000 'total = total - r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... > [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (5843 > ms) > [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (5843 ms > total) > ``` > > After fix: > ``` > [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 > Took 2.728995secs to perform 1000 'total += r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources > ports(*):[30000-50000] > Took 3.641868secs to perform 1000 'total -= r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources > ports(*):[30000-50000] > Took 2.957178secs to perform 1000 'total = total + r' operations on > ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources > ports(*):[30000-50000] > Took 3.631125secs to perform 1000 'total = total - r' operations on > ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources > ports(*):[30000-50000] > [ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 (12961 > ms) > ``` > > > Thanks, > > Guangya Liu > >