Implementing API Based Throttling - Fixed Time Intervals
In this scenario, the application of API Based Throttling policy to the Mock API created on Apinizer will be tested.
Using throttling for services is a way to limit the amount of requests by preventing overload.
In the scenario, we can divide the incoming requests into equal time intervals of 5 minutes so that only 10 requests are accepted every 5 minutes.
Create a mock api instance and add the policy.
We are adding API Based Throttling as a policy.
In the scenario, let's limit incoming requests to 10 requests in 5 minutes using the Fixed Window method.
If the period is set to 5 minutes and for example the policy is saved at 12:00:00.
Requests between 12:00:00 and 12:04:59 are counted in the same window.
At 12:05:00 a new window starts and the counter is reset.
Field
Description
Message Count
The number of requests allowed. In this scenario we set it as 10.
Interval Time Amount
It is the period determined according to the selected time unit. In this scenario, we set it as 5.
Interval Time Unit
Unit of time. In this scenario we set it in minutes.
Interval Window Type
The method used to apply the time interval. Time periods of 5 minutes of type Fixed.
Cache Connection Timeout (Second)
Specify the connection timeout value for the connection between the policy and the cache.
If there is a connection problem with the cache, return an error (select Fail ) or continue without applying the request constraint (select Continue ).
When we sent a sample request from the test console, the message was blocked because the restriction limit was reached after the 10th request between 14:00:00 and 14:04:59 at the current time.