Package oracle.kv

# Class RequestLimitConfig

java.lang.Object
oracle.kv.RequestLimitConfig

All Implemented Interfaces:
  `Serializable`

public class RequestLimitConfig extends Object implements Serializable
Describes how requests may be limited so that one or more nodes with long service times don't end up consuming all available threads in the KVS client.

See Also:
  - `KVStoreConfig.setRequestLimit(oracle.kv.RequestLimitConfig)`
  - `RequestLimitException`
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_MAX_ACTIVE_REQUESTS`
  The default maximum number of active requests.
  `static final int`
  `DEFAULT_NODE_LIMIT_PERCENT`
  The default limit on the number of requests, as a percentage of the requested maximum active requests.
  `static final int`
  `DEFAULT_REQUEST_THRESHOLD_PERCENT`
  The default threshold for activating request limiting, as a percentage of the requested maximum active requests.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RequestLimitConfig(int maxActiveRequests, int requestThresholdPercent, int nodeLimitPercent)`
  Creates a request limiting configuration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static RequestLimitConfig`
  `getDefault()`
  Returns an instance that uses the default values.
  `int`
  `getMaxActiveRequests()`
  Returns the maximum number of active requests permitted by the KVS client.
  `int`
  `getNodeLimit()`
  Returns the maximum number of requests that may be active at a node.
  `int`
  `getNodeLimitPercent()`
  Returns the percentage used to compute the maximum number of requests that may be active at a node.
  `int`
  `getRequestThreshold()`
  Returns the threshold number of requests above which the request limiting mechanism is activated.
  `int`
  `getRequestThresholdPercent()`
  Returns the percentage used to compute the active request threshold above which the request limiting mechanism is activated.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_MAX_ACTIVE_REQUESTS

    public static final int DEFAULT_MAX_ACTIVE_REQUESTS
    The default maximum number of active requests.
    See Also:
      - Constant Field Values

  - ### DEFAULT_REQUEST_THRESHOLD_PERCENT

    public static final int DEFAULT_REQUEST_THRESHOLD_PERCENT
    The default threshold for activating request limiting, as a percentage of the requested maximum active requests.
    See Also:
      - Constant Field Values

  - ### DEFAULT_NODE_LIMIT_PERCENT

    public static final int DEFAULT_NODE_LIMIT_PERCENT
    The default limit on the number of requests, as a percentage of the requested maximum active requests.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### RequestLimitConfig

    public RequestLimitConfig(int maxActiveRequests, int requestThresholdPercent, int nodeLimitPercent)
    Creates a request limiting configuration. The request limiting mechanism is only activated when the number of active requests exceeds the threshold specified by the parameter `requestThresholdPercent`. Both the threshold and limit parameters below are expressed as a percentage of `maxActiveRequests`.

    When the mechanism is active the number of active requests to a node is not allowed to exceed `nodeRequestLimitPercent`. Any new requests that would exceed this limit are rejected and a `RequestLimitException` is thrown.

    For example, consider a configuration with maxActiveRequests=10, requestThresholdPercent=80 and nodeLimitPercent=50. If 8 requests are already active at the client, and a 9th request is received that would be directed at a node which already has 5 active requests, it would result in a `RequestLimitException` being thrown. If only 7 requests were active at the client, the 8th request would be directed at the node with 5 active requests and the request would be processed normally.

    Parameters:
      `maxActiveRequests` - the maximum number of active requests permitted by the KV client. This number is typically derived from the maximum number of threads that the client has set aside for processing requests. The default is 100. Note that the KVStore does not actually enforce this maximum directly. It only uses this parameter as the basis for calculating the requests limits to be enforced at a node.
      `requestThresholdPercent` - the threshold computed as a percentage of `maxActiveRequests` at which requests are limited. The default is 90.
      `nodeLimitPercent` - determines the maximum number of active requests that can be associated with a node when the request limiting mechanism is active. The default is 80.
    Throws:
      `IllegalArgumentException` - if any argument is 0 or less, if `requestThresholdPercent` is greater than 100, or if `nodeLimitPercent` is greater than `requestThresholdPercent`

- ## Method Details

  - ### getMaxActiveRequests

    public int getMaxActiveRequests()
    Returns the maximum number of active requests permitted by the KVS client.

    The default value is 100.

  - ### getRequestThresholdPercent

    public int getRequestThresholdPercent()
    Returns the percentage used to compute the active request threshold above which the request limiting mechanism is activated.

    The default value is 90.

  - ### getRequestThreshold

    public int getRequestThreshold()
    Returns the threshold number of requests above which the request limiting mechanism is activated.

  - ### getNodeLimitPercent

    public int getNodeLimitPercent()
    Returns the percentage used to compute the maximum number of requests that may be active at a node.

    The default value is 80.

  - ### getNodeLimit

    public int getNodeLimit()
    Returns the maximum number of requests that may be active at a node.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getDefault

    public static RequestLimitConfig getDefault()
    Returns an instance that uses the default values.