In
computer network
A computer network is a collection of communicating computers and other devices, such as printers and smart phones. In order to communicate, the computers and devices must be connected by wired media like copper cables, optical fibers, or b ...
s, rate limiting is used to control the rate of requests sent or received by a
network interface controller
A network interface controller (NIC, also known as a network interface card, network adapter, LAN adapter and physical network interface) is a computer hardware component that connects a computer to a computer network.
Early network interface ...
. It can be used to prevent
DoS attacks and limit
web scraping
Web scraping, web harvesting, or web data extraction is data scraping used for data extraction, extracting data from websites. Web scraping software may directly access the World Wide Web using the Hypertext Transfer Protocol or a web browser. W ...
.
Research indicates flooding rates for one zombie machine are in excess of 20
HTTP
HTTP (Hypertext Transfer Protocol) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, wher ...
GET requests per second,
legitimate rates much less.
Rate limiting should be used along with
throttling pattern to minimize the number of throttling errors.
Hardware appliances
Hardware appliances can limit the rate of requests on layer 4 or 5 of the
OSI model
The Open Systems Interconnection (OSI) model is a reference model developed by the International Organization for Standardization (ISO) that "provides a common basis for the coordination of standards development for the purpose of systems inter ...
.
Rate limiting can be induced by the network protocol stack of the sender due to a received
ECN-marked packet and also by the
network scheduler of any router along the way.
While a hardware appliance can limit the rate for a given range of IP-addresses on layer 4, it risks blocking a network with many users which are masked by
NAT with a single
IP address
An Internet Protocol address (IP address) is a numerical label such as that is assigned to a device connected to a computer network that uses the Internet Protocol for communication. IP addresses serve two main functions: network interface i ...
of an
ISP.
Deep packet inspection
Deep packet inspection (DPI) is a type of data processing that inspects in detail the data (Network packet, packets) being sent over a computer network, and may take actions such as alerting, blocking, re-routing, or logging it accordingly. Deep ...
can be used to filter on the session layer but will effectively disarm encryption protocols like
TLS and
SSL between the appliance and the protocol server (i.e. web server).
Protocol servers
Protocol servers using a request / response model, such as
FTP servers or typically
Web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
s may use a central
in-memory key-value database, like
Redis or
Aerospike, for session management. A rate limiting algorithm is used to check if the user session (or IP address) has to be limited based on the information in the session cache.
In case a client made too many requests within a given time frame,
HTTP
HTTP (Hypertext Transfer Protocol) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, wher ...
servers can respond with status code
429: Too Many Requests.
However, in some cases (i.e. web servers) the session management and rate limiting algorithm should be built into the application (used for dynamic content) running on the web server, rather than the web server itself.
When a protocol server or a network device notice that the configured request limit is reached, then it will offload new requests and not respond to them. Sometimes they may be added to a
queue to be processed once the input rate reaches an acceptable level, but at peak times the request rate can even exceed the capacities of such queues and requests have to be thrown away.
Data centers
Data centers widely use rate limiting to control the share of resources given to different tenants and applications according to their service level agreement.
A variety of rate limiting techniques are applied in data centers using software and hardware. Virtualized data centers may also apply rate limiting at the hypervisor layer. Two important performance metrics of rate limiters in data centers are resource footprint (memory and CPU usage) which determines scalability, and precision. There usually exists a trade-off, that is, higher precision can be achieved by dedicating more resources to the rate limiters. A considerable body of research with focus on improving performance of rate limiting in data centers.
[
]
See also
*Bandwidth management
Bandwidth management is the process of measuring and controlling the communications (traffic, packets) on a network link, to avoid filling the link to capacity or overfilling the link,https://www.internetsociety.org/wp-content/uploads/2017/08/BWro ...
* Bandwidth throttling
* Project Shield
; Algorithms
* Token bucket
* Leaky bucket
* Fixed window counter
* Sliding window log
* Sliding window counter
; Libraries
ASP.NET Web API rate limiter
ASP.NET Core rate limiting middleware
Rate limiting for .NET (PCL Library)
Rate limiting for Node.JS
h1>
References
[{{cite web
, title=An alternative approach to rate limiting
, url=https://medium.com/figma-design/an-alternative-approach-to-rate-limiting-f8a06cf7c94c
, website=Medium
, author=Nikrad Mahdi
, date={{format date, 2017, 04, 12
, accessdate={{format date, 2017, 04, 16
]
Network performance