Search in sources :

Example 6 with DynamicServerListLoadBalancer

use of com.netflix.loadbalancer.DynamicServerListLoadBalancer in project ribbon by Netflix.

the class ServerListLoabBalancerTest method init.

@BeforeClass
public static void init() {
    Configuration config = ConfigurationManager.getConfigInstance();
    config.setProperty("ServerListLoabBalancerTest.ribbon.NFLoadBalancerClassName", com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
    config.setProperty("ServerListLoabBalancerTest.ribbon.NIWSServerListClassName", FixedServerList.class.getName());
    lb = (DynamicServerListLoadBalancer<Server>) ClientFactory.getNamedLoadBalancer("ServerListLoabBalancerTest");
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Server(com.netflix.loadbalancer.Server) DynamicServerListLoadBalancer(com.netflix.loadbalancer.DynamicServerListLoadBalancer) BeforeClass(org.junit.BeforeClass)

Example 7 with DynamicServerListLoadBalancer

use of com.netflix.loadbalancer.DynamicServerListLoadBalancer in project ribbon by Netflix.

the class PrimeConnectionsTest method testPrimeConnectionsSmallPool.

@Test
public void testPrimeConnectionsSmallPool() throws Exception {
    Configuration config = ConfigurationManager.getConfigInstance();
    config.setProperty("PrimeConnectionsTest1.ribbon.NFLoadBalancerClassName", com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
    config.setProperty("PrimeConnectionsTest1.ribbon.NIWSServerListClassName", SmallFixedServerList.class.getName());
    config.setProperty("PrimeConnectionsTest1.ribbon.EnablePrimeConnections", "true");
    DynamicServerListLoadBalancer<Server> lb = (DynamicServerListLoadBalancer<Server>) ClientFactory.getNamedLoadBalancer("PrimeConnectionsTest1");
    PrimeConnectionEndStats stats = lb.getPrimeConnections().getEndStats();
    assertEquals(stats.success, SMALL_FIXED_SERVER_LIST_SIZE);
}
Also used : Configuration(org.apache.commons.configuration.Configuration) HttpServer(com.sun.net.httpserver.HttpServer) Server(com.netflix.loadbalancer.Server) DynamicServerListLoadBalancer(com.netflix.loadbalancer.DynamicServerListLoadBalancer) PrimeConnectionEndStats(com.netflix.client.PrimeConnections.PrimeConnectionEndStats)

Example 8 with DynamicServerListLoadBalancer

use of com.netflix.loadbalancer.DynamicServerListLoadBalancer in project ribbon by Netflix.

the class PrimeConnectionsTest method testPrimeConnectionsLargePool.

@Test
public void testPrimeConnectionsLargePool() throws Exception {
    Configuration config = ConfigurationManager.getConfigInstance();
    config.setProperty("PrimeConnectionsTest2.ribbon.NFLoadBalancerClassName", com.netflix.loadbalancer.DynamicServerListLoadBalancer.class.getName());
    config.setProperty("PrimeConnectionsTest2.ribbon.NIWSServerListClassName", LargeFixedServerList.class.getName());
    config.setProperty("PrimeConnectionsTest2.ribbon.EnablePrimeConnections", "true");
    DynamicServerListLoadBalancer<Server> lb = (DynamicServerListLoadBalancer<Server>) ClientFactory.getNamedLoadBalancer("PrimeConnectionsTest2");
    PrimeConnectionEndStats stats = lb.getPrimeConnections().getEndStats();
    assertEquals(stats.success, LARGE_FIXED_SERVER_LIST_SIZE);
}
Also used : Configuration(org.apache.commons.configuration.Configuration) HttpServer(com.sun.net.httpserver.HttpServer) Server(com.netflix.loadbalancer.Server) DynamicServerListLoadBalancer(com.netflix.loadbalancer.DynamicServerListLoadBalancer) PrimeConnectionEndStats(com.netflix.client.PrimeConnections.PrimeConnectionEndStats)

Aggregations

DynamicServerListLoadBalancer (com.netflix.loadbalancer.DynamicServerListLoadBalancer)8 Server (com.netflix.loadbalancer.Server)5 Test (org.junit.Test)5 ZoneAffinityServerListFilter (com.netflix.loadbalancer.ZoneAffinityServerListFilter)4 Configuration (org.apache.commons.configuration.Configuration)4 LoadBalancerStats (com.netflix.loadbalancer.LoadBalancerStats)3 ArrayList (java.util.ArrayList)3 PrimeConnectionEndStats (com.netflix.client.PrimeConnections.PrimeConnectionEndStats)2 HttpServer (com.sun.net.httpserver.HttpServer)2 IClientConfig (com.netflix.client.config.IClientConfig)1 AvailabilityFilteringRule (com.netflix.loadbalancer.AvailabilityFilteringRule)1 ConfigurationBasedServerList (com.netflix.loadbalancer.ConfigurationBasedServerList)1 DummyPing (com.netflix.loadbalancer.DummyPing)1 ILoadBalancer (com.netflix.loadbalancer.ILoadBalancer)1 RoundRobinRule (com.netflix.loadbalancer.RoundRobinRule)1 HashSet (java.util.HashSet)1 BeforeClass (org.junit.BeforeClass)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1