This section explains how to configure DataScript Rate Limiter.

  • Login to the Avi Load Balancer CLI and use configure vsdatascriptset <policy name> command to configure rate limiters. Provide the policy name and assign the desired value of the rate limiters (count, period, and burst size) as shown below.

[admin]: > configure vsdatascriptset rate_limiter_test
[admin]: vsdatascriptset> rate_limiters
[admin]: vsdatascriptset:rate_limiters> count 1
[admin]: vsdatascriptset:rate_limiters> period 15
[admin]: vsdatascriptset:rate_limiters> burst_sz 0
[admin]: vsdatascriptset:rate_limiters> name rl1
[admin]: vsdatascriptset:rate_limiters> save
[admin]: vsdatascriptset> save
  • Use the avi.vs.ratelimit.exceed function in a DataScript with the desired action.

result = avi.vs.rate_limit.exceed("test", "key1") 
if result == true then 
avi.vs.log("rl exceeds") 
else 
avi.vs.log("rl does not exceed") 
end