Course contentsShow
← System Design
Lesson 1789 of 1,91943. Real-World System: Rate Limiter ServiceFree lesson

Client-Side vs Server-Side Rate Limiting

Understanding where rate limiting enforcement happens and why server-side is authoritative.

Client-Side vs Server-Side Rate Limiting

You'll learn: Where rate limiting logic lives and why the server always has the final say.

The Two Enforcement Points

Rate limiting can be implemented in two places:

Client-side means the calling application throttles itself before sending requests. Think of this as self-discipline—your app checks "Have I made too many requests?" and voluntarily waits before making another call.

Server-side means the service itself enforces limits by tracking requests and rejecting those that exceed thresholds. This is the bouncer at the door who actually counts and turns people away.

Why Client-Side Isn't Enough

Client-side rate limiting is a courtesy optimization:

  • Reduces wasted network calls when you know you'll be rejected
  • Improves user experience by catching limits early
  • Cannot be trusted because clients can be modified, bypassed, or malicious

Imagine a nightclub where guests promise "I won't come in if I've visited 10 times tonight." Nice gesture, but you still need a bouncer with a real list.

Server-Side Is Authoritative

The server must implement rate limiting because:

  • Security: Prevents abuse from bad actors who ignore client-side limits
  • Fairness: Ensures all clients play by the same rules
  • Accuracy: Only the server sees the complete request picture across all clients
  • Enforcement: Can actually reject requests and return 429 (Too Many Requests)

Even if 99% of clients respect limits, the 1% who don't would overwhelm your system without server-side enforcement.

The Ideal Pattern

Use both: client-side for efficiency, server-side for authority. The client tries to be polite, but the server verifies and enforces.

Key Takeaway: Client-side rate limiting is an optimization, but server-side enforcement is mandatory—never trust the client to protect your system.