Query batching layer
Your task
Design a batching/coalescing layer in front of a downstream data store to fix an N+1 query explosion: a GraphQL/page-render layer issues thousands of single-key lookups (getUser(id)) per request burst, and each becomes its own round trip, saturating the database. Design a layer that automatically batches concurrent single-key reads into multi-key fetches and deduplicates repeated keys, without the callers changing their code much.
It covers
- Batching
- Deduplication
- Fan in