You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Guangya Liu (JIRA)" <ji...@apache.org> on 2016/07/26 08:21:20 UTC
[jira] [Comment Edited] (MESOS-5700) Benchmark for Resource class
(protobuf vs. C++)
[ https://issues.apache.org/jira/browse/MESOS-5700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15393410#comment-15393410 ]
Guangya Liu edited comment on MESOS-5700 at 7/26/16 8:20 AM:
-------------------------------------------------------------
Did some test for how does {{addable}} and {{subtractable}} contribute to resources benchmark test, the result is that {{those two validations does not cost much time and we can ignore it}}. cc [~bmahler] [~klaus1982]
Test steps are as following:
1) Checkout two source code copies: mesos-1 and mesos-2, apply patch https://reviews.apache.org/r/50380/ for both copies.
2) Update code in mesos-1 by removing both {{addable}} and {{subtractable}} for resources {{+=}} and {{-=}}. Code diff is as following:
{code}
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 3dbff24..d770e98 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -227,6 +227,7 @@ bool operator!=(const Resource& left, const Resource& right)
namespace internal {
+#if 0
// Tests if we can add two Resource objects together resulting in one
// valid Resource object. For example, two Resource objects with
// different name, type or role are not addable.
@@ -277,6 +278,7 @@ static bool addable(const Resource& left, const Resource& right)
return true;
}
+#endif
// Tests if we can subtract "right" from "left" resulting in one valid
@@ -1381,11 +1383,9 @@ void Resources::add(const Resource& that)
bool found = false;
foreach (Resource& resource, resources) {
- if (internal::addable(resource, that)) {
resource += that;
found = true;
break;
- }
}
// Cannot be combined with any existing Resource object.
@@ -1439,7 +1439,6 @@ void Resources::subtract(const Resource& that)
for (int i = 0; i < resources.size(); i++) {
Resource* resource = resources.Mutable(i);
- if (internal::subtractable(*resource, that)) {
*resource -= that;
// Remove the resource if it becomes invalid or zero. We need
@@ -1455,7 +1454,6 @@ void Resources::subtract(const Resource& that)
}
break;
- }
}
}
{code}
3) Build those two copies and run benchmark test {{ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2}}.
Test result without validation for both {{addable}} and {{subtractable}}
{code}
[==========] 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.833678secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.656634secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.012337secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.650337secs 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 (13155 ms)
[----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (13155 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (13174 ms total)
[ PASSED ] 1 test.
{code}
Test result with validation for both {{addable}} and {{subtractable}}
{code}
[==========] 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.707476secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.49798secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 2.911038secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.692435secs 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 (12811 ms)
[----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (12811 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (12830 ms total)
[ PASSED ] 1 test.
{code}
Please refer to https://docs.google.com/document/d/1D5qqkEh28vnS-2j3F1K8liYS8ThtSjeLJ4AvogIoxjk/edit?ts=57971af2# for more detail of the diagram of {{valgrind --tool=callgrind}}.
was (Author: gyliu):
Did some test for how does {{addable}} and {{subtractable}} contribute to resources benchmark test, the result is that {{those two validations does not cost much time and we can ignore it}}. cc [~bmahler] [~klaus1982]
Test steps are as following:
1) Checkout two source code copies: mesos-1 and mesos-2, apply patch https://reviews.apache.org/r/50380/ for both copies.
2) Update code in mesos-1 by removing both {{addable}} and {{subtractable}} for resources {{+=}} and {{-=}}. Code diff is as following:
{code}
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index 3dbff24..d770e98 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -227,6 +227,7 @@ bool operator!=(const Resource& left, const Resource& right)
namespace internal {
+#if 0
// Tests if we can add two Resource objects together resulting in one
// valid Resource object. For example, two Resource objects with
// different name, type or role are not addable.
@@ -277,6 +278,7 @@ static bool addable(const Resource& left, const Resource& right)
return true;
}
+#endif
// Tests if we can subtract "right" from "left" resulting in one valid
@@ -1381,11 +1383,9 @@ void Resources::add(const Resource& that)
bool found = false;
foreach (Resource& resource, resources) {
- if (internal::addable(resource, that)) {
resource += that;
found = true;
break;
- }
}
// Cannot be combined with any existing Resource object.
@@ -1439,7 +1439,6 @@ void Resources::subtract(const Resource& that)
for (int i = 0; i < resources.size(); i++) {
Resource* resource = resources.Mutable(i);
- if (internal::subtractable(*resource, that)) {
*resource -= that;
// Remove the resource if it becomes invalid or zero. We need
@@ -1455,7 +1454,6 @@ void Resources::subtract(const Resource& that)
}
{code}
3) Build those two copies and run benchmark test {{ResourcesOperators/Resources_BENCHMARK_Test.Arithmetic/2}}.
Test result without validation for both {{addable}} and {{subtractable}}
{code}
[==========] 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.833678secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.656634secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.012337secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.650337secs 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 (13155 ms)
[----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (13155 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (13174 ms total)
[ PASSED ] 1 test.
{code}
Test result with validation for both {{addable}} and {{subtractable}}
{code}
[==========] 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.707476secs to perform 1000 'total += r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.49798secs to perform 1000 'total -= r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 2.911038secs to perform 1000 'total = total + r' operations on ports(*):[1-2, 4-5, 7-8, 10-11, 13-14, 16-17, 1...
Took 3.692435secs 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 (12811 ms)
[----------] 1 test from ResourcesOperators/Resources_BENCHMARK_Test (12811 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (12830 ms total)
[ PASSED ] 1 test.
{code}
Please refer to https://docs.google.com/document/d/1D5qqkEh28vnS-2j3F1K8liYS8ThtSjeLJ4AvogIoxjk/edit?ts=57971af2# for more detail of the diagram of {{valgrind --tool=callgrind}}.
> Benchmark for Resource class (protobuf vs. C++)
> -----------------------------------------------
>
> Key: MESOS-5700
> URL: https://issues.apache.org/jira/browse/MESOS-5700
> Project: Mesos
> Issue Type: Bug
> Reporter: Klaus Ma
> Assignee: Klaus Ma
> Attachments: hashmap.diff, name_roleId.diff, port.perf.log, reservation.perf.log
>
>
> Add benchmark of Resource class for Allocation Performance.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)