curl -s 'https://www.unum.cloud/docs/ucall/go/batches.md' | claude -p "How would this fit my code?"
A pooled batch endpoint gathers matching requests from every event loop into one queue and hands them to its handler in batches, which suits work that is cheaper per request in bulk, like GPU inference.
Batching dispatches as soon as MinSize requests wait, never more than MaxSize at once, and a smaller batch once its oldest request waited MaxLatency; zero fields mean 1, 32 and 10 milliseconds.
The handler runs on the goroutine polling the endpoint through TakeBatch or TakeBatches, never on an event loop, so a slow batch never stalls the network.
A Batch holds its requests in arrival order, and Take hands one over, to be replied to then or later from any goroutine; a request never taken stays unanswered until the server closes.
The queue holds as many requests as the interfaces admit at once, connections times pipelined requests, and refuses more with 503. PooledBatchEndpoint.Statistics counts batches and requests, and whether each was dispatched on reaching MaxSize, on reaching MinSize, or once MaxLatency passed. Server.LocalBatch takes the same handler and Batching, but each event loop fires its own batches inside TakeCall or TakeCalls, so no goroutine drains them and the handler may reply there; its LocalBatchEndpoint offers only Statistics.
API
Types
BatchingBatching says when a batch endpoint dispatches; zero fields take 1, 32 and 10 milliseconds.