From d79d2804582ed7486defb445565cd1be3baeaa1c Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sat, 1 Aug 2026 03:48:11 -0700 Subject: [PATCH] test: distinguish phase174 NVMe stability scopes --- .../frontend/nvme/phase174_fixed_work_test.go | 14 +++++++++ .../phase174-d2-nvme-tcp-fixed-work-qa.md | 6 ++-- .../run-phase174-nvme-tcp-fixed-work-gate.sh | 30 +++++++++++++++++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/seaweed-block/core/frontend/nvme/phase174_fixed_work_test.go b/seaweed-block/core/frontend/nvme/phase174_fixed_work_test.go index d350e6e19e..e91a72f9d2 100644 --- a/seaweed-block/core/frontend/nvme/phase174_fixed_work_test.go +++ b/seaweed-block/core/frontend/nvme/phase174_fixed_work_test.go @@ -88,6 +88,12 @@ type phase174NVMeFixedWorkResult struct { PrimaryWALAppendLockWaitNanos uint64 `json:"primary_wal_append_lock_wait_ns"` PrimaryWriteCommitWaitNanos uint64 `json:"primary_write_commit_lock_wait_ns"` PrimaryDirtyMapNanos uint64 `json:"primary_dirty_map_ns"` + FlusherCycles uint64 `json:"foreground_flusher_cycles"` + FlusherCycleNanos uint64 `json:"foreground_flusher_cycle_ns"` + FlusherExtentWriteOps uint64 `json:"foreground_flusher_extent_write_ops"` + FlusherExtentWriteNanos uint64 `json:"foreground_flusher_extent_write_ns"` + FlusherExtentSyncOps uint64 `json:"foreground_flusher_extent_sync_ops"` + FlusherExtentSyncNanos uint64 `json:"foreground_flusher_extent_sync_ns"` PrimaryStableLSN uint64 `json:"primary_stable_lsn"` PrimaryHeadLSN uint64 `json:"primary_head_lsn"` FlusherPhaseReset bool `json:"flusher_phase_reset"` @@ -203,6 +209,7 @@ func phase174RunNVMeFixedWork( targetBefore := target.Stats() adapterBefore := backend.WriteProfile() storageBefore := store.WriteInstrumentation() + flusherBefore := store.FlusherInstrumentation() payloads := phase174NVMePayloads(phase174NVMeAPIOperations, set, run, 0x1741) foreground, latencies, err := phase174NVMeWrites(t, client, writers, 0, payloads, true) if err != nil { @@ -211,6 +218,7 @@ func phase174RunNVMeFixedWork( targetAfter := target.Stats() adapterAfter := backend.WriteProfile() storageAfter := store.WriteInstrumentation() + flusherAfter := store.FlusherInstrumentation() flushStart := time.Now() if err := phase174NVMeFlush(t, client); err != nil { t.Fatalf("final flush: %v", err) @@ -271,6 +279,12 @@ func phase174RunNVMeFixedWork( PrimaryWALAppendLockWaitNanos: storageAfter.WALAppendLockWaitNanos - storageBefore.WALAppendLockWaitNanos, PrimaryWriteCommitWaitNanos: storageAfter.WriteCommitLockWaitNanos - storageBefore.WriteCommitLockWaitNanos, PrimaryDirtyMapNanos: storageAfter.DirtyMapUpdateDurationNanos - storageBefore.DirtyMapUpdateDurationNanos, + FlusherCycles: flusherAfter.CyclesStarted - flusherBefore.CyclesStarted, + FlusherCycleNanos: flusherAfter.CycleDurationNanos - flusherBefore.CycleDurationNanos, + FlusherExtentWriteOps: flusherAfter.ExtentWriteOps - flusherBefore.ExtentWriteOps, + FlusherExtentWriteNanos: flusherAfter.ExtentWriteDurationNanos - flusherBefore.ExtentWriteDurationNanos, + FlusherExtentSyncOps: flusherAfter.ExtentSyncOps - flusherBefore.ExtentSyncOps, + FlusherExtentSyncNanos: flusherAfter.ExtentSyncDurationNanos - flusherBefore.ExtentSyncDurationNanos, PrimaryStableLSN: stable, PrimaryHeadLSN: head, FlusherPhaseReset: true, CloseRecoverComplete: true, CorrectnessSamples: samples, MountedShapeComparable: false, MountedThroughputRatioAllowed: false, diff --git a/seaweed-block/internal/docs/qa-assignments/phase174-d2-nvme-tcp-fixed-work-qa.md b/seaweed-block/internal/docs/qa-assignments/phase174-d2-nvme-tcp-fixed-work-qa.md index 6dedadb4fe..6227558619 100644 --- a/seaweed-block/internal/docs/qa-assignments/phase174-d2-nvme-tcp-fixed-work-qa.md +++ b/seaweed-block/internal/docs/qa-assignments/phase174-d2-nvme-tcp-fixed-work-qa.md @@ -48,8 +48,10 @@ SW_BLOCK_PHASE174_NVME_STORE_DIR=/data/nvme/block/-stores \ least five measured LBAs retain the expected bytes. 7. Capture merged CPU, block, and mutex profiles for five four-queue diagnostic runs. -8. Record stability honestly. A range above `1.25x` is HOLD evidence, not a - reason to delete a slow run or select an architecture candidate. +8. Record the four-writer admission stability and all-shapes stability + separately. A range above `1.25x` is HOLD evidence, not a reason to delete + a slow run or select an architecture candidate. Correlate four/eight-writer + foreground time with the existing WAL flusher counters. 9. All test stores and the test binary are removed after the gate. ## Mounted Boundary diff --git a/seaweed-block/scripts/run-phase174-nvme-tcp-fixed-work-gate.sh b/seaweed-block/scripts/run-phase174-nvme-tcp-fixed-work-gate.sh index 097cf74032..6068c3fc73 100644 --- a/seaweed-block/scripts/run-phase174-nvme-tcp-fixed-work-gate.sh +++ b/seaweed-block/scripts/run-phase174-nvme-tcp-fixed-work-gate.sh @@ -157,6 +157,7 @@ go tool pprof -top -nodecount=40 "${TEST_BINARY}" "${mutex_profiles[@]}" \ python3 - "${RESULTS}" "${SUMMARY}" "${RUNS}" "${MAX_RANGE}" <<'PY' import json +import math import statistics import sys from collections import defaultdict @@ -224,8 +225,26 @@ def rate_range(writers, set_id=None): def median_per_op(rows, field): return statistics.median(row[field] / row["api_operations"] for row in rows) +def correlation(rows, field): + xs = [float(row["foreground_ns"]) for row in rows] + ys = [float(row[field]) for row in rows] + x_mean = statistics.mean(xs) + y_mean = statistics.mean(ys) + numerator = sum((x - x_mean) * (y - y_mean) for x, y in zip(xs, ys)) + x_norm = math.sqrt(sum((x - x_mean) ** 2 for x in xs)) + y_norm = math.sqrt(sum((y - y_mean) ** 2 for y in ys)) + if x_norm == 0 or y_norm == 0: + return 0.0 + return numerator / (x_norm * y_norm) + four = all_rows(4) -frontend_stable = all(rate_range(4, set_id) <= max_range for set_id in (1, 2)) and rate_range(4) <= max_range +eight = all_rows(8) +four_stable = all(rate_range(4, set_id) <= max_range for set_id in (1, 2)) and rate_range(4) <= max_range +all_shapes_stable = all( + rate_range(writers, set_id) <= max_range + for writers in (1, 4, 8) + for set_id in (1, 2) +) and all(rate_range(writers) <= max_range for writers in (1, 4, 8)) target_per_op = median_per_op(four, "target_write_ns") roundtrip_per_op = median_per_op(four, "nvme_round_trip_nonbackend_ns") dominant = "target_backend_call" if target_per_op >= roundtrip_per_op else "nvme_tcp_round_trip_nonbackend" @@ -239,13 +258,18 @@ with open(summary_path, "a", encoding="utf-8") as out: for field in ( "client_write_latency_ns", "nvme_round_trip_nonbackend_ns", "target_write_ns", "adapter_write_ns", "primary_write_commit_lock_wait_ns", "primary_wal_encode_ns", - "primary_wal_append_ns", "primary_dirty_map_ns", + "primary_wal_append_ns", "primary_dirty_map_ns", "foreground_flusher_cycle_ns", + "foreground_flusher_extent_write_ns", "foreground_flusher_extent_sync_ns", ): out.write(f"nvme_tcp_rf1_writers_4_{field}_per_op={median_per_op(four, field):.3f}\n") + out.write(f"nvme_tcp_rf1_writers_4_flusher_foreground_correlation={correlation(four, 'foreground_flusher_cycle_ns'):.3f}\n") + out.write(f"nvme_tcp_rf1_writers_8_flusher_cycle_ns_per_op={median_per_op(eight, 'foreground_flusher_cycle_ns'):.3f}\n") + out.write(f"nvme_tcp_rf1_writers_8_flusher_foreground_correlation={correlation(eight, 'foreground_flusher_cycle_ns'):.3f}\n") out.write(f"nvme_tcp_rf1_dominant_accumulated_boundary={dominant}\n") out.write("nvme_tcp_rf1_counter_reconciliation=true\n") out.write("nvme_tcp_rf1_close_recover_verified=true\n") - out.write(f"nvme_tcp_rf1_stability_gate={'pass' if frontend_stable else 'hold'}\n") + out.write(f"nvme_tcp_rf1_four_writer_stability_gate={'pass' if four_stable else 'hold'}\n") + out.write(f"nvme_tcp_rf1_all_shapes_stability_gate={'pass' if all_shapes_stable else 'hold'}\n") out.write("mounted_shape_comparable=false\n") out.write("mounted_throughput_ratio_allowed=false\n") out.write("architecture_candidate_selected=false\n")