-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50380/
-----------------------------------------------------------
(Updated 八月 5, 2016, 2:32 a.m.)
Review request for mesos, Benjamin Mahler and Klaus Ma.
Changes
-------
Rebase with shared resources.
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 (updated)
-----
src/tests/resources_tests.cpp e61bdeffd5114ab481903c1178d9ecb3452ec85b
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
|