ServerLoadProbe (Apache Geode 2.0.2)
Description: declaration: package: org.apache.geode.cache.server, interface: ServerLoadProbe

Package org.apache.geode.cache.server

# Interface ServerLoadProbe

All Superinterfaces:
  `CacheCallback`, `Declarable`

All Known Implementing Classes:
  `ServerLoadProbeAdapter`

public interface ServerLoadProbe extends CacheCallback
A load probe is installed in a cache server to measure the load on the cache server for balancing load between multiple cache servers.

The getLoad method will be called once per poll interval see `CacheServer.setLoadPollInterval(long)` The `ServerLoad` object returned by the getLoad method will be sent to the locator every time the load for this server changes. To conserve bandwidth, it's a good idea to round the load calculations so that the load will not be sent too frequently.

The `ServerLoad` object contains two floating point numbers indicating the load on the server due to client to server connections and due to subscription connections. When routing a connection, the locator will choose the server that has the lowest load.

It is generally a good idea to pick a load function where 0 connections corresponds to 0 load. The default gemfire load probes return a fraction between 0 and 1, where 0 indicates no load, and 1 indicates the server is completely loaded.

Because cache servers can be stopped, reconfigured, and restarted, the open and close methods on this callback can be called several times. If the same callback object is installed on multiple cache servers, open and close will be called once for each cache server.

Since:
  GemFire 5.7

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Signals that a cache server using this load probe has been closed.
  `ServerLoad`
  `getLoad(ServerMetrics metrics)`
  Get the load on this server.
  `void`
  `open()`
  Signals that a cache server using this load probe has been started.

  ### Methods inherited from interface org.apache.geode.cache.Declarable

  `init, initialize`

- ## Method Details

  - ### getLoad

    ServerLoad getLoad(ServerMetrics metrics)
    Get the load on this server. This method will be called once every pool interval.
    Parameters:
      `metrics` - the `ServerMetrics` for the server
    Returns:
      The current load on this server.

  - ### open

    void open()
    Signals that a cache server using this load probe has been started.

  - ### close

    void close()
    Signals that a cache server using this load probe has been closed.
    Specified by:
      `close` in interface `CacheCallback`
    See Also:
      - `RegionService.close()`
      - `Region.close()`
      - `Region.localDestroyRegion()`
      - `Region.destroyRegion()`
      - `AttributesMutator`