use of com.linkedin.d2.balancer.simple.LoadBalancerSimulator in project rest.li by linkedin.
the class SimpleLoadBalancerDelayTest method loadBalancerQuarantineCheckingTest.
/**
* Simple test to verify quarantine checking at the state update phase
* @throws Exception
*/
@Test(groups = { "small", "back-end" })
public void loadBalancerQuarantineCheckingTest() throws Exception {
String uri1 = "test.qa1.com:1234";
String uri2 = "test.qa2.com:2345";
List<String> uris = Arrays.asList(uri1, uri2);
// Construct the delay patterns: for each URI there is a list of delays for each interval
Map<String, List<Long>> delayMaps = new HashMap<>();
delayMaps.put("test.qa1.com:1234", Arrays.asList(1000l, 3000l, 3000l, 3000l, 3000l, 3080l, 60l, 80l, 80l, 60l, 80l, 80l));
delayMaps.put("test.qa2.com:2345", Arrays.asList(680l, 680l, 660l, 780l, 650l, 980l, 80l, 80l, 60l, 80l, 60l, 80l));
LoadBalancerSimulator.TimedValueGenerator<String, Long> delayGenerator = new DelayValueGenerator<>(delayMaps, DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
Map<String, String> degraderConfig = DegraderLoadBalancerTest.degraderDefaultConfig();
// Construct the QPS generator
LoadBalancerSimulator.QPSGenerator qpsGenerator = new ConstantQPSGenerator(1000);
// Create the simulator
LoadBalancerSimulator loadBalancerSimulator = LoadBalancerSimulationBuilder.build("cluster-1", "foo", uris, lbStrategyPropertiesWithQuarantine(), null, degraderConfig, delayGenerator, qpsGenerator);
URI expectedUri1 = LoadBalancerSimulationBuilder.getExpectedUri("test.qa1.com:1234", "foo");
// Start the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
printStates(loadBalancerSimulator);
// the points for uri1 should be 100
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) <= 0.55);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) >= 0.45);
// wait for 2 intervals due to call dropping involved
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri1 should be 80 -- ringMap will not update during callDropping phase
// Also if the loadbalancing strategy changed, the numbers could be lower
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 80);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) <= 0.65);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) >= 0.25);
// continue the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 4);
printStates(loadBalancerSimulator);
// the points for uri1 should not be 0 as quarantine is not enabled
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 1);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 6);
printStates(loadBalancerSimulator);
// uri1 should fully recovered by now
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// the points for uri3 should be around 60, recovering
_log.info(loadBalancerSimulator.getClockedExecutor().toString());
// Done. Shutdown the simulation
loadBalancerSimulator.shutdown();
}
use of com.linkedin.d2.balancer.simple.LoadBalancerSimulator in project rest.li by linkedin.
the class SimpleLoadBalancerDelayTest method loadBalancerD2MonitorTest.
/**
* Simple test to verify d2Monitor emitting
* @throws Exception
*/
@Test(groups = { "small", "back-end" })
public void loadBalancerD2MonitorTest() throws Exception {
String uri1 = "test.qa1.com:1234";
String uri2 = "test.qa2.com:2345";
List<String> uris = Arrays.asList(uri1, uri2);
URI uriU1 = new URI(uri1);
URI uriU2 = new URI(uri2);
// Construct the delay patterns: for each URI there is a list of delays for each interval
Map<String, List<Long>> delayMaps = new HashMap<>();
delayMaps.put("test.qa1.com:1234", Arrays.asList(80l, 30l, 30l, 30l, 30l, 80l, 30l, 30l, 30l, 30l, 30l, 80l, 60l, 80l, 80l, 60l, 80l, 80l, 60l, 80l, 80l));
delayMaps.put("test.qa2.com:2345", Arrays.asList(80l, 80l, 30l, 30l, 30l, 80l, 30l, 30l, 3060l, 4080l, 3050l, 3080l, 80l, 80l, 60l, 80l, 60l, 80l, 60l, 80l, 80l));
LoadBalancerSimulator.TimedValueGenerator<String, Long> delayGenerator = new DelayValueGenerator<>(delayMaps, DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
Map<String, Object> strategyProperties = DegraderLoadBalancerTest.lbDefaultConfig();
// setting the event emitting interval to 40s
strategyProperties.put(PropertyKeys.HTTP_LB_HIGH_EVENT_EMITTING_INTERVAL, "40000");
strategyProperties.put(PropertyKeys.HTTP_LB_HASH_CONFIG, HASH_CONFIG_MAP);
// Construct the QPS generator
LoadBalancerSimulator.QPSGenerator qpsGenerator = new ConstantQPSGenerator(2000);
// Create the simulator
LoadBalancerSimulator loadBalancerSimulator = LoadBalancerSimulationBuilder.build("cluster-1", "foo", uris, strategyProperties, null, null, delayGenerator, qpsGenerator);
URI expectedUri1 = LoadBalancerSimulationBuilder.getExpectedUri("test.qa1.com:1234", "foo");
// Start the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
printStates(loadBalancerSimulator);
// the points for uri1 should be 100
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
List<D2Monitor> d2Monitors = _d2MonitorMap.get("foo");
// For healthy state, there is no emission yet.
assertTrue(d2Monitors == null || d2Monitors.isEmpty());
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
d2Monitors = _d2MonitorMap.get("foo");
// For healthy state, there is no emission yet.
assertTrue(d2Monitors == null || d2Monitors.isEmpty());
printStates(loadBalancerSimulator);
// wait for 3 intervals due to call dropping involved
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 6);
d2Monitors = _d2MonitorMap.get("foo");
assertTrue(d2Monitors != null);
// the first emitting
assertFalse(d2Monitors.isEmpty());
D2Monitor d2Monitor = d2Monitors.get(0);
assertTrue(d2Monitor.getClusterStats().getClusterCallCount() > 0);
assertTrue(d2Monitor.getClusterStats().getClusterDropLevel() < 0.00001);
List<D2Monitor.UriInfo> uriList = d2Monitor.getUriList();
assertFalse(uriList.isEmpty());
assertTrue(uriList.get(0).getCurrentAvgLatency() - 50 < 0.0001);
assertTrue(uriList.get(0).getCurrentCallCount() > 900);
assertTrue(uriList.get(1).getCurrentAvgLatency() - 30 < 0.0001);
assertTrue(uriList.get(1).getCurrentCallCount() > 900);
assertEquals(d2Monitor.getIntervalMs(), 40000);
printStates(loadBalancerSimulator);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// continue the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertTrue(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2) < 100);
d2Monitors = _d2MonitorMap.get("foo");
// There's degrading, but no emitting yet
assertTrue(d2Monitors == null || d2Monitors.isEmpty());
printStates(loadBalancerSimulator);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertTrue(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2) < 100);
d2Monitors = _d2MonitorMap.get("foo");
assertTrue(d2Monitors == null || d2Monitors.isEmpty());
printStates(loadBalancerSimulator);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertTrue(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2) < 10);
d2Monitors = _d2MonitorMap.get("foo");
assertTrue(d2Monitors == null || d2Monitors.isEmpty());
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 5);
d2Monitors = _d2MonitorMap.get("foo");
assertTrue(d2Monitors != null);
assertFalse(d2Monitors.isEmpty());
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 8);
// uri1 should fully recovered by now
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
d2Monitors = _d2MonitorMap.get("foo");
assertTrue(d2Monitors != null);
assertFalse(_d2MonitorMap.get("foo").isEmpty());
printStates(loadBalancerSimulator);
// Done. Shutdown the simulation
loadBalancerSimulator.shutdown();
}
use of com.linkedin.d2.balancer.simple.LoadBalancerSimulator in project rest.li by linkedin.
the class SimpleLoadBalancerDelayTest method testLoadBalancerWithDelay.
@Test(groups = { "small", "back-end" })
public void testLoadBalancerWithDelay() throws Exception {
// Generate service, cluster and uri properties for d2
URI uri1 = URI.create("http://test.qa1.com:1234");
URI uri2 = URI.create("http://test.qa2.com:2345");
URI uri3 = URI.create("http://test.qa3.com:6789");
List<String> uris = Arrays.asList("test.qa1.com:1234", "test.qa2.com:2345", "test.qa3.com:6789");
Map<Integer, PartitionData> partitionData = new HashMap<>(1);
partitionData.put(DefaultPartitionAccessor.DEFAULT_PARTITION_ID, new PartitionData(1d));
Map<URI, Map<Integer, PartitionData>> uriData = new HashMap<>(3);
uriData.put(uri1, partitionData);
uriData.put(uri2, partitionData);
uriData.put(uri3, partitionData);
Map<String, List<Long>> delayMaps = new HashMap<>();
delayMaps.put("test.qa1.com:1234", Arrays.asList(50l, 60l, 75l, 55l, 60l, 80l, 50l, 50l, 50l));
delayMaps.put("test.qa2.com:2345", Arrays.asList(60l, 60l, 50l, 60l, 50l, 80l, 50l, 50l, 50l));
delayMaps.put("test.qa3.com:6789", Arrays.asList(80l, 3000l, 3000l, 3000l, 5000l, 80l, 50l, 50l));
LoadBalancerSimulator.TimedValueGenerator<String, Long> delayGenerator = new DelayValueGenerator<>(delayMaps, DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
Map<String, String> degraderProperties = DegraderLoadBalancerTest.degraderDefaultConfig();
degraderProperties.put(PropertyKeys.DEGRADER_DOWN_STEP, "0.2");
degraderProperties.put(PropertyKeys.DEGRADER_UP_STEP, "0.2");
Map<String, Object> lbProperties = DegraderLoadBalancerTest.lbDefaultConfig();
lbProperties.put(PropertyKeys.HTTP_LB_HASH_CONFIG, HASH_CONFIG_MAP);
Map<String, Object> transportClientProperties = Collections.singletonMap("DelayGenerator", delayGenerator);
List<String> prioritizedSchemes = Collections.singletonList("http");
ServiceProperties serviceProperties = new ServiceProperties("foo", "cluster-1", "/foo", Arrays.asList("degraderV3"), lbProperties, null, degraderProperties, prioritizedSchemes, null);
UriProperties uriProperties = new UriProperties("cluster-1", uriData);
// Construct the QPS generator
LoadBalancerSimulator.QPSGenerator qpsGenerator = new ConstantQPSGenerator(1000);
LoadBalancerSimulator loadBalancerSimulator = LoadBalancerSimulationBuilder.build("cluster-1", "foo", uris, lbProperties, null, degraderProperties, delayGenerator, qpsGenerator);
// Start the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
printStates(loadBalancerSimulator);
// the points for uri3 should be 100
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri3), 100);
// wait for 2 intervals due to call dropping involved
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri3 should be 80
// Also if the loadbalancing strategy changed, the numbers could be lower
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri3), 80);
// continue the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri3 should be around 40
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri3), 39);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 3);
printStates(loadBalancerSimulator);
// the points for uri3 should be around 60, recovering
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri3), 59);
// Done. Shutdown the simulation
loadBalancerSimulator.shutdown();
}
use of com.linkedin.d2.balancer.simple.LoadBalancerSimulator in project rest.li by linkedin.
the class SimpleLoadBalancerDelayTest method loadBalancerQuarantineSmokingTest.
/**
* Simple test to verify quarantine add/evict operations
* @throws Exception
*/
@Test(groups = { "small", "back-end" })
public void loadBalancerQuarantineSmokingTest() throws Exception {
String uri1 = "test.qa1.com:1234";
String uri2 = "test.qa2.com:2345";
List<String> uris = Arrays.asList(uri1, uri2);
// Construct the delay patterns: for each URI there is a list of delays for each interval
Map<String, List<Long>> delayMaps = new HashMap<>();
delayMaps.put("test.qa1.com:1234", Arrays.asList(80l, 3000l, 3000l, 3000l, 3000l, 80l, 60l, 80l, 80l, 60l, 80l, 80l));
delayMaps.put("test.qa2.com:2345", Arrays.asList(80l, 80l, 60l, 80l, 50l, 80l, 80l, 80l, 60l, 80l, 60l, 80l));
LoadBalancerSimulator.TimedValueGenerator<String, Long> delayGenerator = new DelayValueGenerator<>(delayMaps, DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
// Construct the QPS generator
LoadBalancerSimulator.QPSGenerator qpsGenerator = new ConstantQPSGenerator(1000);
// Create the simulator
LoadBalancerSimulator loadBalancerSimulator = LoadBalancerSimulationBuilder.build("cluster-1", "foo", uris, lbStrategyPropertiesWithQuarantine(), null, null, delayGenerator, qpsGenerator);
URI expectedUri1 = LoadBalancerSimulationBuilder.getExpectedUri("test.qa1.com:1234", "foo");
// Start the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
printStates(loadBalancerSimulator);
// the points for uri1 should be 100
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) <= 0.55);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) >= 0.45);
// wait for 2 intervals due to call dropping involved
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri1 should be 60
// Also if the loadbalancing strategy changed, the numbers could be lower
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 60);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) <= 0.65);
// assertTrue(loadBalancerSimulator.getCountPercent(expectedUri1) >= 0.25);
// continue the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri1 should be 0 as it is now in quarantine
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 0);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 0);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 5);
printStates(loadBalancerSimulator);
// uri1 should fully recovered by now
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// the points for uri3 should be around 60, recovering
_log.info(loadBalancerSimulator.getClockedExecutor().toString());
// Done. Shutdown the simulation
loadBalancerSimulator.shutdown();
}
use of com.linkedin.d2.balancer.simple.LoadBalancerSimulator in project rest.li by linkedin.
the class SimpleLoadBalancerDelayTest method loadBalancerQuarantineShutdownTest.
/**
* quarantine shutdown operation
* @throws Exception
*/
@Test(groups = { "small", "back-end" }, expectedExceptions = { java.util.concurrent.RejectedExecutionException.class })
public void loadBalancerQuarantineShutdownTest() throws Exception {
String uri1 = "test.qa1.com:1234";
String uri2 = "test.qa2.com:2345";
List<String> uris = Arrays.asList(uri1, uri2);
// Construct the delay patterns: for each URI there is a list of delays for each interval
Map<String, List<Long>> delayMaps = new HashMap<>();
delayMaps.put("test.qa1.com:1234", Arrays.asList(80l, 3000l, 3000l, 3000l, 3000l, 80l, 60l, 80l, 80l, 60l, 80l, 80l));
delayMaps.put("test.qa2.com:2345", Arrays.asList(80l, 80l, 60l, 80l, 50l, 80l, 80l, 80l, 60l, 80l, 60l, 80l));
LoadBalancerSimulator.TimedValueGenerator<String, Long> delayGenerator = new DelayValueGenerator<>(delayMaps, DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
// Construct the QPS generator
LoadBalancerSimulator.QPSGenerator qpsGenerator = new ConstantQPSGenerator(1000);
// Create the simulator
LoadBalancerSimulator loadBalancerSimulator = LoadBalancerSimulationBuilder.build("cluster-1", "foo", uris, lbStrategyPropertiesWithQuarantine(), null, null, delayGenerator, qpsGenerator);
URI expectedUri1 = LoadBalancerSimulationBuilder.getExpectedUri("test.qa1.com:1234", "foo");
// Start the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
printStates(loadBalancerSimulator);
// the points for uri1 should be 100
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 100);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
// wait for 2 intervals due to call dropping involved
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri1 should be 60
// Also if the loadbalancing strategy changed, the numbers could be lower
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 60);
// continue the simulation
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS * 2);
printStates(loadBalancerSimulator);
// the points for uri1 should be 0 as it is now in quarantine
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 0);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
loadBalancerSimulator.shutdown();
printStates(loadBalancerSimulator);
// the points for uri1 should be 0 as it is now in quarantine
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri1), 0);
assertEquals(loadBalancerSimulator.getPoint("foo", DefaultPartitionAccessor.DEFAULT_PARTITION_ID, uri2), 100);
loadBalancerSimulator.runWait(DegraderLoadBalancerStrategyConfig.DEFAULT_UPDATE_INTERVAL_MS);
_log.info(loadBalancerSimulator.getClockedExecutor().toString());
}
Aggregations