mirror of
https://github.com/livekit/livekit.git
synced 2026-09-12 00:35:40 +00:00
Stream now implements io.ReaderFrom, so http.Request.Write's bufio.Writer delegates the body to it and a large upload flows in MaxFrameSize frames instead of ~4KiB ones - 16x fewer frames, marshals, scheduler cycles and websocket messages. Large frame buffers (>= 16KiB) are drawn from a per-conn sync.Pool and recycled by the scheduler after each write, so a big upload stops allocating a buffer per frame; small/webhook bodies stay below the threshold and use a right-sized make, so the average request is unaffected. Measured on a 1MiB upload: -82% allocations, -66% latency, -17% bytes; a small GET/POST is unchanged.