GridGain™ 2.0.3
Java API Specification

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

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

public class GridAdaptiveProcessingTimeLoadProbe
extends Object
implements GridAdaptiveLoadProbe

Implementation of node load probing based on total job processing time. Based on GridAdaptiveProcessingTimeLoadProbe.setUseAverage(boolean) parameter, this implementation will either use average job execution time values or current (default is to use averages). The algorithm returns a sum of job wait time and job execution time.

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.GridAdaptiveProcessingTimeLoadProbe">
                 <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.0.3

 

Constructor Summary
GridAdaptiveProcessingTimeLoadProbe()
          Initializes execution time load probe to use execution time average by default.
GridAdaptiveProcessingTimeLoadProbe(boolean useAvg)
          Specifies whether to use average execution time 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 execution time vs. current.
 void setUseAverage(boolean useAvg)
          Sets flag indicating whether to use average execution time vs. current.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridAdaptiveProcessingTimeLoadProbe

public GridAdaptiveProcessingTimeLoadProbe()
Initializes execution time load probe to use execution time average by default.


GridAdaptiveProcessingTimeLoadProbe

public GridAdaptiveProcessingTimeLoadProbe(boolean useAvg)
Specifies whether to use average execution time vs. current.

Parameters:
useAvg - Flag indicating whether to use average execution time vs. current.
Method Detail

isUseAverage

public boolean isUseAverage()
Gets flag indicating whether to use average execution time vs. current.

Returns:
Flag indicating whether to use average execution time vs. current.

setUseAverage

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

Parameters:
useAvg - Flag indicating whether to use average execution time 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.0.3
Java API Specification

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