Skip to content

perf(ingest): reuse compression buffers across imported files - #763

Merged
wesm merged 1 commit into
mainfrom
perf-ingest-hotpaths
Oct 2, 2026
Merged

wesm merged 1 commit into
mainfrom
perf-ingest-hotpaths

Conversation

@wesm

@wesm wesm commented Oct 2, 2026

Copy link
Copy Markdown
Member

Speeds up local imports and HTTP uploads by reusing compression buffers between files. Previously, each file above the compression threshold created a new zstd encoder. This pins the merged Kit commit from kenn-io/kit#146, pending a tagged release containing the fix.

Measured medians from three runs per case on Linux/amd64 with CGO SQLite:

Workload Before After
Import benchmark: 128 × 8 KiB 272 ms 171 ms
Allocated bytes for that import batch 235 MB 15.6 MB
One CLI directory import: 2,048 × 8 KiB 5.71 s 5.07 s
Sequential HTTP uploads: 1,024 × 8 KiB 3.14 s 2.93 s

All inputs were unique synthetic incompressible files in fresh vaults. Source generation and daemon startup were excluded. The CLI/HTTP binaries used the same Kit base with and without encoder reuse; the final dependency pin was also measured with BenchmarkAddPaths. These are not M2 measurements.

Encoder reuse retains buffers between writes. In one 2,048-file daemon run, peak resident memory rose from approximately 106 MiB to 122 MiB; garbage collection can discard idle pool entries. Compression settings, on-disk format, and per-file durable publication remain unchanged.

The existing TestServerShutdownDrainsActiveBrowserUpload exceeds its one-second deadline at default test concurrency on this host with both main (Kit v0.29.0) and this branch. It passes 20 isolated runs and the complete API package with -parallel=8.

Every file above the compression threshold previously created a new zstd
encoder. The allocation profile showed encoder setup consuming most of
the allocated memory in a bulk import.

Adopt the Kit encoder-reuse fix so both local imports and HTTP uploads
benefit without changing compression policy or per-file durability. Pin
the exact reviewed commit until a tagged Kit release includes it.

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@roborev-ci

roborev-ci Bot commented Oct 2, 2026

Copy link
Copy Markdown

roborev: Combined Review (fb8c1e9)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex | Total: 3m4s

@wesm
wesm merged commit 7ccce80 into main Oct 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant