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.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_ACTIVE_REQUESTS
The default maximum number of active requests.static int
DEFAULT_NODE_LIMIT_PERCENT
The default limit on the number of requests, as a percentage of the requested maximum active requests.static 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
All Methods Static Methods Instance Methods Concrete Methods 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()
-
-
-
Field Detail
-
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 Detail
-
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 parameterrequestThresholdPercent
. Both the threshold and limit parameters below are expressed as a percentage ofmaxActiveRequests
.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 aRequestLimitException
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 ofmaxActiveRequests
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, ifrequestThresholdPercent
is greater than 100, or ifnodeLimitPercent
is greater thanrequestThresholdPercent
-
-
Method Detail
-
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.
-
getDefault
public static RequestLimitConfig getDefault()
Returns an instance that uses the default values.
-
-