-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50380/
-----------------------------------------------------------
(Updated 十月 6, 2016, 2:56 p.m.)
Review request for mesos, Benjamin Mahler, Klaus Ma, and Jiang Yan Xu.
Summary (updated)
-----------------
Added new benchmark test for port resources.
Bugs: MESOS-5898
https://issues.apache.org/jira/browse/MESOS-5898
Repository: mesos
Description (updated)
-------
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 benchmark test for ports resources, using
a initial and a different delta resource to make sure the ports
resources will never be subtracted to 0.
Diffs (updated)
-----
src/tests/resources_tests.cpp 3e493007d6d1d8194d07035aaa1cde28dedf2b5a
Diff: https://reviews.apache.org/r/50380/diff/
Testing (updated)
-------
make
make check
```
./bin/mesos-tests.sh --benchmark
--gtest_filter="*Resources_Scalar_BENCHMARK_Test.Arithmetic/*"
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test
[ RUN ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/0
Took 56358us to perform 50000 'total += r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
Took 61269us to perform 50000 'total -= r' operations on cpus(*):1; gpus(*):1;
mem(*):128; disk(*):256
Took 244070us to perform 50000 'total = total + r' operations on cpus(*):1;
gpus(*):1; mem(*):128; disk(*):256
Took 269567us to perform 50000 'total = total - r' operations on cpus(*):1;
gpus(*):1; mem(*):128; disk(*):256
[ OK ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/0 (632 ms)
[ RUN ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/1
Took 4.557034secs to perform 10 'total += r' operations on cpus(0, principal_0,
{key_0: value_0}):1; gpus(...
Took 4.883114secs to perform 10 'total -= r' operations on cpus(0, principal_0,
{key_0: value_0}):1; gpus(...
Took 4.721756secs to perform 10 'total = total + r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
Took 4.961495secs to perform 10 'total = total - r' operations on cpus(0,
principal_0, {key_0: value_0}):1; gpus(...
[ OK ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/1 (19174 ms)
[ RUN ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/2
Took 45381us to perform 50000 'total += r' operations on cpus(*):1; mem(*):128;
disk(test)[persistentId:...
Took 44780us to perform 50000 'total -= r' operations on cpus(*):1; mem(*):128;
disk(test)[persistentId:...
Took 275496us to perform 50000 'total = total + r' operations on cpus(*):1;
mem(*):128; disk(test)[persistentId:...
Took 286105us to perform 50000 'total = total - r' operations on cpus(*):1;
mem(*):128; disk(test)[persistentId:...
[ OK ]
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test.Arithmetic/2 (652 ms)
[----------] 3 tests from
ResourcesScalarOperators/Resources_Scalar_BENCHMARK_Test (20458 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (20467 ms total)
[ PASSED ] 3 tests.
```
```
./bin/mesos-tests.sh --benchmark
--gtest_filter="Resources_Ports_BENCHMARK_Test.Arithmetic"
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Resources_Ports_BENCHMARK_Test
[ RUN ] Resources_Ports_BENCHMARK_Test.Arithmetic
Took 2.295047secs to perform 5000 'total += r' operations on ports(*):[1-2,
4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources ports(*):[1001-3000]
Took 4.873829secs to perform 5000 'total -= r' operations on ports(*):[1-2,
4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources ports(*):[1001-3000]
Took 2.80647secs to perform 5000 'total = total + r' operations on
ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources
ports(*):[1001-3000]
Took 5.119215secs to perform 5000 'total = total - r' operations on
ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1... with initial resources
ports(*):[1001-3000]
[ OK ] Resources_Ports_BENCHMARK_Test.Arithmetic (15102 ms)
[----------] 1 test from Resources_Ports_BENCHMARK_Test (15102 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (15112 ms total)
[ PASSED ] 1 test.
```
Thanks,
Guangya Liu