liveBook · Manning

Rate limit

As explained in Distributed Machine Learning Patterns

Rate limiting is a technique that restricts the number or frequency of requests a service processes within a specified interval or concurrency bound.

Rate limiting protects model serving systems from request surges by placing requests in a queue and restricting processing frequency or concurrency. section 4.4.2

A practical rate-limiting design:

  • Check incoming requests against the configured limit. section 4.4.2
  • Process only the permitted requests concurrently and hold the remainder in the queue. section 4.4.2
  • Apply stricter limits to anonymous users and higher limits after login to support monitoring and auditing. section 4.4.2

Two-request concurrency limit

Four model serving requests arrive. Two execute immediately under the limit; the other two wait until those requests finish. section 4.4.2

Figure 4.17 A flowchart of four model serving requests sent to the model serving system. However, only two are under the current rate limit, which allows a maximum of two concurrent model serving requests. Once the system has finished processing those two requests, it will proceed to the remaining two requests in the queue.
04-17

Visualizes queue admission, concurrent processing, and deferred requests. section 4.4.2

Figure 4.18 A comparison of behaviors from different rate limits applied to authenticated and unauthenticated users
04-18

Compares rate-limit behavior for authenticated and unauthenticated users. section 4.4.2

How Distributed Machine Learning Patterns covers it

How deep it goes
Explains queue admission, concurrency limits, authentication-based policies, monitoring, and auditing without detailing a specific implementation.
Examples
Uses four requests under a two-concurrent-request limit and contrasts anonymous with authenticated access.
What it assumes
Assumes model serving and API requests; teaches queue-based request control from the operational problem of overload.
What you can do after
Operate model serving APIs with bounded concurrency and differentiated access limits.
How it connects
Connects model serving with queues, denial-of-service attacks, authentication, monitoring, and auditing.

Also explained in

Compare how 14 books explain rate limit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Distributed Machine Learning Patterns. The section links point to the parts of the book it draws on.