Class LoadBalancer


  • public class LoadBalancer
    extends java.lang.Object
    Load balances over a set of nodes based on statistics gathered from those nodes.
    Author:
    thomasg
    • Constructor Summary

      Constructors 
      Constructor Description
      LoadBalancer​(java.lang.String cluster)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<com.yahoo.documentapi.messagebus.protocol.LoadBalancer.NodeMetrics> getNodeWeights()  
      com.yahoo.documentapi.messagebus.protocol.LoadBalancer.Node getRecipient​(java.util.List<com.yahoo.jrt.slobrok.api.Mirror.Entry> choices)
      The load balancing operation: Returns a node choice from the given choices, based on previously gathered statistics on the nodes, and a running "position" which is increased by 1 on each call to this.
      void received​(com.yahoo.documentapi.messagebus.protocol.LoadBalancer.Node node, boolean busy)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoadBalancer

        public LoadBalancer​(java.lang.String cluster)
    • Method Detail

      • getNodeWeights

        public java.util.List<com.yahoo.documentapi.messagebus.protocol.LoadBalancer.NodeMetrics> getNodeWeights()
      • getRecipient

        public com.yahoo.documentapi.messagebus.protocol.LoadBalancer.Node getRecipient​(java.util.List<com.yahoo.jrt.slobrok.api.Mirror.Entry> choices)
        The load balancing operation: Returns a node choice from the given choices, based on previously gathered statistics on the nodes, and a running "position" which is increased by 1 on each call to this.
        Parameters:
        choices - the node choices, represented as Slobrok entries
        Returns:
        the chosen node, or null only if the given choices were zero
      • received

        public void received​(com.yahoo.documentapi.messagebus.protocol.LoadBalancer.Node node,
                             boolean busy)