Quick question... When do limits and quotas reset after the threshold is hit?
I have some info on rate limit, maybe somebody else can add information for quotas.
The rate limit uses a token bucket algorithm. In order to allow through a request, a counter must spend a token from the bucket. Token accumulate in the bucket when it goes unused, up to a maximum. The rate at which tokens are added to the bucket for a given number of nanoseconds of idle time is set by the configured rate limit.
When burst mode is not enabled, the bucket can only hold 1.5 tokens. This means that if a request is sent through an idle counter, the counter will not have enough tokens to allow through a second request until at least half the rate limit has elapsed (eg, for a limit of 10/sec, that would be half of 1/10th a sec, or 1/20th a sec). Over time this will only allow throughmessages at a rate equal to the limit.
With burst mode enabled, the bucket is allowed to hold more tokens. The number of tokens it can hold depends on the rate limit and the "spread limit over" setting. If you are spreading the limit over 5 seconds, then up to 5 seconds worth of tokens are allowed to accumulate in the bucket when a counter is idle. For the previously-mentioned 10/sec limit, this would be 50 tokens. In this mode, the counter will have enough tokens to spend to allow a burst of 50 requests arriving all at once, but after this it would be empty and (if traffic continues to arrive) would continue to behave like it would have if burst mode was not enabled.
This excerpt from the Apply Throughput Quota Assertion page of the gateway documentation describes the default behavior and references the System Properties that can be used to change some of the defaults:
(1) The counters used in this assertion are time-based and not based on the first request. For example, if the throughput quota is configured for "once per hour", the counter starts at the top of the hour, not when the first increment on the counter occurs. (2) There are several system properties that help you adjust the behavior of this assertion. To learn more, refer to the com.l7tech.hacounter.* properties in the System Properties.