GridGain™ 2.1.0
Java API Specification

org.gridgain.grid.spi.loadbalancing.adaptive
Class GridAdaptiveJobCountLoadProbe

java.lang.Object
  extended by org.gridgain.grid.spi.loadbalancing.adaptive.GridAdaptiveJobCountLoadProbe
All Implemented Interfaces:
GridAdaptiveLoadProbe

public class GridAdaptiveJobCountLoadProbe
extends Object
implements GridAdaptiveLoadProbe

Implementation of node load probing based on active and waiting job count. Based on GridAdaptiveJobCountLoadProbe.setUseAverage(boolean) parameter, this implementation will either use average job count values or current (default is to use averages).

The load of a node is simply calculated by adding active and waiting job counts.

Below is an example of how CPU load probe would be configured in GridGain Spring configuration file:

 <property name="loadBalancingSpi">
     <bean class="org.gridgain.grid.spi.loadbalancing.adaptive.GridAdaptiveLoadBalancingSpi">
         <property name="loadProbe">
             <bean class="org.gridgain.grid.spi.loadbalancing.adaptive.GridAdaptiveJobCountLoadProbe">
                 <property name="useAverage" value="true"/>
             </bean>
         </property>
     </bean>
 </property>
 




See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

 

Constructor Summary
GridAdaptiveJobCountLoadProbe()
          Initializes active job probe.
GridAdaptiveJobCountLoadProbe(boolean useAvg)
          Creates new active job prove specifying whether to use average job counts vs. current.
 
Method Summary
 double getLoad(GridNode node, int jobsSentSinceLastUpdate)
          Calculates load value for a given node.
 boolean isUseAverage()
          Gets flag indicating whether to use average job counts vs. current.
 void setUseAverage(boolean useAvg)
          Sets flag indicating whether to use average job counts vs. current.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridAdaptiveJobCountLoadProbe

public GridAdaptiveJobCountLoadProbe()
Initializes active job probe.


GridAdaptiveJobCountLoadProbe

public GridAdaptiveJobCountLoadProbe(boolean useAvg)
Creates new active job prove specifying whether to use average job counts vs. current.

Parameters:
useAvg - Flag indicating whether to use average job counts vs. current.
Method Detail

isUseAverage

public boolean isUseAverage()
Gets flag indicating whether to use average job counts vs. current.

Returns:
Flag indicating whether to use average job counts vs. current.

setUseAverage

public void setUseAverage(boolean useAvg)
Sets flag indicating whether to use average job counts vs. current.

Parameters:
useAvg - Flag indicating whether to use average job counts vs. current.

getLoad

public double getLoad(GridNode node,
                      int jobsSentSinceLastUpdate)
Calculates load value for a given node. Specific implementations would usually take into account some of the values provided by GridNode.getMetrics() method. For example, load can be calculated based on job execution time or number of active jobs, or CPU/Heap utilization.

Note that if GridAdaptiveLoadProbe.getLoad(GridNode, int) returns a value of 0, then implementation will assume that load value is simply not available and will try to calculate an average of load values for other nodes. If such average cannot be obtained (all node load values are 0), then a value of 1 will be used.

Specified by:
getLoad in interface GridAdaptiveLoadProbe
Parameters:
node - Grid node to calculate load for.
jobsSentSinceLastUpdate - Number of jobs sent to this node since last metrics update. This parameter may be useful when implementation takes into account the current job count on a node.
Returns:
Non-negative load value for the node (zero and above).

toString

public String toString()

Overrides:
toString in class Object

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.