You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2016/02/26 18:07:33 UTC

svn commit: r1732524 - in /qpid/java/trunk/perftests: ./ src/main/java/org/apache/qpid/disttest/ src/main/java/org/apache/qpid/disttest/controller/ src/test/java/org/apache/qpid/disttest/controller/

Author: lquack
Date: Fri Feb 26 17:07:33 2016
New Revision: 1732524

URL: http://svn.apache.org/viewvc?rev=1732524&view=rev
Log:
QPID-7038: [Java Perftests] Make HillClimber bias configurable

Modified:
    qpid/java/trunk/perftests/pom.xml
    qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java
    qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimber.java
    qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimbingTestRunner.java
    qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/controller/HillClimberTest.java

Modified: qpid/java/trunk/perftests/pom.xml
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/pom.xml?rev=1732524&r1=1732523&r2=1732524&view=diff
==============================================================================
--- qpid/java/trunk/perftests/pom.xml (original)
+++ qpid/java/trunk/perftests/pom.xml Fri Feb 26 17:07:33 2016
@@ -49,6 +49,7 @@
     <qpid.disttest.hillclimb.production_to_target_ratio_success_threshold>0.95</qpid.disttest.hillclimb.production_to_target_ratio_success_threshold>
     <qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold>0.95</qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold>
     <qpid.disttest.hillclimb.minimum_delta>1.0</qpid.disttest.hillclimb.minimum_delta>
+    <qpid.disttest.hillclimb.bias>0.25</qpid.disttest.hillclimb.bias>
   </properties>
 
   <dependencies>
@@ -191,6 +192,7 @@
             <argument>hill-climber.production-to-target-ratio-success-threshold=${qpid.disttest.hillclimb.production_to_target_ratio_success_threshold}</argument>
             <argument>hill-climber.consumption-to-production-ratio-success-threshold=${qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold}</argument>
             <argument>hill-climber.minimum-delta=${qpid.disttest.hillclimb.minimum_delta}</argument>
+            <argument>hill-climber.bias=${qpid.disttest.hillclimb.bias}</argument>
           </arguments>
           <classpathScope>compile</classpathScope>
           <systemProperties>
@@ -270,6 +272,7 @@
                 <argument>hill-climber.production-to-target-ratio-success-threshold=${qpid.disttest.hillclimb.production_to_target_ratio_success_threshold}</argument>
                 <argument>hill-climber.consumption-to-production-ratio-success-threshold=${qpid.disttest.hillclimb.consumption_to_production_ratio_success_threshold}</argument>
                 <argument>hill-climber.minimum-delta=${qpid.disttest.hillclimb.minimum_delta}</argument>
+                <argument>hill-climber.bias=${qpid.disttest.hillclimb.bias}</argument>
               </arguments>
               <classpathScope>compile</classpathScope>
               <systemProperties>

Modified: qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java?rev=1732524&r1=1732523&r2=1732524&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java (original)
+++ qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/ControllerRunner.java Fri Feb 26 17:07:33 2016
@@ -56,6 +56,7 @@ public class ControllerRunner extends Ab
     public static final String HILL_CLIMBER_PRODUCTION_TO_TARGET_RATIO_SUCCESS_THRESHOLD = "hill-climber.production-to-target-ratio-success-threshold";
     public static final String HILL_CLIMBER_CONSUMPTION_TO_PRODUCTION_RATIO_SUCCESS_THRESHOLD = "hill-climber.consumption-to-production-ratio-success-threshold";
     public static final String HILL_CLIMBER_MINIMUM_DELTA = "hill-climber.minimum-delta";
+    public static final String HILL_CLIMBER_BIAS = "hill-climber.bias";
 
     private static final String TEST_CONFIG_DEFAULT = "perftests-config.json";
     private static final String DISTRIBUTED_DEFAULT = "false";
@@ -67,6 +68,7 @@ public class ControllerRunner extends Ab
     private static final String HILL_CLIMBER_CONSUMPTION_TO_PRODUCTION_RATIO_SUCCESS_THRESHOLD_DEFAULT = "0.95";
     private static final String HILL_CLIMBER_PRODUCTION_TO_TARGET_RATIO_SUCCESS_THRESHOLD_DEFAULT = "0.95";
     private static final String HILL_CLIMBER_MINIMUM_DELTA_DEFAULT = "1";
+    private static final String HILL_CLIMBER_BIAS_DEFAULT = "0.25";
 
     private final Aggregator _aggregator = new Aggregator();
 
@@ -93,6 +95,8 @@ public class ControllerRunner extends Ab
                             HILL_CLIMBER_CONSUMPTION_TO_PRODUCTION_RATIO_SUCCESS_THRESHOLD_DEFAULT);
         getCliOptions().put(HILL_CLIMBER_MINIMUM_DELTA,
                             HILL_CLIMBER_MINIMUM_DELTA_DEFAULT);
+        getCliOptions().put(HILL_CLIMBER_BIAS,
+                            HILL_CLIMBER_BIAS_DEFAULT);
     }
 
     public static void main(String[] args) throws Exception

Modified: qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimber.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimber.java?rev=1732524&r1=1732523&r2=1732524&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimber.java (original)
+++ qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimber.java Fri Feb 26 17:07:33 2016
@@ -31,8 +31,12 @@ public class HillClimber
 
     public HillClimber(double initialValue, double initialDelta, double bias)
     {
-        _stepPolicy = new UnknownDirectionStepPolicy(initialValue, initialDelta);
+        if (bias <= 0 || 1 <= bias)
+        {
+            throw new IllegalArgumentException("HillClimber bias must be in the open interval (0, 1) got: " + bias);
+        }
         _bias = bias;
+        _stepPolicy = new UnknownDirectionStepPolicy(initialValue, initialDelta);
     }
 
     public double nextHigher()

Modified: qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimbingTestRunner.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimbingTestRunner.java?rev=1732524&r1=1732523&r2=1732524&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimbingTestRunner.java (original)
+++ qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/controller/HillClimbingTestRunner.java Fri Feb 26 17:07:33 2016
@@ -18,6 +18,7 @@
  */
 package org.apache.qpid.disttest.controller;
 
+import static org.apache.qpid.disttest.ControllerRunner.HILL_CLIMBER_BIAS;
 import static org.apache.qpid.disttest.ControllerRunner.HILL_CLIMBER_START_TARGET_RATE;
 import static org.apache.qpid.disttest.ControllerRunner.HILL_CLIMBER_MAX_NUMBER_OF_RUNS;
 import static org.apache.qpid.disttest.ControllerRunner.HILL_CLIMBER_PRODUCTION_TO_TARGET_RATIO_SUCCESS_THRESHOLD;
@@ -59,8 +60,9 @@ public class HillClimbingTestRunner exte
         final double hillClimberMinimumDelta = Double.valueOf(_options.get(HILL_CLIMBER_MINIMUM_DELTA));
         final int maxNumberOfRuns = Integer.valueOf(_options.get(HILL_CLIMBER_MAX_NUMBER_OF_RUNS));
         double rate = Double.valueOf(_options.get(HILL_CLIMBER_START_TARGET_RATE));
+        double bias = Double.valueOf(_options.get(HILL_CLIMBER_BIAS));
         double initialDelta = rate - 1;
-        HillClimber hillClimber = new HillClimber(rate, initialDelta);
+        HillClimber hillClimber = new HillClimber(rate, initialDelta, bias);
         TestResult bestSuccessfulTestResult = null;
         int iteration = 1;
         do

Modified: qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/controller/HillClimberTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/controller/HillClimberTest.java?rev=1732524&r1=1732523&r2=1732524&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/controller/HillClimberTest.java (original)
+++ qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/controller/HillClimberTest.java Fri Feb 26 17:07:33 2016
@@ -75,6 +75,46 @@ public class HillClimberTest extends Qpi
         assertExhaustiveCoverageForBias(0.66);
     }
 
+    public void testRejectInvalidBias()
+    {
+        try
+        {
+            new HillClimber(10, 16, -0.1);
+            fail("HillClimber bias should not accept negative values");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // pass
+        }
+        try
+        {
+            new HillClimber(10, 16, 0);
+            fail("HillClimber bias should not accept values smaller or equal to 0");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // pass
+        }
+        try
+        {
+            new HillClimber(10, 16, 1.1);
+            fail("HillClimber bias should not accept values larger or equal to 1");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // pass
+        }
+        try
+        {
+            new HillClimber(10, 16, 1);
+            fail("HillClimber bias should not accept values larger or equal to 1");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // pass
+        }
+    }
+
     private void assertExhaustiveCoverageForBias(final double bias)
     {
         int numberOfBits = 5;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org