chen08209 说明 Concord 将合并 Fake-IP 缓存写入并升级持久化格式
chen08209 表示,提交 9b15a9f2 将 profile.store-fake-ip 的新映射写入按首次变更起固定 30 秒窗口合并,正常停止或重载时立即落盘并压缩;持久化改用带 CRC32 校验的 CFI2 快照与追加增量帧,旧 CFI1 文件下次写入时自动升级,异常中断后的损坏尾帧会被忽略并截断。他称特定 2 万条缓存、每窗口新增 100 个域名的基准中,写入字节量下降约 100 至 200 倍;非正常终止仍可能丢失最后 30 秒的新映射。改动将纳入下一次发行。
作者原文@chen08209Implemented in 9b15a9f2 (will be included in the next release):
profile.store-fake-ipnow coalesces new fake-IP allocations over a fixed 30 s window starting from the first dirty change (instead of rewriting the entire pool on every change notification) and flushes immediately with compaction on graceful stop or config reload.- Persistence now uses a single-file framed format (
CFI2: snapshot frame + CRC32-checked append-only delta frames withfdatasync), compacting atomically (with Unix parent-directoryfsync) once appended deltas exceed the snapshot size or on shutdown/reload, bounding steady-state write amplification to ≤2×. In a 20,000-entry pool benchmark (100 new domains per 30 s window), appending deltas cuts bytes written versus same-window full rewrites by ~200× within the first compaction cycle (41.3 KB vs 8.43 MB over 10 windows) and ~100× in steady state including periodic compaction.- Existing
CFI1cache files are read transparently and upgraded toCFI2on the next write; truncated, zero-filled, or corrupt trailing frames after an abrupt kill are ignored and truncated back to the last valid frame. On an ungraceful kill, up to the last 30 s of newly allocated mappings may be lost (documented indocs/compatibility.md).