We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Api Design Protocols
Free preview: the first 2 parts of this 7-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Api Design Protocols
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
You need milk, bread, eggs, butter, and cheese. Do you make five separate trips to the grocery store, one for each item? Of course not. You make one trip and buy everything at once.
Request batching applies the same logic to API calls. Instead of sending 100 individual requests to create 100 users, you send one request containing all 100 users. One connection, one authentication check, one round trip, one response.
Every request has overhead: lookup, TCP handshake, TLS negotiation, HTTP headers, authentication, parsing. When you send 100 individual requests, you pay that overhead 100 times. When you batch them into one request, you pay it once. At scale, the difference is enormous, both in latency and server load.
Facebook's Graph API supports batching up to 50 operations in a single request. Google's API supports batch requests across multiple endpoints. Stripe supports bulk creation of payment intents. It's a universal optimization.
Individual requests (inefficient):
POST /api/users { "name": "Alice" } → 201 Created
POST /api/users { "name": "Bob" } → 201 Created
POST /api/users { "name": "Charlie" } → 201 Created
// 3 round trips, 3x overhead
Batched request (efficient):
POST /api/users/batch
{
"operations": [
{ "name": "Alice" },
{ "name": "Bob" },
{ "name": "Charlie" }
]
}
→ 200 OK
{
"results": [
{ "status": 201, "data": { "id": "1", "name": "Alice" } },
{ "status": 201, "data": { "id": "2", "name": "Bob" } },
{ "status": 422, "error": "Duplicate email" }
]
}
Key design decisions:
It is easy and good
“It is really nice and good Please join the course”