cancel
Showing results for 
Search instead for 
Did you mean: 
Janibasha
F5 Employee
F5 Employee

Introduction:  

Rate limiting is a method of protecting backend applications by keeping constraints on the rate of traffic coming into or out of an application. The rate is specified by how many times a route was used within a specific time interval (per second or minute). If the number of requests exceeds the configured limit, the incoming requests can overload the capacity of the services resulting in poor performance, reduced functionality, and sometimes downtime. These can be the result of either intentional (DDoS) or unintentional events (misconfiguration of applications/clients). Rate Limiting allows the administrator to limit the number of API requests per second or minute. 

Each incoming request can be monitored using ONE of the following: 

  • Client IP Address: The client IP source address as identifier. 
  • Cookie Name: An HTTP cookie value as the user identifier. 
  • HTTP Header Name: User a specific HTTP header value as the user identifier. 
  • Query Parameter Key: Use the query parameter value for the given key as the user identifier. 

Rate Limiter is a combination of the following: 

  • Number: The total number of allowed requests in the specified period. 
  • Per Period: Unit for a period per which the rate limit is applied. 

 

Use-Case:  

For ex. One of the customers website provides services to premium and free customers and this website gets overloaded frequently. We might increase the capacity temporarily as per need, but we want to ensure the user experience for premium users is not affected due to increased load from the free users.  

 

Solution:  

An alternative approach would be to simply prioritize the traffic. We can implement a http-header-name or cookie-name based rate limiting. Premium vs. free user’s traffic can be tagged at the client side with a premium-user-http-header or premium-user-cookie-name or free-user-http-header or free-user-cookie-name. And then you can rate limit the free user’s traffic to your website, ensuring the premium user’s user-experience is not affected by the free users. 

 

Step by step process:  

Version: Cloud Console at the time of article: crt-20220217-1449 

Prerequisites: 

  1. Access to F5 Distributed cloud account (contact sales for account access) 
  2. Customer domain is configured and delegated properly (check reference links for more details) 
  3. Kubernetes cluster and load balancer created in account (check getting started links for creation of cluster and load balancer) 

Step1:  

Login to F5 cloud account with valid credentials and then click on “Load Balancers” in Common Services section. 

Mohammed_Janiba_0-1647447287730.jpeg

Step2:  

Navigate to Manage section, click on “Load Balancers” and then select HTTP load balancers. 

Click on 3 dots in Actions column for any load balancer and then select “Manage configuration” option. 

Mohammed_Janiba_1-1647447287732.jpeg 

Step3: 

Next click on “Edit Configuration” then select Security configuration in Left menu.  

Now toggle “Advanced Fields button” as below- 

Mohammed_Janiba_2-1647447287733.jpeg 

Step4: 

Select “Rate-limiting parameters” option in “Rate limiting” field drop-down options and then click on configure. 

Mohammed_Janiba_3-1647447287734.jpeg

Step5: 

Toggle “Show Advanced fields” button, provide some valid number & period from drop-down options (secs or minutes) and leave burst multiplier field to default value of 1 as below- 

Mohammed_Janiba_4-1647447287735.jpeg 

Step6: 

Apply the above configuration, then click on “Save and Exit” button. 

Step7: 

Copy the domain name of load balancer, open a browser, enter the domain name, and check if the demo application is accessible as below. 

Mohammed_Janiba_5-1647447287736.jpeg

Step8:

Try to access the same application multiple times and once rate limit configuration is reached, we will see error below. 

Mohammed_Janiba_6-1647447287737.jpeg 

 

Below are some more options available in rate limiting feature for more requests granularity: 

  • Allowed list: users added in this field will not hit these rate limiting constraints and application is always accessible to these users. 
    Mohammed_Janiba_7-1647447287739.jpegMohammed_Janiba_8-1647447287740.jpeg 
  • Custom rate limiter policies – Users can also create their own custom rate limiters, add them to rate limiter policies and then apply these policies to load balancers. 
    Mohammed_Janiba_9-1647447287741.jpeg 
  • Admins can also add rate limiter rules in rate limiter policies matching specific methods (POST, GET, etc.), domain names, headers or paths and apply policy to load balancer. 

 

Conclusion:  

Rate Limiting protects applications against brute force attacks and limits access to searches, API calls, or resources that involve database-intensive operations at your origin. It also provides the ability to limit the number of requests originating from a particular user. 

 

For further information or to get started click the links below: 

  1. Documentation of user-rate-limiting feature in cloud console
  2. Configuring load balancer and api-discovery in cloud console 
  3. Security features in cloud console 
  4. Steps to delegate domain in cloud console 
Comments
Rajiv_Goel
F5 Employee
F5 Employee

Nice capture and very useful

Version history
Last update:
‎23-Aug-2022 07:04
Updated by:
Contributors