Repository navigation
Small wins for the session layer: zstd level by default (+ measured numbers), and corpus-gated acceptance for the #4416 roadmap #4948
MedicineKing
started this conversation in
Ideas
Replies: 1 comment
|
The handbook now carries a reusable framing and compression-level evaluation guide: https://github.com/sandbaseai/deepseek-harness-handbook/blob/main/docs/en/architecture/session-framing-performance.md. It separates whole-log measurements from per-batch latency, treats level 9 as a measured tradeoff rather than a universal default, and keeps every writer change behind the #4945 corruption-corpus gate. Independent community documentation; upstream remains the implementation authority. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Small wins for the session layer: zstd level by default (+ measured numbers), and corpus-gated acceptance for the #4416 roadmap
Part 1 — zstd: the JSONL backend compresses with defaults, and the numbers say a lot
The asymmetry no one has mentioned.
session-persistence-sqliteships a tuned data dictionary (resources/zstd-dictionary.bin, loaded incompression.ts:42-46) and feeds it to every compress/decompress.session-persistence-jsonlcompresses withCHECKSUM_OPTIONS = { ZSTD_c_checksumFlag }and nothing else (zstd.ts:18-19) — no level, no dictionary. Session logs are textbook zstd material (JSON structure + recurring system-event templates), so I measured the gap on real artifacts:Conclusions:
compressionLevel: 9is the sweet spot: ~11% smaller storage on whole-log measurement. Because the backend compresses per append batch (not per whole log), I measured the batch path directly: 100 turn-sized batches (median 60.9 KB/batch), 5 runs each, median-of-medians — default 0.25 ms/batch, level 9 1.14 ms/batch, i.e. +0.9 ms per batch for ~6.6% smaller batches, which is same-order as the whole-log result. Write-latency impact at the per-batch level is therefore sub-millisecond to low-single-digit ms, not the whole-file 328 ms in the table (that is cold-rewrite worst case only). And for context: fsync dominates the per-batch write path (appendLines= write +handle.sync()per batch) — a +0.9 ms compression delta is within its jitter. Read path is untouched (level affects the writer only).Suggestion: make the JSONL compression level configurable with
9as the new default (parameterizeCHECKSUM_OPTIONS; one-line change plus a setting). Store-side win with writer-side and reader side both safe. (Measurement rig:zstdCompressSyncover real-session text, warm run, medians of 5; per-batch rigs use 100 turn-sized batches — happy to share the script.)Part 2 — verify-first: every stage of the #4416 roadmap should land behind the #4945 corpus gate
The #4416 roadmap (7 stages A-G: tail-index sidecar + JSONL seek, frame-merge, detached projection, snapshot-on-demand, header cache, streaming pagination, default SQLite / format evolution) is an excellent, measured plan — but none of its stages defines its acceptance criteria against the corruption corpus. Every stage rewrites or bypasses parts of the read path — which is precisely the most fragile surface in this codebase (the corruption family across #1333…#4662 lives there).
Proposal: bind each stage to the #4945 regression gate before merge:
I can run the first pass of the gate on any candidate stage (the pipeline is single-command, zero install, official-path referee:
Session.fromRestore/assertZstdHeaderFrame/ scanner contract — all unmodified npm 0.1.1-rc.2) and publish the before/after tables in the thread.What this costs
Part 1: one-line parameterization + a default change (plus the measurement methodology above if you want reproducibility). Part 2: a review habit plus the existing gate. Both are gated on the same referee, so neither can silently break the committed region.
All reactions