-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/51034/
-----------------------------------------------------------
Review request for mesos and Benjamin Mahler.
Repository: mesos
Description
-------
The `roles::validate` is time consuming and it was called by
`Resources::validate`, the `Resources::validate` was called
frequently when add/subtract `Resource` object.
This patch is avoiding the `roles::validate` for star role as
there is no need to validate such role.
Diffs
-----
src/common/resources.cpp 6b7af9179121efbdc5c29484eb042778bcea8288
src/v1/resources.cpp 03ee0cb0bb5abe7fc1ae4cb47c5b6dbcd8d11998
Diff: https://reviews.apache.org/r/51034/diff/
Testing
-------
make
make check
Before fix:
```
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/0
Took 44396us to perform 50000 'validate(r)' operations on cpus(*):1; gpus(*):1; mem(*):128;
disk(*):256
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/0 (45 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/1
Took 10034us to perform 10 'validate(r)' operations on cpus(0, principal_0, {key_0: value_0}):1;
gpus(...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/1 (25 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/2
Took 2.825012secs to perform 1000 'validate(r)' operations on ports(*):[1-2, 4-5, 7-8, 10-11,
13-14, 16-17, 1...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/2 (2825 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/3
Took 39538us to perform 50000 'validate(r)' operations on cpus(*):1; mem(*):128; disk(test)[persistentId:...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/3 (40 ms)
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test (2935 ms total)
[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (2944 ms total)
[ PASSED ] 4 tests.
```
After fix:
```
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/0
Took 18079us to perform 50000 'validate(r)' operations on cpus(*):1; gpus(*):1; mem(*):128;
disk(*):256
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/0 (21 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/1
Took 9943us to perform 10 'validate(r)' operations on cpus(0, principal_0, {key_0: value_0}):1;
gpus(...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/1 (22 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/2
Took 2.585535secs to perform 1000 'validate(r)' operations on ports(*):[1-2, 4-5, 7-8, 10-11,
13-14, 16-17, 1...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/2 (2586 ms)
[ RUN ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/3
Took 24314us to perform 50000 'validate(r)' operations on cpus(*):1; mem(*):128; disk(test)[persistentId:...
[ OK ] ResourcesOperators/Resources_BENCHMARK_Test.Validations/3 (25 ms)
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test (2654 ms total)
[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (2666 ms total)
[ PASSED ] 4 tests.
```
Thanks,
Guangya Liu
|