mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guangya Liu <gyliu...@gmail.com>
Subject Review Request 50380: Made resources benchmark test for ports `-=/-` more accurate.
Date Mon, 25 Jul 2016 13:43:19 GMT

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

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message