Repository: aurora Updated Branches: refs/heads/master 44ab4c5db -> 05f082a1c
Make scheduling benchmarks more realistic. This patch aims to strike a better balance between available offers, already launched tasks, and tasks to be scheduled. Specifically, it ensures that we only measure scheduling of tasks for which instances of the same job are already running (e.g. as needed by limit constraints). The following setup is now the default: Given N hosts * there are 0.25 * N tasks of job A scheduled * there are 0.25 * N tasks of job B scheduled * there are 0.50 * N free offers available * we try to schedule a task instance of job A Hopefully this provides us with benchmark results closer to actual production performance. Before: SchedulingBenchmarks.LimitConstraintMismatchSchedulingBenchmark.runBenchmark thrpt 10 1646.245 ± 273.340 ops/s SchedulingBenchmarks.InsufficientResourcesSchedulingBenchmark.runBenchmark thrpt 10 12526.174 ± 814.677 ops/s After: SchedulingBenchmarks.LimitConstraintMismatchSchedulingBenchmark.runBenchmark thrpt 10 241.808 ± 51.952 ops/s SchedulingBenchmarks.InsufficientResourcesSchedulingBenchmark.runBenchmark thrpt 10 3447.655 ± 565.998 ops/s Related bug: AURORA-1802 Reviewed at https://reviews.apache.org/r/53829/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/05f082a1 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/05f082a1 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/05f082a1 Branch: refs/heads/master Commit: 05f082a1cab93f2cc4f2456d7d37511a161d2578 Parents: 44ab4c5 Author: Stephan Erb <[email protected]> Authored: Thu Nov 17 20:43:49 2016 +0100 Committer: Stephan Erb <[email protected]> Committed: Thu Nov 17 20:43:49 2016 +0100 ---------------------------------------------------------------------- .../aurora/benchmark/BenchmarkSettings.java | 42 +++++++++++++++----- .../aurora/benchmark/SchedulingBenchmarks.java | 17 +++++--- 2 files changed, 43 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/05f082a1/src/jmh/java/org/apache/aurora/benchmark/BenchmarkSettings.java ---------------------------------------------------------------------- diff --git a/src/jmh/java/org/apache/aurora/benchmark/BenchmarkSettings.java b/src/jmh/java/org/apache/aurora/benchmark/BenchmarkSettings.java index 94f8b79..ddab2ec 100644 --- a/src/jmh/java/org/apache/aurora/benchmark/BenchmarkSettings.java +++ b/src/jmh/java/org/apache/aurora/benchmark/BenchmarkSettings.java @@ -25,17 +25,20 @@ import static java.util.Objects.requireNonNull; */ final class BenchmarkSettings { private final Set<IHostAttributes> hostAttributes; - private final double clusterUtilization; + private final double siblingClusterUtilization; + private final double victimClusterUtilization; private final boolean allVictimsEligibleForPreemption; private final Set<IScheduledTask> tasks; private BenchmarkSettings( - double clusterUtilization, + double siblingClusterUtilization, + double victimClusterUtilization, boolean allVictimsEligibleForPreemption, Set<IHostAttributes> hostAttributes, Set<IScheduledTask> tasks) { - this.clusterUtilization = clusterUtilization; + this.siblingClusterUtilization = siblingClusterUtilization; + this.victimClusterUtilization = victimClusterUtilization; this.allVictimsEligibleForPreemption = allVictimsEligibleForPreemption; this.hostAttributes = requireNonNull(hostAttributes); this.tasks = requireNonNull(tasks); @@ -43,12 +46,22 @@ final class BenchmarkSettings { /** * Gets the cluster utilization factor specifying what percentage of hosts in the cluster - * already have tasks assigned to them. + * already have a job instance assigned to them as used during the scheduling benchmark. * - * @return Cluster utilization (default: 0.9). + * @return Cluster utilization (default: 0.25). */ - double getClusterUtilization() { - return clusterUtilization; + double getSiblingClusterUtilization() { + return siblingClusterUtilization; + } + + /** + * Gets the cluster utilization factor specifying what percentage of hosts in the cluster + * have a task of a foreign job assigned to them, i.e. potential preemption victims. + * + * @return Cluster utilization (default: 0.25). + */ + double getVictimClusterUtilization() { + return victimClusterUtilization; } /** @@ -79,13 +92,19 @@ final class BenchmarkSettings { } static class Builder { - private double clusterUtilization = 0.9; + private double siblingClusterUtilization = 0.25; + private double victimClusterUtilization = 0.25; private boolean allVictimsEligibleForPreemption; private Set<IHostAttributes> hostAttributes; private Set<IScheduledTask> tasks; - Builder setClusterUtilization(double newClusterUtilization) { - clusterUtilization = newClusterUtilization; + Builder setSiblingClusterUtilization(double newClusterUtilization) { + siblingClusterUtilization = newClusterUtilization; + return this; + } + + Builder setVictimClusterUtilization(double newClusterUtilization) { + victimClusterUtilization = newClusterUtilization; return this; } @@ -106,7 +125,8 @@ final class BenchmarkSettings { BenchmarkSettings build() { return new BenchmarkSettings( - clusterUtilization, + siblingClusterUtilization, + victimClusterUtilization, allVictimsEligibleForPreemption, hostAttributes, tasks); http://git-wip-us.apache.org/repos/asf/aurora/blob/05f082a1/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 1b56500..0510b89 100644 --- a/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java +++ b/src/jmh/java/org/apache/aurora/benchmark/SchedulingBenchmarks.java @@ -19,6 +19,7 @@ import java.util.concurrent.TimeUnit; import javax.inject.Singleton; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; import com.google.common.eventbus.EventBus; import com.google.inject.AbstractModule; import com.google.inject.Guice; @@ -181,11 +182,15 @@ public class SchedulingBenchmarks { } private Set<IScheduledTask> buildClusterTasks(int numOffers) { - int numOffersToFill = (int) Math.round(numOffers * settings.getClusterUtilization()); - return new Tasks.Builder() + int numSiblingTasks = (int) Math.round(numOffers * settings.getSiblingClusterUtilization()); + int numVictimTasks = (int) Math.round(numOffers * settings.getVictimClusterUtilization()); + return Sets.union( + new Tasks.Builder() + .build(numSiblingTasks), + new Tasks.Builder() .setRole("victim") .setProduction(!settings.areAllVictimsEligibleForPreemption()) - .build(numOffersToFill); + .build(numVictimTasks)); } private void fillUpCluster(int numOffers) { @@ -289,7 +294,8 @@ public class SchedulingBenchmarks { @Override protected BenchmarkSettings getSettings() { return new BenchmarkSettings.Builder() - .setClusterUtilization(1.0) + .setSiblingClusterUtilization(0.1) + .setVictimClusterUtilization(0.9) .setVictimPreemptionEligibilty(true) .setHostAttributes(new Hosts.Builder().setNumHostsPerRack(2).build(10000)) .setTasks(new Tasks.Builder() @@ -309,7 +315,8 @@ public class SchedulingBenchmarks { @Override protected BenchmarkSettings getSettings() { return new BenchmarkSettings.Builder() - .setClusterUtilization(1.0) + .setSiblingClusterUtilization(0.1) + .setVictimClusterUtilization(0.9) .setHostAttributes(new Hosts.Builder().setNumHostsPerRack(2).build(10000)) .setTasks(new Tasks.Builder() .setProduction(true)
