> 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.
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? - Guangya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50380/#review144175 ----------------------------------------------------------- On 七月 25, 2016, 1:43 p.m., Guangya Liu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/50380/ > ----------------------------------------------------------- > > (Updated 七月 25, 2016, 1:43 p.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 default `ports` resources to 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: > ``` > ./bin/mesos-tests.sh --benchmark > --gtest_filter="*Resources_BENCHMARK_Test.Arithmetic/2" > [==========] Running 1 test from 1 test case. > [----------] Global test environment set-up. > [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test > [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 > Took 3.042796secs to perform 1000 'total += r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 10026us to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, > 7-8, 10-11, 13-14, 16-17, 1... > Took 3.193982secs to perform 1000 'total = total + r' operations on > ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 9142us 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 (6258 > ms) > [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (6258 ms > total) > > [----------] Global test environment tear-down > [==========] 1 test from 1 test case ran. (6278 ms total) > [ PASSED ] 1 test. > ``` > > After fix: > ``` > ./bin/mesos-tests.sh --benchmark > --gtest_filter="*Resources_BENCHMARK_Test.Arithmetic/2" > [==========] Running 1 test from 1 test case. > [----------] Global test environment set-up. > [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test > [ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2 > Took 2.624597secs to perform 1000 'total += r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 3.592067secs to perform 1000 'total -= r' operations on ports(*):[1-2, > 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 2.909614secs to perform 1000 'total = total + r' operations on > ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... > Took 3.369582secs 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 (12501 > ms) > [----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (12501 > ms total) > > [----------] Global test environment tear-down > [==========] 1 test from 1 test case ran. (12518 ms total) > [ PASSED ] 1 test. > ``` > > > Thanks, > > Guangya Liu > >