Rate Limiting

Learn about rate limiting and how we can implement rate limiting in Go.

What is rate limiting?

Rate limiting is a technique used to control the rate of traffic sent or received by a service. This is important to prevent a service from being overwhelmed by too many requests. Rate limiting is often used in APIs, where clients request a server to retrieve data or perform some action. The underlying physical resources running the service will get exhausted if overloaded beyond a point. At this point, the system will protect itself by either killing the process that is utilizing too many resources, which in this case will be our service, or it might restart the entire virtual machine to begin again from a clean slate. Neither of these scenarios is appealing. Another approach is to control the amount of incoming traffic that can be accepted and processed to avoid these unpleasant scenarios. This is the approach that we will discuss at length in this lesson. ...