aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject aurora git commit: Add benchmark for progressively filling a cluster.
Date Thu, 17 Nov 2016 23:10:50 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 2992c8b4d -> 203da709d


Add benchmark for progressively filling a cluster.

The existing benchmarks were only exercising the code paths for
mismatching offers but not for successfully launched tasks. This new
benchmark fills this gap.

In addition, this commit changes the default from DBTaskStore to
MemTaskStore for all scheduling benchmarks. Without the switch all
scheduling actions will be dominated by task store operations. This
can (and has in the past) prevent the discovery of performance
regressions.

MemTaskStore (now the default):
SchedulingBenchmarks.FillClusterBenchmark.runBenchmark  thrpt   10 4.912 ± 1.790  ops/s

DBTaskStore (former default):
SchedulingBenchmarks.FillClusterBenchmark.runBenchmark  thrpt   10 0.418 ± 0.076  ops/s

Related bug: AURORA-1802

Reviewed at https://reviews.apache.org/r/53862/


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

Branch: refs/heads/master
Commit: 203da709da1831c4a5ceb6a2cc2833e68bef0394
Parents: 2992c8b
Author: Stephan Erb <serb@apache.org>
Authored: Fri Nov 18 00:10:14 2016 +0100
Committer: Stephan Erb <serb@apache.org>
Committed: Fri Nov 18 00:10:14 2016 +0100

----------------------------------------------------------------------
 .../aurora/benchmark/SchedulingBenchmarks.java  | 46 +++++++++++++++-----
 .../java/org/apache/aurora/benchmark/Tasks.java | 10 ++---
 .../aurora/benchmark/ThriftApiBenchmarks.java   |  1 -
 3 files changed, 37 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/203da709/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java
----------------------------------------------------------------------
diff --git a/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java b/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java
index 0510b89..631b2cf 100644
--- a/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java
+++ b/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java
@@ -106,7 +106,7 @@ public class SchedulingBenchmarks {
      */
     @Setup(Level.Trial)
     public void setUpBenchmark() {
-      storage = DbUtil.createStorage();
+      storage = DbUtil.createFlaggedStorage();
       eventBus = new EventBus();
       final FakeClock clock = new FakeClock();
       clock.setNowMillis(System.currentTimeMillis());
@@ -196,16 +196,10 @@ public class SchedulingBenchmarks {
     private void fillUpCluster(int numOffers) {
       Set<IScheduledTask> tasksToAssign = buildClusterTasks(numOffers);
       saveTasks(tasksToAssign);
-      storage.write((NoResult.Quiet) store -> {
-        for (IScheduledTask scheduledTask : tasksToAssign) {
-          taskScheduler.schedule(
-              store,
-              ImmutableSet.of(scheduledTask.getAssignedTask().getTaskId()));
-        }
-      });
+      schedule(tasksToAssign);
     }
 
-    private void saveTasks(final Set<IScheduledTask> tasks) {
+    protected void saveTasks(final Set<IScheduledTask> tasks) {
       storage.write(
           (NoResult.Quiet) storeProvider -> storeProvider.getUnsafeTaskStore().saveTasks(tasks));
     }
@@ -221,17 +215,20 @@ public class SchedulingBenchmarks {
     protected abstract BenchmarkSettings getSettings();
 
     /**
-     * Benchmark entry point. All settings (e.g. iterations, benchmarkMode and etc.) are
defined
-     * in build.gradle.
+     * Benchmark entry point.
      *
      * @return A "blackhole" to make sure the result is not optimized out.
      * See {@see http://openjdk.java.net/projects/code-tools/jmh/} for more info.
      */
     @Benchmark
     public Set<String> runBenchmark() {
+      return schedule(settings.getTasks());
+    }
+
+    protected Set<String> schedule(Set<IScheduledTask> tasks) {
       return storage.write((Storage.MutateWork.Quiet<Set<String>>) store ->
{
         Set<String> result = null;
-        for (IScheduledTask task : settings.getTasks()) {
+        for (IScheduledTask task : tasks) {
           result = taskScheduler.schedule(
               store,
               ImmutableSet.of(task.getAssignedTask().getTaskId()));
@@ -242,6 +239,31 @@ public class SchedulingBenchmarks {
   }
 
   /**
+   * Tests the successful scheduling of tasks in an almost empty cluster.
+   * The cluster will be filled progressively over benchmark repetitions.
+   */
+  public static class FillClusterBenchmark extends AbstractBase {
+    @Override
+    protected BenchmarkSettings getSettings() {
+      return new BenchmarkSettings.Builder()
+          .setSiblingClusterUtilization(0.01)
+          .setVictimClusterUtilization(0.01)
+          .setHostAttributes(new Hosts.Builder().setNumHostsPerRack(2).build(100000))
+          .setTasks(new Tasks.Builder().build(0))
+          .build();
+    }
+
+    @Override
+    public Set<String> runBenchmark() {
+      // In contrast to the other tests in this file we have to create new tasks for each
+      // benchmark repetition to make sure they can actually be scheduled.
+      Set<IScheduledTask> tasks = new Tasks.Builder().build(10);
+      saveTasks(tasks);
+      return schedule(tasks);
+    }
+  }
+
+  /**
    * Tests scheduling performance with a task vetoed due to insufficient CPU.
    */
   public static class InsufficientResourcesSchedulingBenchmark extends AbstractBase {

http://git-wip-us.apache.org/repos/asf/aurora/blob/203da709/src/jmh/java/org/apache/aurora/benchmark/Tasks.java
----------------------------------------------------------------------
diff --git a/src/jmh/java/org/apache/aurora/benchmark/Tasks.java b/src/jmh/java/org/apache/aurora/benchmark/Tasks.java
index e548a09..3aabc5e 100644
--- a/src/jmh/java/org/apache/aurora/benchmark/Tasks.java
+++ b/src/jmh/java/org/apache/aurora/benchmark/Tasks.java
@@ -51,7 +51,6 @@ final class Tasks {
    */
   static final class Builder {
     private JobKey jobKey = new JobKey("jmh", "dev", "benchmark");
-    private int uuidStart = 0;
     private boolean isProduction = false;
     private double cpu = 6.0;
     private Amount<Long, Data> ram = Amount.of(8L, Data.GB);
@@ -59,6 +58,8 @@ final class Tasks {
     private ScheduleStatus scheduleStatus = ScheduleStatus.PENDING;
     private ImmutableSet.Builder<Constraint> constraints = ImmutableSet.builder();
 
+    private static int uuid = 0;
+
     Builder setRole(String newRole) {
       jobKey.setRole(newRole);
       return this;
@@ -74,11 +75,6 @@ final class Tasks {
       return this;
     }
 
-    Builder setUuidStart(int uuidStart) {
-      this.uuidStart = uuidStart;
-      return this;
-    }
-
     Builder setCpu(double newCpu) {
       cpu = newCpu;
       return this;
@@ -134,7 +130,7 @@ final class Tasks {
 
       for (int i = 0; i < count; i++) {
         String taskId =
-            jobKey.getRole() + "-" + jobKey.getEnvironment() + "-" + i + "-" + (uuidStart
+ i);
+            jobKey.getRole() + "-" + jobKey.getEnvironment() + "-" + i + "-" + uuid++;
 
         ScheduledTask builder = TaskTestUtil.makeTask(taskId, IJobKey.build(jobKey))
             .newBuilder()

http://git-wip-us.apache.org/repos/asf/aurora/blob/203da709/src/jmh/java/org/apache/aurora/benchmark/ThriftApiBenchmarks.java
----------------------------------------------------------------------
diff --git a/src/jmh/java/org/apache/aurora/benchmark/ThriftApiBenchmarks.java b/src/jmh/java/org/apache/aurora/benchmark/ThriftApiBenchmarks.java
index 7497fb9..440c4fc 100644
--- a/src/jmh/java/org/apache/aurora/benchmark/ThriftApiBenchmarks.java
+++ b/src/jmh/java/org/apache/aurora/benchmark/ThriftApiBenchmarks.java
@@ -181,7 +181,6 @@ public class ThriftApiBenchmarks {
                 .setEnv(env)
                 .setJob(job)
                 .setScheduleStatus(ScheduleStatus.FINISHED)
-                .setUuidStart(1)
                 .build(config.deadTasks));
             storeProvider.getUnsafeTaskStore().saveTasks(tasks.build());
           }


Mime
View raw message