473,654 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 4767
dev7060
644 Recognized Expert Contributor
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
1527
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 trying to download more than 160+ megabytes upon reaching the 160 megabyte limit before 24 hours get throttled down to a 10K connection and everything dies. They have requested I write a tool that will allow them to set a bandwidth level on their...
0
1332
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 find the application' s ProcessID and port informations. -------------------------------- From: Ali Onder ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/) <Id>DTBdhCXwcke+RaJ/Mvedcw==</Id>
0
1168
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 object (using CreateJobObject) 2- Assign the process to the job object (using AssignProcessToJobObject) 3- Limit the jobs CPU time by using JOBOBJECT_BASIC_LIMIT_INFORMATION.PerJobUserTimeLimit (using SetInformationJobObject). This last part doesn't...
9
3085
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 expertise. That save me a lot of time and stress. I want to rate the post, but I only see questions "is this post helpful" and " why should I rate a post" link. I didn't see any thing "rate the post" link. I already sign into the community...
3
2517
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 don´t want to implement any of them :-) http, ftp (via ftplib) , https (dunno how yet), ssl, ssh, sftp (via paramiko) The thing is... I want rate-limiting so that in the case of a failure
5
3933
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
14137
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
7197
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. I can't find a simple way to achieve this. After researching a can try some things but I'm stuck on the details: 1) Can I overload some method in _socket.py to achieve this, and perhaps
0
1160
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
10453
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 simple and demonstrate how one might make a game. More experienced developers will note some similarities between my approach here and how Microsoft XNA does things. This is intentional for two reasons... XNA is an excellent hobbyist framework that...
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8710
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7310
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.