org.apache.ignite.spi.loadbalancing.adaptive

## Class AdaptiveProcessingTimeLoadProbe

- java.lang.Object
- - org.apache.ignite.spi.loadbalancing.adaptive.AdaptiveProcessingTimeLoadProbe

All Implemented Interfaces:
  AdaptiveLoadProbe

    public class AdaptiveProcessingTimeLoadProbe
    extends Object
    implements AdaptiveLoadProbe

Implementation of node load probing based on total job processing time. Based on `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 Ignite Spring configuration file:

     <property name="loadBalancingSpi">
         <bean class="org.apache.ignite.spi.loadBalancing.adaptive.GridAdaptiveLoadBalancingSpi">
             <property name="loadProbe">
                 <bean class="org.apache.ignite.spi.loadBalancing.adaptive.GridAdaptiveProcessingTimeLoadProbe">
                     <property name="useAverage" value="true"/>
                 </bean>
             </property>
         </bean>
     </property>

### Constructor Summary

Constructors
Constructor and Description
`AdaptiveProcessingTimeLoadProbe()` Initializes execution time load probe to use execution time average by default.
`AdaptiveProcessingTimeLoadProbe(boolean useAvg)` Specifies whether to use average execution time vs. current.

### Method Summary

Methods
`double` `getLoad(ClusterNode 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

#### AdaptiveProcessingTimeLoadProbe

    public AdaptiveProcessingTimeLoadProbe()

Initializes execution time load probe to use execution time average by default.

#### AdaptiveProcessingTimeLoadProbe

    public AdaptiveProcessingTimeLoadProbe(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(ClusterNode node,
                 int jobsSentSinceLastUpdate)

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

Note that if this method 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 `AdaptiveLoadProbe`
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`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.1.0-incubating
Release Date | : May 20 2015