Search in sources :

Example 1 with SimpleLoadBalancerSimulation

use of com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation in project rest.li by linkedin.

the class SimpleLoadBalancerTest method testLoadBalancerSimulationRandomLarge.

@Test(enabled = false, groups = { "large", "back-end" })
public void testLoadBalancerSimulationRandomLarge() throws URISyntaxException, IOException, ServiceUnavailableException, InterruptedException {
    SimpleLoadBalancerSimulation simulator = new SimpleLoadBalancerSimulation(new RandomLoadBalancerStrategyFactory());
    simulator.simulateMultithreaded(1, 1000, 20);
    simulator.reset();
    simulator.simulateMultithreaded(1, 10000, 20);
    simulator.reset();
    simulator.simulateMultithreaded(8, 10000, 750);
    simulator.reset();
    simulator.simulateMultithreaded(50, 10000, 100);
    simulator.reset();
    simulator.simulateMultithreaded(50, 10000, 100);
    simulator.reset();
}
Also used : RandomLoadBalancerStrategyFactory(com.linkedin.d2.balancer.strategies.random.RandomLoadBalancerStrategyFactory) SimpleLoadBalancerSimulation(com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation) Test(org.testng.annotations.Test)

Example 2 with SimpleLoadBalancerSimulation

use of com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation in project rest.li by linkedin.

the class SimpleLoadBalancerTest method testLoadBalancerSimulationDegrader.

@Test(groups = { "medium", "back-end" })
public void testLoadBalancerSimulationDegrader() throws URISyntaxException, IOException, ServiceUnavailableException, InterruptedException {
    SimpleLoadBalancerSimulation simulator = new SimpleLoadBalancerSimulation(new DegraderLoadBalancerStrategyFactoryV3());
    simulator.simulateMultithreaded(1, 1000, 20);
    simulator.reset();
    simulator.simulateMultithreaded(50, 10000, 20);
    simulator.reset();
}
Also used : DegraderLoadBalancerStrategyFactoryV3(com.linkedin.d2.balancer.strategies.degrader.DegraderLoadBalancerStrategyFactoryV3) SimpleLoadBalancerSimulation(com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation) Test(org.testng.annotations.Test)

Example 3 with SimpleLoadBalancerSimulation

use of com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation in project rest.li by linkedin.

the class SimpleLoadBalancerTest method testLoadBalancerSimulationRandom.

@Test(groups = { "medium", "back-end" }, enabled = false)
public void testLoadBalancerSimulationRandom() throws URISyntaxException, IOException, ServiceUnavailableException, InterruptedException {
    SimpleLoadBalancerSimulation simulator = new SimpleLoadBalancerSimulation(new RandomLoadBalancerStrategyFactory());
    simulator.simulateMultithreaded(1, 1000, 20);
    simulator.reset();
    simulator.simulateMultithreaded(50, 10000, 20);
    simulator.reset();
}
Also used : RandomLoadBalancerStrategyFactory(com.linkedin.d2.balancer.strategies.random.RandomLoadBalancerStrategyFactory) SimpleLoadBalancerSimulation(com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation) Test(org.testng.annotations.Test)

Example 4 with SimpleLoadBalancerSimulation

use of com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation in project rest.li by linkedin.

the class SimpleLoadBalancerSimulation method main.

public static void main(String[] args) throws Exception {
    SimpleLoadBalancerTest test = new SimpleLoadBalancerTest();
    test.doOneTimeSetUp();
    System.err.println(2);
    test.testLoadBalancerSimulationRandom();
    System.err.println(3);
    test.testLoadBalancerSimulationRandomLarge();
    System.err.println(4);
    test.testLoadBalancerSimulationDegrader();
    System.err.println(5);
    test.testLoadBalancerSimulationDegraderLarge();
    System.err.println(6);
    test.testLoadBalancerSimulationDegraderWithFileStore();
    System.err.println(7);
    test.testLoadBalancerSimulationDegraderWithFileStoreLarge();
    System.err.println(8);
    test.doOneTimeTearDown();
    new SimpleLoadBalancerSimulation(new DegraderLoadBalancerStrategyFactoryV3()).simulateMultithreaded(50, 1000000, 999999999);
}
Also used : SimpleLoadBalancerTest(com.linkedin.d2.balancer.simple.SimpleLoadBalancerTest) DegraderLoadBalancerStrategyFactoryV3(com.linkedin.d2.balancer.strategies.degrader.DegraderLoadBalancerStrategyFactoryV3)

Example 5 with SimpleLoadBalancerSimulation

use of com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation in project rest.li by linkedin.

the class SimpleLoadBalancerTest method testLoadBalancerSimulationDegraderWithFileStore.

@Test(groups = { "medium", "back-end" })
public void testLoadBalancerSimulationDegraderWithFileStore() throws URISyntaxException, IOException, ServiceUnavailableException, InterruptedException {
    SimpleLoadBalancerSimulation simulator = new SimpleLoadBalancerSimulation(new DegraderLoadBalancerStrategyFactoryV3(), new FileStoreTestFactory<ClusterProperties>("cluster", new ClusterPropertiesJsonSerializer()), new FileStoreTestFactory<ServiceProperties>("service", new ServicePropertiesJsonSerializer()), new FileStoreTestFactory<UriProperties>("uri", new UriPropertiesJsonSerializer()));
    simulator.simulateMultithreaded(1, 1000, 20);
    simulator.reset();
    simulator.simulateMultithreaded(50, 10000, 20);
    simulator.reset();
}
Also used : UriPropertiesJsonSerializer(com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer) ServiceProperties(com.linkedin.d2.balancer.properties.ServiceProperties) DegraderLoadBalancerStrategyFactoryV3(com.linkedin.d2.balancer.strategies.degrader.DegraderLoadBalancerStrategyFactoryV3) ClusterPropertiesJsonSerializer(com.linkedin.d2.balancer.properties.ClusterPropertiesJsonSerializer) ServicePropertiesJsonSerializer(com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer) UriProperties(com.linkedin.d2.balancer.properties.UriProperties) ClusterProperties(com.linkedin.d2.balancer.properties.ClusterProperties) SimpleLoadBalancerSimulation(com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation) Test(org.testng.annotations.Test)

Aggregations

SimpleLoadBalancerSimulation (com.linkedin.d2.balancer.simulator.SimpleLoadBalancerSimulation)6 Test (org.testng.annotations.Test)6 DegraderLoadBalancerStrategyFactoryV3 (com.linkedin.d2.balancer.strategies.degrader.DegraderLoadBalancerStrategyFactoryV3)5 ClusterProperties (com.linkedin.d2.balancer.properties.ClusterProperties)2 ClusterPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ClusterPropertiesJsonSerializer)2 ServiceProperties (com.linkedin.d2.balancer.properties.ServiceProperties)2 ServicePropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)2 UriProperties (com.linkedin.d2.balancer.properties.UriProperties)2 UriPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer)2 RandomLoadBalancerStrategyFactory (com.linkedin.d2.balancer.strategies.random.RandomLoadBalancerStrategyFactory)2 SimpleLoadBalancerTest (com.linkedin.d2.balancer.simple.SimpleLoadBalancerTest)1