Package io.smallrye.faulttolerance.api
Enum RateLimitType
- All Implemented Interfaces:
Serializable,Comparable<RateLimitType>,java.lang.constant.Constable
Type of the time window used for rate limiting.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDivides time into non-overlapping intervals of given length (time windows) and enforces the invocation limit for each interval independently.Enforces the limit continuously, instead of dividing time into independent windows.Calculates the maximum rate of invocations from given time window length and given limit and enforces a uniform distribution of invocations over time under the calculated rate. -
Method Summary
Modifier and TypeMethodDescriptionstatic RateLimitTypeReturns the enum constant of this type with the specified name.static RateLimitType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
FIXED
Divides time into non-overlapping intervals of given length (time windows) and enforces the invocation limit for each interval independently. This means that short bursts of invocations occuring near the time window boundaries may temporarily exceed the configured rate limit.This is also called fixed window rate limiting.
Requires constant memory and time.
-
ROLLING
Enforces the limit continuously, instead of dividing time into independent windows. The invocation limit is enforced for all possible time intervals of given length, regardless of overlap.This is also called sliding log rate limiting.
Requires memory and time proportional to the maximum number of invocations in the time window, due to the need to store and check timestamps of recent invocations.
-
SMOOTH
Calculates the maximum rate of invocations from given time window length and given limit and enforces a uniform distribution of invocations over time under the calculated rate. If recent rate of invocations is under the limit, a subsequent burst of invocations is allowed during a shorter time span, but the calculated rate is never exceeded.This is also called token bucket or leaky bucket (as a meter) rate limiting, with the additional property that all work units are considered to have the same size.
Requires constant memory and time.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-