473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[.Net Framework 4] How to Implement API Rate Limiting/Throttling .5]

2
For our REST API, which is hosted as an Azure app service, we need to integrate API throttling. Azure Front Door serves as a load balancer for app services across various regions. The rate restriction should be done based on the client's IP address or the value of a header key that is unique to that client. There is no ip address or client list that has been pre-defined.

As an example, When a client sends an API request with the header "idKey = foo," only 100 requests should be served from that client for the following 1 minute. Each client should be served until the limit is met.



How should this be implemented/designed in the project? The concept for the project is based on. 4.5.1 Microsoft.NET Framework
May 20 '21 #1
1 4722
dev7060
636 Expert 512MB
For our REST API, which is hosted as an Azure app service, we need to integrate API throttling. Azure Front Door serves as a load balancer for app services across various regions. The rate restriction should be done based on the client's IP address or the value of a header key that is unique to that client. There is no ip address or client list that has been pre-defined.

As an example, When a client sends an API request with the header "idKey = foo," only 100 requests should be served from that client for the following 1 minute. Each client should be served until the limit is met.



How should this be implemented/designed in the project? The concept for the project is based on. 4.5.1 Microsoft.NET Framework
I have never worked with .NET but this is how I'd approach it in a generic way. Although i can't say if it'd prove useful in this scenario. I'd create a session and set up variables for the number of requests and time. For each request made by the client, the cookie header can be read to retrieve the session id and respective values (requests/time) can be checked/updated on the server side before allowing access to the API. A database entry can be used to check if the 'idKey' is currently being engaged (with an IP) to avoid further connection requests.
May 22 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rex Winn | last post by:
Hi all I am looking for code/articles that can show me how to implement bandwidth throttling on a local machine using C/C++. The reason being is that I have users on Satellite Internet that if...
0
by: Ali Onder via .NET 247 | last post by:
I am coding an application for my senior project. I need some help on bandwidth limiting in C#. I am tring to limit the bandwidth per application or in other words per socket. Since I am able to...
0
by: Lu | last post by:
hi. Anyone have an example or tips on on how to do CPU throttling using Job Objects with VB.NET ? The documentation on this is close to nothing. So far I have been able to: 1- create a job...
9
by: c676228 | last post by:
Hi, I am new to this discussion forum. I started to post questions on this forum since this Jan. and got many good responses and I am very appreciated to those who are willing to help with their...
3
by: Peter Silva | last post by:
Hi folks, I have a need in a network data distribution application to send out data to folks who want it using the protocol of their choice. IŽd like it to support a variety of protocols and I...
5
by: petru.marginean | last post by:
Hello, I would like to re-implement this function that currently uses pthreads: pthread_mutex_t mutex; int i = pthread_mutex_init(&mutex, 0); void MutexCB(int lock) {
139
by: ravi | last post by:
Hi can anybody tell me that which ds will be best suited to implement a hash table in C/C++ thanx. in advanced
4
by: Dimitrios Apostolou | last post by:
Hello list, I want to limit the download speed when using urllib2. In particular, having several parallel downloads, I want to make sure that their total speed doesn't exceed a maximum value. ...
0
by: haanjae | last post by:
hi, i am developing a system that going to perform bandwidth throttling and allocation, is Java an appropriate to use to implement the system? or is there any other options? thank you.
0
GaryTexmo
by: GaryTexmo | last post by:
I've decided to do a series of insights based on creating a simple windows game using C# and WinForms. There are other methods of approaching this task but I've chosen to try to keep things fairly...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.