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

Review request for mesos and Benjamin Mahler.


Repository: mesos


Description
-------

When check resources contains logic, there wil be logic of subtracting
the resources which is being checked. But this is not a must if the
resources is not a persistent volume as the non persistent volume
resources will be merged by default.

This fix is adding persistent volume check before subtrat resources,
so that the non persistent volume resources will not be subtracted.


Diffs
-----

  src/common/resources.cpp 2470c0280db7d48d9484c42bc2150e53e7ce6e1c 
  src/v1/resources.cpp 6c4e3b299e701d477947dd7427c31d2ae64c05ae 

Diff: https://reviews.apache.org/r/50878/diff/


Testing
-------

make
make check

The test result is that sorter benchmark improved 40%+ when `unallocated` 
resources, the resources benchmark test improved 40%+ when checking contain for 
`scalar` and `shared` resources.

Sorter benchmark test before fix:
```
./bin/mesos-tests.sh --benchmark  
--gtest_filter="*Sorter_BENCHMARK_Test.FullSort/35"
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from AgentAndClientCount/Sorter_BENCHMARK_Test
[ RUN      ] AgentAndClientCount/Sorter_BENCHMARK_Test.FullSort/35
Using 50000 agents and 1000 clients
Added 1000 clients in 24290us
Added 50000 agents in 1.483639secs
Added allocations for 50000 agents in 5.007551secs
Full sort of 1000 clients took 33151us
No-op sort of 1000 clients took 351us
Removed allocations for 50000 agents in 5.56734748333333mins
Removed 50000 agents in 2.050195secs
Removed 1000 clients in 19310us
[       OK ] AgentAndClientCount/Sorter_BENCHMARK_Test.FullSort/35 (342673 ms)
[----------] 1 test from AgentAndClientCount/Sorter_BENCHMARK_Test (342673 ms 
total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (342697 ms total)
[  PASSED  ] 1 test.
```

Sorter benchmark test after fix:
```
./bin/mesos-tests.sh --benchmark  
--gtest_filter="*Sorter_BENCHMARK_Test.FullSort/35"
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from AgentAndClientCount/Sorter_BENCHMARK_Test
[ RUN      ] AgentAndClientCount/Sorter_BENCHMARK_Test.FullSort/35
Using 50000 agents and 1000 clients
Added 1000 clients in 20536us
Added 50000 agents in 1.592772secs
Added allocations for 50000 agents in 5.257316secs
Full sort of 1000 clients took 35049us
No-op sort of 1000 clients took 349us
Removed allocations for 50000 agents in 3.25236376666667mins
Removed 50000 agents in 1.835446secs
Removed 1000 clients in 19347us
[       OK ] AgentAndClientCount/Sorter_BENCHMARK_Test.FullSort/35 (203915 ms)
[----------] 1 test from AgentAndClientCount/Sorter_BENCHMARK_Test (203916 ms 
total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (203941 ms total)
[  PASSED  ] 1 test.

```

Apply patch https://reviews.apache.org/r/50551/

Resources benchmark test before fix:
```
./bin/mesos-tests.sh --benchmark  
--gtest_filter="*Resources_BENCHMARK_Test.Contains/*”
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/0
Took 867642us to perform 50000 'initial.contains(r)' operations on cpus(*):1; 
gpus(*):1; mem(*):128; disk(*):256 with initial resources cpus(*):1; gpus(*):1; 
mem(*):128; disk(*):256
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/0 (870 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/1
Took 28.222642secs to perform 10 'initial.contains(r)' operations on cpus(0, 
principal_0, {key_0: value_0}):1; gpus(... with initial resources cpus(0, 
principal_0, {key_0: value_0}):1; gpus(...
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/1 (28280 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/2
Took 480321us to perform 1000 'initial.contains(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.Contains/2 (481 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/3
Took 1.133279secs to perform 50000 'initial.contains(r)' operations on 
cpus(*):1; mem(*):128; disk(test)[persistentId:... with initial resources 
cpus(*):1; mem(*):128; disk(test)[persistentId:...
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/3 (1134 ms)
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test (30765 ms 
total)

[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (30791 ms total)
[  PASSED  ] 4 tests.
```

Resources benchmark test after fix:
```
./bin/mesos-tests.sh --benchmark  
--gtest_filter="*Resources_BENCHMARK_Test.Contains/*”
[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/0
Took 578234us to perform 50000 'initial.contains(r)' operations on cpus(*):1; 
gpus(*):1; mem(*):128; disk(*):256 with initial resources cpus(*):1; gpus(*):1; 
mem(*):128; disk(*):256
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/0 (578 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/1
Took 30.010717secs to perform 10 'initial.contains(r)' operations on cpus(0, 
principal_0, {key_0: value_0}):1; gpus(... with initial resources cpus(0, 
principal_0, {key_0: value_0}):1; gpus(...
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/1 (30069 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/2
Took 492528us to perform 1000 'initial.contains(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.Contains/2 (493 ms)
[ RUN      ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/3
Took 785835us to perform 50000 'initial.contains(r)' operations on cpus(*):1; 
mem(*):128; disk(test)[persistentId:... with initial resources cpus(*):1; 
mem(*):128; disk(test)[persistentId:...
[       OK ] ResourcesOperators/Resources_BENCHMARK_Test.Contains/3 (786 ms)
[----------] 4 tests from ResourcesOperators/Resources_BENCHMARK_Test (31926 ms 
total)

[----------] Global test environment tear-down
[==========] 4 tests from 1 test case ran. (31948 ms total)
[  PASSED  ] 4 tests.
```


Thanks,

Guangya Liu

Reply via email to