You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/07/18 19:19:16 UTC

mesos git commit: Added more timing output for allocator benchmark tests.

Repository: mesos
Updated Branches:
  refs/heads/master 7cb67544d -> cfe3e1f55


Added more timing output for allocator benchmark tests.

This patch is adding elapsed time for addFramework, addSlave
and setQuota in allocator benchmark tests, adding these elapsed
time can help evaluate the performnace of these APIs.

Review: https://reviews.apache.org/r/50117/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cfe3e1f5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cfe3e1f5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cfe3e1f5

Branch: refs/heads/master
Commit: cfe3e1f55fa925e53883ce9293d100a491b55d59
Parents: 7cb6754
Author: Guangya Liu <gy...@gmail.com>
Authored: Mon Jul 18 12:13:58 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Mon Jul 18 12:13:58 2016 -0700

----------------------------------------------------------------------
 src/tests/hierarchical_allocator_tests.cpp | 68 +++++++++++++++++++++++--
 1 file changed, 63 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/cfe3e1f5/src/tests/hierarchical_allocator_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/hierarchical_allocator_tests.cpp b/src/tests/hierarchical_allocator_tests.cpp
index acdd15a..65c3fe6 100644
--- a/src/tests/hierarchical_allocator_tests.cpp
+++ b/src/tests/hierarchical_allocator_tests.cpp
@@ -3435,17 +3435,30 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, DeclineOffers)
 
   initialize(flags, offerCallback);
 
+  Stopwatch watch;
+  watch.start();
+
   for (unsigned i = 0; i < frameworkCount; i++) {
     frameworks.push_back(createFrameworkInfo("*"));
     allocator->addFramework(frameworks[i].id(), frameworks[i], {});
   }
 
+  // Wait for all the `addFramework` operations to be processed.
+  Clock::settle();
+
+  watch.stop();
+
+  cout << "Added " << frameworkCount << " frameworks in "
+       << watch.elapsed() << endl;
+
   Resources resources = Resources::parse(
       "cpus:16;mem:2014;disk:1024").get();
 
   Resources ports = makePortRanges(makeRange(31000, 32000), 16);
   resources += ports;
 
+  watch.start();
+
   for (unsigned i = 0; i < slaveCount; i++) {
     slaves.push_back(createSlaveInfo(
         "cpus:24;mem:4096;disk:4096;ports:[31000-32000]"));
@@ -3461,6 +3474,11 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, DeclineOffers)
   // Wait for all the `addSlave` operations to be processed.
   Clock::settle();
 
+  watch.stop();
+
+  cout << "Added " << slaveCount << " agents in "
+       << watch.elapsed() << endl;
+
   // Loop enough times for all the frameworks to get offered all the resources.
   for (unsigned i = 0; i < frameworkCount * 2; i++) {
     // Permanently decline any offered resources.
@@ -3476,8 +3494,6 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, DeclineOffers)
     Clock::settle();
     offers.clear();
 
-    Stopwatch watch;
-
     watch.start();
 
     // Advance the clock and trigger a background allocation cycle.
@@ -3568,11 +3584,22 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels)
 
   initialize(flags, offerCallback);
 
+  Stopwatch watch;
+  watch.start();
+
   for (unsigned i = 0; i < frameworkCount; i++) {
     frameworks.push_back(createFrameworkInfo("role1"));
     allocator->addFramework(frameworks[i].id(), frameworks[i], {});
   }
 
+  // Wait for all the `addFramework` operations to be processed.
+  Clock::settle();
+
+  watch.stop();
+
+  cout << "Added " << frameworkCount << " frameworks in "
+       << watch.elapsed() << endl;
+
   // Create the used resources at each slave. We use three blocks of
   // resources: unreserved mem/disk/ports, and two different labeled
   // reservations with distinct labels. We choose the labels so that
@@ -3585,6 +3612,8 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels)
   Resources ports = makePortRanges(makeRange(31000, 32000), 16);
   resources += ports;
 
+  watch.start();
+
   for (unsigned i = 0; i < slaveCount; i++) {
     slaves.push_back(createSlaveInfo(
         "cpus:24;mem:4096;disk:4096;ports:[31000-32000]"));
@@ -3615,6 +3644,11 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels)
   // Wait for all the `addSlave` operations to be processed.
   Clock::settle();
 
+  watch.stop();
+
+  cout << "Added " << slaveCount << " agents in "
+       << watch.elapsed() << endl;
+
   // Loop enough times for all the frameworks to get offered all the resources.
   for (unsigned i = 0; i < frameworkCount * 2; i++) {
     // Permanently decline any offered resources.
@@ -3630,8 +3664,6 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, ResourceLabels)
     Clock::settle();
     offers.clear();
 
-    Stopwatch watch;
-
     watch.start();
 
     // Advance the clock and trigger a background allocation cycle.
@@ -3663,16 +3695,39 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, Metrics)
 
   initialize();
 
+  Stopwatch watch;
+  watch.start();
+
   for (size_t i = 0; i < frameworkCount; i++) {
     string role = stringify(i);
     allocator->setQuota(role, createQuota(role, "cpus:1;mem:512;disk:256"));
   }
 
+  // Wait for all the `setQuota` operations to be processed.
+  Clock::settle();
+
+  watch.stop();
+
+  cout << "Set quota for " << frameworkCount << " roles in "
+       << watch.elapsed() << endl;
+
+  watch.start();
+
   for (size_t i = 0; i < frameworkCount; i++) {
     FrameworkInfo framework = createFrameworkInfo(stringify(i));
     allocator->addFramework(framework.id(), framework, {});
   }
 
+  // Wait for all the `addFramework` operations to be processed.
+  Clock::settle();
+
+  watch.stop();
+
+  cout << "Added " << frameworkCount << " frameworks in "
+       << watch.elapsed() << endl;
+
+  watch.start();
+
   for (size_t i = 0; i < slaveCount; i++) {
     SlaveInfo slave = createSlaveInfo("cpus:16;mem:2048;disk:1024");
     allocator->addSlave(slave.id(), slave, None(), slave.resources(), {});
@@ -3681,7 +3736,10 @@ TEST_P(HierarchicalAllocator_BENCHMARK_Test, Metrics)
   // Wait for all the `addSlave` operations to complete.
   Clock::settle();
 
-  Stopwatch watch;
+  watch.stop();
+
+  cout << "Added " << slaveCount << " agents in "
+       << watch.elapsed() << endl;
 
   // TODO(bmahler): Avoid timing the JSON parsing here.
   // Ideally we also avoid timing the HTTP layer.