Re:An Introduction to APIs
by pixelatedindex on Sunday July 30, 2023 @08:51PM
(#36937708)
Noob question, why is batching redundant in HTTP2?
[ Parent
| on HN ]
HTTP/2 Supports multiplexing, so you can send multiple requests at once on the same connection
Re:An Introduction to APIs
by RaisingSpear on Monday July 31, 2023 @05:26AM
(#36940332)
Doesn't seem redundant to me. Even if you can multiplex requests, batches still have certain advantages, e.g.
- compression is often more efficient with larger payloads
- can reduce per-request overheads, e.g. do authentication once rather than X times
- easier to coalesce multiple queries, e.g. merge similar requests to enable data retrieval via a bulk query, instead of X individual queries
It isn't.
Batching means combining multiple logical operations in a single physical request. HTTP/2 muxes N logical requests over 1 physical connection, which is good, but the application will still process requests independently. You always want to batch workloads into single requests if you can, HTTP/2 doesn't change this.