batching
Doing many similar pieces of work together in one operation, such as loading all needed owners with one query instead of one query each.
In more detail
Batching is the usual cure for an N+1 query. For large exports, batch work also means handing the whole job to a background process and letting the client poll.
Example
In the browser: The course batches DOM reads before writes, inserts many nodes at once with a DocumentFragment, and relies on MutationObserver batching several changes into one callback.Related terms
- N+1 query problem — A performance bug where code runs one query for a list and then one more query per item, so N items cost N+1 queries.
- job resource — A resource that represents long-running work, answered with 202 Accepted and a Location the client can poll for progress and the result.
- layout thrashing — Slowing a page by repeatedly changing styles and then reading sizes, forcing the browser to recalculate layout again and again.
- DocumentFragment — A lightweight container for DOM nodes that is not part of the page, used to build many nodes and insert them all in one step.
- MutationObserver — A browser object that watches part of the DOM and reports changes, such as added nodes or changed attributes, in batches.
- deduplication — Detecting and discarding repeated copies of the same message or request, usually by remembering identifiers already processed.
- idempotency — The property of an operation that gives the same result whether you run it once or many times, because a repeat run finds nothing left to do.
- agent — A program that runs in the background on every managed machine, checking in with a central server and applying the configuration it is given.
Taught in
- Large Payloads And Streaming — Modern API Architecture: REST, GraphQL & gRPC
- Performance Optimization — Modern API Architecture: REST, GraphQL & gRPC
- Layout, Reflow, Paint And GPU Compositing Layers — Frontend Architecture & Web Platform
- DOM Manipulation: DocumentFragment And HTML Templates — Frontend Architecture & Web Platform
- MutationObserver: Reactive DOM Watching Without Polling — Frontend Architecture & Web Platform
- Back Of The Envelope Estimation: Traffic And Throughput — Scalable System Design & Distributed Architecture
- Cache Invalidation And The Three Hard Cases — Scalable System Design & Distributed Architecture
- Worked Design Two: Scaling Chat Fan Out — Scalable System Design & Distributed Architecture
- Worked Design Three: A Metrics Ingestion Pipeline — Scalable System Design & Distributed Architecture