From f681867692f575b078f46afaf07060faed457461 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Tue, 29 Sep 2026 04:23:26 +0800 Subject: p59: Sim 多世界并存后台压测(内存/GC 增长曲线证据单,只读) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 目标:量化「多世界并存 × 天数」的内存/GC 增长,收口 P49 范围外项。 口径:新增 Headless `--profile-multiworld `, N 个 Sim 世界同时存活,每轮 Parallel.For 各推进 sampleEveryDays 天并采样一行 (worlds/events/rumors/annals/memory_entries/gc_live_mb/working_set_rss_mb/elapsed_s, 行尾 flush);未改 Kernel/Sim 任何语义(Sim.initialWorldN / Sim.step 原样调用)。 标定:1 世界 × 2 天探针 = 34.2s(与 overnight-status 的 34.6s 一致),据此定 N=10 × 20 天。 运行:独立 systemd --user transient unit living-village-multiworld.service (scripts/profile-multiworld.sh,StandardOutput=append: + exec 2>&1,state.json 记 pid/unit/log/commit/参数/起止/exit)。主运行 wall=1024.4s(17.1min < 40min),exit=0。 结论(artifacts/perf-multiworld/20260928T195839Z/README.md): - 随世界数近似线性,未超线性:N=1 vs N=10(同日 D=20)annals/memory_entries 恰 10×、 rumors 9.67×、gc_live 8.81×(每世界 1.23MB,共享运行时开销摊薄)。 - RSS 有界无泄漏:N=10 39→峰值123(day8)→稳定104~112MB;每 2 天一轮墙钟恒 101~105s。 原因是历史集合有界(rumorRetentionDays=3 / rumorCapacity=16384 / maxAnnalEntries=128 / Mind.Memory 上限),约 day4 后进入稳态。 - 两轮世界0 digest 一致(2364CB74…)→ 并存+并行不改变单世界语义。 - 数字未越界 → 明确「不修」;只读本 slice 不修 Kernel/Sim。 回归:Desktop 304/304 + Kernel 119/119;--performance-baseline ×3 digest 953775FAEB2F… 不变,performance_determinism=PASS。未 push。 --- src/LivingVillage.Headless/BatchOutput.fs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/LivingVillage.Headless/BatchOutput.fs') diff --git a/src/LivingVillage.Headless/BatchOutput.fs b/src/LivingVillage.Headless/BatchOutput.fs index 971da97..aa79391 100644 --- a/src/LivingVillage.Headless/BatchOutput.fs +++ b/src/LivingVillage.Headless/BatchOutput.fs @@ -42,6 +42,23 @@ module BatchOutput = "batch_summary worlds=%d passed=%d failed=%d old_passed=%d/%d ratio_min=%.3f ratio_max=%.3f gini_min=%.3f gini_max=%.3f elapsed_s=%.1f workers=%d wall_s=%.1f" worlds passed failed oldPassed worlds ratioMin ratioMax giniMin giniMax elapsedSeconds workers elapsedSeconds + /// 多世界并存压测采样行:worlds/day 与各历史集合计数 + GC live set + OS RSS + 墙钟。 + let multiworldLine + (worlds: int) + (day: int64) + (totalDays: int64) + (events: int64) + (rumors: int64) + (annals: int64) + (memoryEntries: int64) + (gcLiveBytes: int64) + (rssBytes: int64) + (elapsedSeconds: float) : string = + let mb (bytes: int64) = float bytes / (1024.0 * 1024.0) + sprintf + "multiworld_sample worlds=%d day=%d/%d events=%d rumors=%d annals=%d memory_entries=%d gc_live_mb=%.2f working_set_rss_mb=%.2f elapsed_s=%.1f" + worlds day totalDays events rumors annals memoryEntries (mb gcLiveBytes) (mb rssBytes) elapsedSeconds + /// --cost-probe 单段输出:ticks/s、墙钟、分配与 GC 全部来自真实测量。 let costLine (days: int64) -- cgit v1.2.3