i would like to implement a good throttle algorithm by in .net (C# or VB) but i cannot figure out how could i do that.
The case is my asp.net website should post requests to another website to fetch results. At maximum 300 requests per minute should be sent.
If the requests exceed the 300 limit the other party Api returns nothing (Which is something i would not like to use as a check in my code).
P.S. I have seen solutions in other languages than .net but i am a newbie and please be kind and keep your answers as simple as 123.
Thank you
Is Throttling Legal? Throttling an internet connection is like a sneaky business that shortchanges its customers. Nonetheless, throttling is a legal practice, as long as ISPs adequately explain it to their customers. On the other hand, failure to inform customers about throttling is illegal.
What's the best way to bypass bandwidth throttling? If your ISP is throttling your bandwidth, and switching providers is not an option, the easiest solution is to connect through VPN. Your ISP won't be able to inspect the data packets, so it won't be able to throttle that traffic based on what service you're using.
Check your internet speed to see if Verizon is throttling your service. You can use websites to identify your internet speed, such as Fast.com and Speedtest.net. If your internet speed is noticeably slower than usual, then it is possible that your data speed is being restricted.
Signs of Internet ThrottlingSpecific websites or services are slower than others. Videos are buffering or lagging. Your internet speeds are slower than usual. Your Wi-Fi connection is choppy or broken.
You could have a simple application (or session) class and check that for hits. This is something extremely rough just to give you the idea:
public class APIHits {
public int hits { get; private set; }
private DateTime minute = DateTime.Now();
public bool AddHit()
{
if (hits < 300) {
hits++;
return true;
}
else
{
if (DateTime.Now() > minute.AddSeconds(60))
{
//60 seconds later
minute = DateTime.Now();
hits = 1;
return true;
}
else
{
return false;
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With