phase124: split nvme tcp target backend shape

This commit is contained in:
pingqiu committed 2026-07-03 00:05:06 -07:00
1 parent 30bad2cc03
commit 0ae73d4add
8 files changed
+873 -60

No files matched your search

@@ -61,6 +61,7 @@ The supported-lab claim is intentionally narrow:
| 121 | Explicit data-plane/frontend IP capability | PASS |
| 122 | 100GbE TCP frontend-address performance baseline | PASS |
| 123 | NVMe/TCP bottleneck triage with independent 100GbE network comparator | PASS |
| 124 | Same-shape local-path vs Block NVMe/TCP split | PASS |
Key QA sign-offs:
@@ -68,6 +69,7 @@ Key QA sign-offs:
- `internal/docs/qa-assignments/phase115-nvme-k8s-multivolume-mounted-path-churn-soak-qa-signoff.md`
- `internal/docs/qa-assignments/phase122-nvme-tcp-100gbe-baseline-qa-signoff.md`
- `internal/docs/qa-assignments/phase123-nvme-tcp-bottleneck-triage-qa-signoff.md`
- `internal/docs/qa-assignments/phase124-nvme-tcp-target-backend-shape-split-qa-signoff.md`
## Performance Baseline
@@ -105,6 +107,27 @@ bottleneck. It still does not identify whether the remaining limit is target
CPU, durable backend, Kubernetes mounted filesystem overhead, or the current
`dd` test shape; Phase 124 splits those before any NVMe/RDMA work.
Phase 124 compares the mounted Block NVMe/TCP path with a same-node Kubernetes
`local-path` PVC using the same `dd` shape:
```text
network_baseline_mibps=3769.28
local_path_seq_write_mibps=324.87
local_path_seq_read_mibps=235.29
block_nvme_seq_write_mibps=118.74
block_nvme_seq_read_mibps=273.50
block_vs_local_read_ratio=1.162
block_vs_local_write_ratio=0.366
shape_fsync_penalty=1.180
top_bottleneck=block_target_or_backend
next_recommendation=phase125_blockvolume_target_cpu_profile
cleanup_status=ok
```
This narrows the next engineering work to the Block write path. It still does
not create a performance/SLO claim, and it does not justify starting NVMe/RDMA
until the target/backend write-side gap is understood.
## Representative Release Smoke
When matching release images exist, the smoke should use the exact image pair:
+14 -5
View File
@@ -663,11 +663,20 @@ Recommended order from here:
were `248.06 MiB/s` / `127.74 MiB/s`. The gate names the remaining
bottleneck as `unknown` because target/backend/Kubernetes/test-shape are
not yet separated, and recommends `phase124_target_backend_shape_split`.
82. Phase 124: NVMe/TCP Target / Backend / Shape Split. **Active**
Compare the current Block NVMe/TCP mounted path with a same-shape
Kubernetes local-path PVC and a minimal write/read shape matrix. This
should distinguish test-shape/filesystem overhead from Block target/backend
overhead before starting a real NVMe/RDMA target.
82. Phase 124: NVMe/TCP Target / Backend / Shape Split. **Closed 2026-07-03,
QA PASS**
Compared the current Block NVMe/TCP mounted path with a same-shape
Kubernetes `local-path` PVC on the same app node. The network baseline was
`3769.28 MiB/s`; local-path write/read were `324.87 MiB/s` /
`235.29 MiB/s`; Block NVMe/TCP write/read were `118.74 MiB/s` /
`273.50 MiB/s`. The read path is not behind local-path, but write is only
`0.366x` local-path, so the next bottleneck class is
`block_target_or_backend`.
83. Phase 125: Block NVMe/TCP Write-Path Profile. **Active**
Profile the write-side Block path before any NVMe/RDMA implementation:
blockvolume CPU/copy path, durable/backend sync cost, and benchmark shape.
The goal is a specific Phase 126 recommendation, not a performance/SLO
claim.
The internal release-train contract is
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
+56 -51
View File
@@ -1,101 +1,106 @@
# Current Plan: Phase 124 NVMe/TCP Target / Backend / Shape Split
# Current Plan: Phase 125 Block NVMe/TCP Write-Path Profile
Status: planning and implementation.
Phase 123 proved the configured data-plane network is not the immediate
bottleneck:
Phase 124 split the current NVMe/TCP performance question with an independent
local-path comparator:
```text
network_baseline_mibps=4106.55
publish_target=10.0.0.1:4420
k8s_mounted_seq_write_mibps=127.74
k8s_mounted_seq_read_mibps=248.06
k8s_mounted_small_write_iops=755.16
network_baseline_mibps=3769.28
block_nvme_seq_write_mibps=118.74
block_nvme_seq_read_mibps=273.50
local_path_seq_write_mibps=324.87
local_path_seq_read_mibps=235.29
block_vs_local_read_ratio=1.162
block_vs_local_write_ratio=0.366
shape_fsync_penalty=1.180
top_bottleneck=block_target_or_backend
cleanup_status=ok
```
The gap is large, but Phase 123 could not distinguish blockvolume target path,
durable backend, Kubernetes mounted filesystem overhead, and current `dd` test
shape. Phase 124 should split those before any NVMe/RDMA implementation work.
The read path is not the immediate problem: Block read was slightly above the
local-path comparator. The write path is the gap: Block write was about 36% of
local-path write on the same app node and same `dd conv=fsync` shape. Phase 125
should profile the Block write path before any NVMe/RDMA implementation work.
## Goal
Compare the current Block NVMe/TCP mounted path against a same-shape Kubernetes
local-path PVC and a small test-shape matrix.
Identify whether the Block NVMe/TCP write gap is mainly:
```text
blockvolume target CPU / copy path
durable backend write or fsync path
current benchmark shape
instrumentation gap / unknown
```
Required output:
```text
phase124_nvme_tcp_target_backend_shape_split_status=ok
phase125_block_nvme_tcp_write_path_profile_status=ok
network_baseline_mibps=<number>
local_path_seq_write_mibps=<number>
local_path_seq_read_mibps=<number>
block_nvme_seq_write_mibps=<number>
block_nvme_seq_read_mibps=<number>
block_vs_local_read_ratio=<number>
block_vs_local_write_ratio=<number>
shape_fsync_penalty=<number|unknown>
top_bottleneck=<test_shape|k8s_mount|block_target_or_backend|unknown>
blockvolume_cpu_peak_percent=<number|unknown>
blockvolume_cpu_avg_percent=<number|unknown>
block_write_duration_ms=<number>
local_write_duration_ms=<number>
write_path_observation=<target_cpu|backend_sync|benchmark_shape|unknown>
top_bottleneck=<target_cpu|backend_sync|benchmark_shape|unknown>
next_recommendation=<specific next phase>
cleanup_status=ok
```
## Why This Is Next
If local-path PVC with the same `dd` shape is also slow, the bottleneck is
mostly test shape / mounted filesystem / host behavior. If local-path is much
faster but Block is slow, the next split is inside blockvolume target/backend.
Only if the current target/backend path approaches the host/Kubernetes baseline
does it make sense to spend on NVMe/RDMA.
NVMe/RDMA only improves the transport. Phase 124 shows the current TCP network
has far more headroom than the mounted Block path, and the read path is not
behind the local-path comparator. The next useful question is narrower: what in
the write path makes Block much slower than a same-node local-path PVC?
## Deliverables
1. Add a Phase 124 gate that creates two PVCs in one clean lab run:
1. Add a Phase 125 gate that reuses Phase 124 and collects write-time runtime
evidence:
```text
local-path PVC
sw-block NVMe/TCP PVC over 10.0.0.x
kubectl top pods --containers during write
blockvolume process CPU snapshots
blockvolume logs around write workload
app pod write duration
local-path comparator write duration
```
2. Run the same minimal matrix on both:
2. If cheap and safe, add minimal target-side timing logs or existing debug
counters for the write path. Do not add a broad observability framework.
3. Preserve non-claims:
```text
seq write with fsync
seq read
optional seq write without fsync, if safe
small write loop
```
3. Preserve Phase 123 context:
```text
route_dev=enp1s0np0
network_baseline_mibps=<iperf3>
nvme_rdma_supported=false
roce_claim_allowed=false
performance_slo_claim_allowed=false
```
4. Emit a recommendation:
4. Emit one concrete recommendation:
```text
phase125_blockvolume_target_cpu_profile
phase125_backend_durable_write_profile
phase125_test_shape_correction
phase125_start_real_nvme_rdma_target
phase126_target_copy_cpu_optimization
phase126_durable_backend_write_optimization
phase126_benchmark_shape_correction
phase126_start_real_nvme_rdma_target
```
## Exit Criteria
- Runner scenario passes and archives the evidence bundle.
- Both PVC paths write/read and clean up.
- The gate names a bottleneck class from ratios, or records `unknown` with a
specific missing comparator.
- Cleanup verifier reports zero residue.
- The gate names a write-path bottleneck class, or records `unknown` with the
missing evidence needed to classify it.
- No RoCE/NVMe-RDMA or performance/SLO claim is added.
## Non-Claims
Phase 124 still does not implement NVMe/RDMA, RoCE, GPU Direct, cuFile/cuObject,
NIXL, production HA, or a performance SLO. It is a split gate for choosing the
next data-plane investment.
Phase 125 still does not implement NVMe/RDMA, RoCE, GPU Direct, cuFile/cuObject,
NIXL, production HA, or a performance SLO. It is a write-path profiling gate for
choosing the next data-plane investment.
@@ -0,0 +1,94 @@
# Phase 124 Finished Plan: NVMe/TCP Target / Backend / Shape Split
Status: closed, QA PASS on 2026-07-03.
## Problem
Phase 123 proved the configured `10.0.0.x` network was not the immediate
bottleneck, but it still could not say whether the low mounted NVMe/TCP numbers
came from Kubernetes mounted filesystem behavior, the current `dd` shape, the
blockvolume target, or the durable/backend path.
## What Changed
- Added `scripts/run-phase124-nvme-tcp-target-backend-shape-split-gate.sh`.
- Added `testops/scenarios/nvme-tcp-target-backend-shape-split-chain.yaml`.
- The gate now compares:
```text
Phase123 network baseline
Phase123 Block NVMe/TCP mounted PVC baseline
same-node Kubernetes local-path PVC baseline
same dd seq write/read/small-write shape
optional local no-fsync write shape
cleanup verifier
```
## Verification
Local checks:
```text
bash -n scripts/run-phase124-nvme-tcp-target-backend-shape-split-gate.sh
swblock validate testops/scenarios/nvme-tcp-target-backend-shape-split-chain.yaml
```
Runner gate:
```text
nvme-tcp-target-backend-shape-split-chain PASS
28 actions: 28 passed, 0 failed
```
Key evidence:
```text
network_baseline_mibps=3769.28
block_nvme_seq_write_mibps=118.74
block_nvme_seq_read_mibps=273.50
local_path_seq_write_mibps=324.87
local_path_seq_read_mibps=235.29
block_vs_local_read_ratio=1.162
block_vs_local_write_ratio=0.366
shape_fsync_penalty=1.180
top_bottleneck=block_target_or_backend
next_recommendation=phase125_blockvolume_target_cpu_profile
cleanup_status=ok
```
QA sign-off:
```text
internal/docs/qa-assignments/phase124-nvme-tcp-target-backend-shape-split-qa-signoff.md
```
## Product Meaning
The result narrows the next engineering question. The read path is not the
first suspect because Block read was slightly above local-path read in this
shape. The write path is the gap: local-path wrote about 2.7x faster than Block
NVMe/TCP using the same app node and same `dd conv=fsync` shape.
This means the next phase should profile Block write-side execution before any
RDMA target work. A faster transport is unlikely to fix a target/backend write
path that is already below the local Kubernetes storage comparator.
## Next Step
Phase 125 should profile the Block write path:
```text
blockvolume CPU during seq write
per-write target/copy/backend timing
durable/backend fsync cost
read-vs-write asymmetry
```
The expected output is a concrete choice between target CPU/copy optimization,
durable backend write optimization, or a corrected benchmark shape.
## Non-Claims
Phase 124 does not implement or validate NVMe/RDMA, RoCE, GPU Direct,
cuFile/cuObject, NIXL, production HA, broad host compatibility, or a
performance SLO.
+11 -4
View File
@@ -352,9 +352,13 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
versus mounted Block NVMe/TCP read/write of `248.06 MiB/s` / `127.74 MiB/s`.
The network is not the immediate bottleneck, but the remaining bottleneck is
still `unknown` because target/backend/Kubernetes/test-shape are not split.
- Phase 124 is active for NVMe/TCP target/backend/test-shape split. It should
compare Block NVMe/TCP against a same-shape local-path PVC before choosing
NVMe/TCP optimization, backend work, or a real NVMe/RDMA target.
- Phase 124 is closed. It compared Block NVMe/TCP against a same-shape
`local-path` PVC on the same app node. Block read (`273.50 MiB/s`) was not
behind local-path read (`235.29 MiB/s`), but Block write (`118.74 MiB/s`) was
only `0.366x` local-path write (`324.87 MiB/s`). The next bottleneck class is
write-side `block_target_or_backend`, not network/RDMA.
- Phase 125 is active for Block NVMe/TCP write-path profiling: blockvolume CPU,
copy path, durable/backend sync cost, and benchmark-shape validation.
- Later protocol candidates: complete a real NVMe/RDMA target, characterize
NVMe/TCP performance, or bridge to object/NIXL acceleration where the product
surface is object/storage rather than block PVC. Keep these separate so
@@ -946,7 +950,10 @@ Approximate engineering effort if scope remains tight:
- Phase 123 is closed for NVMe/TCP bottleneck triage. The 10.0.0.x network
comparator reached `4106.55 MiB/s`, far above mounted Block NVMe/TCP, so the
next split is target/backend/Kubernetes/test-shape rather than RDMA.
- Phase 124 is active for the NVMe/TCP target/backend/test-shape split.
- Phase 124 is closed for the NVMe/TCP target/backend/test-shape split.
Same-shape local-path comparison narrowed the gap to Block write-side
target/backend behavior.
- Phase 125 is active for Block NVMe/TCP write-path profiling.
- Phase 41-44 are the Operation Layer v0.5 release train: lifecycle-owner
foundation, real API/admission proof, first bounded finalizer mutation, and
delete lifecycle close gate.
@@ -0,0 +1,113 @@
# Phase 124 NVMe/TCP Target / Backend / Shape Split QA Sign-off
Verdict: PASS.
Validated on: 2026-07-03.
Environment: m02 k3s lab. The gate used the configured frontend/data-plane map
`m01=10.0.0.1,m02=10.0.0.3`, reused the Phase 123 network + Block NVMe/TCP
path, then compared a same-shape `local-path` PVC on the same app node.
## Runner Gate
Command:
```powershell
C:\work\swblock.exe run `
--env product_root=/tmp/seaweed_block `
--env ssh_key=C:/work/dev_server/testdev_key `
testops\scenarios\nvme-tcp-target-backend-shape-split-chain.yaml
```
Runner result:
```text
=== nvme-tcp-target-backend-shape-split-chain === PASS (4m5.661s)
28 actions: 28 passed, 0 failed
run bundle: results\20260702-235727-bcfd
```
Summary:
```text
phase124_nvme_tcp_target_backend_shape_split_status=ok
frontend_transport=tcp
frontend_ip_map=m01=10.0.0.1,m02=10.0.0.3
frontend_network_class=100gbe_tcp
nvme_rdma_supported=false
roce_claim_allowed=false
performance_slo_claim_allowed=false
test_shape=dd_exec_baseline
network_baseline_mibps=3769.28
publish_target=10.0.0.1:4420
route_dev=enp1s0np0
publish_target_network_class=100gbe_tcp
management_ip=192.168.1.181
frontend_ip=10.0.0.1
block_app_node=m02
local_path_storageclass=local-path
block_nvme_seq_write_mibps=118.74
block_nvme_seq_read_mibps=273.50
block_nvme_small_write_iops=721.13
local_path_seq_write_mibps=324.87
local_path_seq_read_mibps=235.29
local_path_seq_write_nofsync_mibps=383.23
local_path_small_write_iops=630.54
block_vs_local_read_ratio=1.162
block_vs_local_write_ratio=0.366
local_vs_network_read_ratio=0.062
local_vs_network_write_ratio=0.086
shape_fsync_penalty=1.180
top_bottleneck=block_target_or_backend
next_recommendation=phase125_blockvolume_target_cpu_profile
cleanup_status=ok
```
Final cleanup verifier:
```text
cleanup_status=ok
k8s_residue_count=0
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=0
```
## Interpretation
The network is still far ahead of both mounted paths:
```text
network_baseline_mibps=3769.28
local_path_seq_write_mibps=324.87
block_nvme_seq_write_mibps=118.74
```
The important split is asymmetric:
- Block read is not below local-path read: `273.50 MiB/s` vs `235.29 MiB/s`.
- Block write is much lower than local-path write: `118.74 MiB/s` vs
`324.87 MiB/s`.
- The local-path no-fsync shape improves only modestly:
`shape_fsync_penalty=1.180`, so this is not simply a `conv=fsync` artifact.
The next work should profile the Block write path first: target CPU, per-write
copying, durable/backend write path, and sync behavior. Starting NVMe/RDMA now
would not address the demonstrated write-side gap.
## Harness Notes
- The gate runs the Block NVMe/TCP path through Phase 123, then tears it down
before creating the local-path PVC. This keeps the comparison in one clean
runner bundle while avoiding storageclass/PVC interference.
- The local-path storageclass is auto-detected; the validated run used
`local-path`.
- The same app node was used for both paths: `m02`.
## Non-Claims
Phase 124 does not implement or validate NVMe/RDMA, RoCE, GPU Direct,
cuFile/cuObject, NIXL, production HA, or a performance SLO. It is a diagnostic
split that makes Phase 125 a write-side Block target/backend profiling task.
@@ -0,0 +1,419 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase124-nvme-tcp-target-backend-shape-split-gate}"
SUMMARY="${ARTIFACT_DIR}/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
PHASE123_DIR="${ARTIFACT_DIR}/phase123-inner"
LOCAL_DIR="${ARTIFACT_DIR}/local-path"
DIAG_DIR="${ARTIFACT_DIR}/diagnostics"
APP_NAMESPACE="${SW_BLOCK_APP_NAMESPACE:-default}"
LOCAL_PVC="${SW_BLOCK_PHASE124_LOCAL_PVC_NAME:-sw-block-phase124-local-pvc}"
LOCAL_POD="${SW_BLOCK_PHASE124_LOCAL_POD:-sw-block-phase124-local-perf}"
LOCAL_PVC_SIZE="${SW_BLOCK_PHASE124_LOCAL_PVC_SIZE:-512Mi}"
SEQ_MIB="${SW_BLOCK_PHASE124_SEQ_MIB:-64}"
SMALL_OPS="${SW_BLOCK_PHASE124_SMALL_OPS:-256}"
SMALL_BLOCK_BYTES="${SW_BLOCK_PHASE124_SMALL_BLOCK_BYTES:-4096}"
FRONTEND_IP_MAP="${SW_BLOCK_PHASE124_FRONTEND_IP_MAP:-m01=10.0.0.1,m02=10.0.0.3}"
FRONTEND_NETWORK_CLASS="${SW_BLOCK_PHASE124_FRONTEND_NETWORK_CLASS:-100gbe_tcp}"
EXPECTED_ROUTE_DEV="${SW_BLOCK_PHASE124_EXPECTED_ROUTE_DEV:-enp1s0np0}"
IMPORT_K3S_NODES="${SW_BLOCK_IMPORT_K3S_NODES:-192.168.1.181,192.168.1.184}"
mkdir -p "${ARTIFACT_DIR}" "${LOCAL_DIR}" "${DIAG_DIR}"
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
summary_value() {
local file="$1"
local key="$2"
awk -F= -v key="$key" '$1 == key {value = substr($0, length(key) + 2)} END {if (value != "") print value}' "$file"
}
require_summary_value() {
local file="$1"
local key="$2"
local value
value="$(summary_value "$file" "$key")"
if [[ -z "${value}" ]]; then
echo "missing summary key ${key} in ${file}" >&2
exit 1
fi
printf '%s' "${value}"
}
rate_mibps() {
python3 - "$1" "$2" <<'PY'
import sys
bytes_count = int(sys.argv[1])
duration_ms = max(int(sys.argv[2]), 1)
print(f"{(bytes_count / 1048576.0) / (duration_ms / 1000.0):.2f}")
PY
}
rate_iops() {
python3 - "$1" "$2" <<'PY'
import sys
ops = int(sys.argv[1])
duration_ms = max(int(sys.argv[2]), 1)
print(f"{ops / (duration_ms / 1000.0):.2f}")
PY
}
ratio() {
python3 - "$1" "$2" <<'PY'
import sys
try:
a = float(sys.argv[1])
b = float(sys.argv[2])
except ValueError:
print("unknown")
sys.exit(0)
if b <= 0:
print("unknown")
else:
print(f"{a / b:.3f}")
PY
}
classify_split() {
python3 - "$1" "$2" "$3" "$4" "$5" "$6" <<'PY'
import sys
def f(v):
try:
return float(v)
except ValueError:
return 0.0
network, local_w, local_r, block_w, block_r, fsync_penalty = map(f, sys.argv[1:])
if min(local_w, local_r, block_w, block_r) <= 0:
print("unknown")
elif local_w >= block_w * 2 or local_r >= block_r * 2:
print("block_target_or_backend")
elif fsync_penalty >= 2:
print("test_shape")
elif network > 0 and local_w < network * 0.30 and local_r < network * 0.30:
print("k8s_mount")
else:
print("unknown")
PY
}
recommendation_for() {
case "$1" in
block_target_or_backend)
printf '%s' "phase125_blockvolume_target_cpu_profile"
;;
test_shape)
printf '%s' "phase125_test_shape_correction"
;;
k8s_mount)
printf '%s' "phase125_kubernetes_mount_host_profile"
;;
*)
printf '%s' "phase125_backend_durable_write_profile"
;;
esac
}
measure_exec_ms() {
local log="$1"
shift
local start_ns end_ns
start_ns="$(date +%s%N)"
"$@" >"${log}" 2>&1
end_ns="$(date +%s%N)"
python3 - "$start_ns" "$end_ns" <<'PY'
import sys
start = int(sys.argv[1])
end = int(sys.argv[2])
print(max((end - start) // 1_000_000, 1))
PY
}
resolve_local_storageclass() {
local sc_json="${LOCAL_DIR}/storageclasses.json"
kubectl get storageclass -o json >"${sc_json}" 2>"${LOCAL_DIR}/storageclasses.stderr.txt"
python3 - "${sc_json}" <<'PY'
import json
import sys
doc = json.load(open(sys.argv[1], encoding="utf-8"))
items = doc.get("items") or []
for item in items:
anns = item.get("metadata", {}).get("annotations", {}) or {}
if anns.get("storageclass.kubernetes.io/is-default-class") == "true":
print(item["metadata"]["name"])
raise SystemExit(0)
for preferred in ("local-path", "standard", "hostpath"):
for item in items:
if item.get("metadata", {}).get("name") == preferred:
print(preferred)
raise SystemExit(0)
if items:
print(items[0]["metadata"]["name"])
raise SystemExit(0)
raise SystemExit("no StorageClass available for local-path comparator")
PY
}
first_ready_node() {
kubectl get nodes -o json >"${LOCAL_DIR}/nodes.json" 2>"${LOCAL_DIR}/nodes.stderr.txt"
python3 - "${LOCAL_DIR}/nodes.json" <<'PY'
import json
import sys
doc = json.load(open(sys.argv[1], encoding="utf-8"))
for item in doc.get("items") or []:
name = item.get("metadata", {}).get("name")
spec = item.get("spec", {})
if spec.get("unschedulable"):
continue
conditions = item.get("status", {}).get("conditions", []) or []
ready = any(c.get("type") == "Ready" and c.get("status") == "True" for c in conditions)
if ready and name:
print(name)
raise SystemExit(0)
raise SystemExit("no schedulable Ready node found")
PY
}
cleanup_local_path() {
set +e
kubectl -n "${APP_NAMESPACE}" delete pod "${LOCAL_POD}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl -n "${APP_NAMESPACE}" delete pvc "${LOCAL_PVC}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1
kubectl get pv -o json >"${LOCAL_DIR}/pv-cleanup.json" 2>/dev/null
python3 - "${LOCAL_DIR}/pv-cleanup.json" "${APP_NAMESPACE}" "${LOCAL_PVC}" 2>/dev/null <<'PY' | \
xargs -r -n1 kubectl patch pv --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1
import json
import sys
path = sys.argv[1]
namespace = sys.argv[2]
pvc = sys.argv[3]
try:
doc = json.load(open(path, encoding="utf-8"))
except (OSError, json.JSONDecodeError):
raise SystemExit(0)
for item in doc.get("items") or []:
claim = item.get("spec", {}).get("claimRef") or {}
if claim.get("namespace") == namespace and claim.get("name") == pvc:
print(item.get("metadata", {}).get("name", ""))
PY
kubectl get pv -o json >"${LOCAL_DIR}/pv-cleanup.json" 2>/dev/null
python3 - "${LOCAL_DIR}/pv-cleanup.json" "${APP_NAMESPACE}" "${LOCAL_PVC}" 2>/dev/null <<'PY' | \
xargs -r kubectl delete pv --wait=false >/dev/null 2>&1
import json
import sys
path = sys.argv[1]
namespace = sys.argv[2]
pvc = sys.argv[3]
try:
doc = json.load(open(path, encoding="utf-8"))
except (OSError, json.JSONDecodeError):
raise SystemExit(0)
for item in doc.get("items") or []:
claim = item.get("spec", {}).get("claimRef") or {}
if claim.get("namespace") == namespace and claim.get("name") == pvc:
print(item.get("metadata", {}).get("name", ""))
PY
set -e
}
cleanup() {
cleanup_local_path || true
}
trap cleanup EXIT
measure_local_path() {
local storage_class="$1"
local app_node="$2"
cat >"${LOCAL_DIR}/local-path-pvc.yaml" <<YAML
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ${LOCAL_PVC}
namespace: ${APP_NAMESPACE}
spec:
accessModes:
- ReadWriteOnce
storageClassName: ${storage_class}
resources:
requests:
storage: ${LOCAL_PVC_SIZE}
YAML
cat >"${LOCAL_DIR}/local-path-pod.yaml" <<YAML
apiVersion: v1
kind: Pod
metadata:
name: ${LOCAL_POD}
namespace: ${APP_NAMESPACE}
labels:
sw-block-test: phase124-local-path
spec:
restartPolicy: Never
nodeSelector:
kubernetes.io/hostname: "${app_node}"
containers:
- name: app
image: busybox:1.36
command: ["/bin/sh", "-c", "sleep 3600"]
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: ${LOCAL_PVC}
YAML
kubectl apply -f "${LOCAL_DIR}/local-path-pvc.yaml" >"${LOCAL_DIR}/apply-pvc.log" 2>&1
kubectl apply -f "${LOCAL_DIR}/local-path-pod.yaml" >"${LOCAL_DIR}/apply-pod.log" 2>&1
kubectl -n "${APP_NAMESPACE}" wait --for=condition=Ready "pod/${LOCAL_POD}" --timeout=240s \
>"${LOCAL_DIR}/wait-pod-ready.log" 2>&1
kubectl -n "${APP_NAMESPACE}" get pvc "${LOCAL_PVC}" -o wide >"${LOCAL_DIR}/pvc.after-ready.txt" 2>&1
kubectl -n "${APP_NAMESPACE}" get pod "${LOCAL_POD}" -o wide >"${LOCAL_DIR}/pod.after-ready.txt" 2>&1
local marker_ms seq_bytes seq_write_ms seq_read_ms seq_nofsync_ms small_bytes small_write_ms
local seq_write_mibps seq_read_mibps seq_nofsync_mibps small_iops small_mibps
marker_ms="$(measure_exec_ms "${LOCAL_DIR}/marker.log" \
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
'set -eu; dd if=/dev/urandom of=/data/phase124-marker.bin bs=4096 count=1; sha256sum /data/phase124-marker.bin > /data/phase124-marker.sha256; sync; sha256sum -c /data/phase124-marker.sha256')"
write_summary "local_path_marker_verify_ms=${marker_ms}"
write_summary "local_path_marker_verified=true"
seq_bytes=$((SEQ_MIB * 1024 * 1024))
seq_write_ms="$(measure_exec_ms "${LOCAL_DIR}/seq-write.log" \
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
"set -eu; dd if=/dev/zero of=/data/phase124-seq.bin bs=1M count=${SEQ_MIB} conv=fsync; sync")"
seq_read_ms="$(measure_exec_ms "${LOCAL_DIR}/seq-read.log" \
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
"set -eu; dd if=/data/phase124-seq.bin of=/dev/null bs=1M; test \$(wc -c < /data/phase124-seq.bin) -eq ${seq_bytes}")"
seq_nofsync_ms="$(measure_exec_ms "${LOCAL_DIR}/seq-write-nofsync.log" \
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
"set -eu; rm -f /data/phase124-nofsync.bin; dd if=/dev/zero of=/data/phase124-nofsync.bin bs=1M count=${SEQ_MIB}")"
seq_write_mibps="$(rate_mibps "${seq_bytes}" "${seq_write_ms}")"
seq_read_mibps="$(rate_mibps "${seq_bytes}" "${seq_read_ms}")"
seq_nofsync_mibps="$(rate_mibps "${seq_bytes}" "${seq_nofsync_ms}")"
write_summary "local_path_seq_size_mib=${SEQ_MIB}"
write_summary "local_path_seq_write_duration_ms=${seq_write_ms}"
write_summary "local_path_seq_write_mibps=${seq_write_mibps}"
write_summary "local_path_seq_read_duration_ms=${seq_read_ms}"
write_summary "local_path_seq_read_mibps=${seq_read_mibps}"
write_summary "local_path_seq_write_nofsync_duration_ms=${seq_nofsync_ms}"
write_summary "local_path_seq_write_nofsync_mibps=${seq_nofsync_mibps}"
small_bytes=$((SMALL_OPS * SMALL_BLOCK_BYTES))
small_write_ms="$(measure_exec_ms "${LOCAL_DIR}/small-write.log" \
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
"set -eu; rm -f /data/phase124-small.bin; i=0; while [ \$i -lt ${SMALL_OPS} ]; do seek=\$(( (i * 17) % 1024 )); dd if=/dev/zero of=/data/phase124-small.bin bs=${SMALL_BLOCK_BYTES} count=1 seek=\$seek conv=notrunc 2>/dev/null; i=\$((i+1)); done; sync")"
small_iops="$(rate_iops "${SMALL_OPS}" "${small_write_ms}")"
small_mibps="$(rate_mibps "${small_bytes}" "${small_write_ms}")"
write_summary "local_path_small_write_ops=${SMALL_OPS}"
write_summary "local_path_small_write_block_bytes=${SMALL_BLOCK_BYTES}"
write_summary "local_path_small_write_duration_ms=${small_write_ms}"
write_summary "local_path_small_write_iops=${small_iops}"
write_summary "local_path_small_write_mibps=${small_mibps}"
kubectl -n "${APP_NAMESPACE}" exec "${LOCAL_POD}" -- sh -c \
'set -eu; sha256sum -c /data/phase124-marker.sha256; test -s /data/phase124-seq.bin; test -s /data/phase124-small.bin' \
>"${LOCAL_DIR}/final-verify.log" 2>&1
write_summary "local_path_final_data_verified=true"
}
if [[ -z "${KUBECONFIG:-}" && -f /etc/rancher/k3s/k3s.yaml ]]; then
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
fi
write_summary "phase124_nvme_tcp_target_backend_shape_split_status=running"
write_summary "frontend_transport=tcp"
write_summary "frontend_ip_map=${FRONTEND_IP_MAP}"
write_summary "frontend_network_class=${FRONTEND_NETWORK_CLASS}"
write_summary "nvme_rdma_supported=false"
write_summary "roce_claim_allowed=false"
write_summary "performance_slo_claim_allowed=false"
write_summary "test_shape=dd_exec_baseline"
SW_BLOCK_ARTIFACT_DIR="${PHASE123_DIR}" \
SW_BLOCK_PHASE123_FRONTEND_IP_MAP="${FRONTEND_IP_MAP}" \
SW_BLOCK_PHASE123_FRONTEND_NETWORK_CLASS="${FRONTEND_NETWORK_CLASS}" \
SW_BLOCK_PHASE123_EXPECTED_ROUTE_DEV="${EXPECTED_ROUTE_DEV}" \
SW_BLOCK_IMPORT_K3S_NODES="${IMPORT_K3S_NODES}" \
SW_BLOCK_PHASE123_PVC_NAME="${SW_BLOCK_PHASE124_BLOCK_PVC_NAME:-sw-block-phase124-block-pvc}" \
SW_BLOCK_PHASE123_STORAGECLASS="${SW_BLOCK_PHASE124_BLOCK_STORAGECLASS:-sw-block-phase124-block}" \
SW_BLOCK_PHASE123_POD="${SW_BLOCK_PHASE124_BLOCK_POD:-sw-block-phase124-block-perf}" \
bash "${ROOT}/scripts/run-phase123-nvme-tcp-bottleneck-triage-gate.sh" "${ROOT}" \
>"${DIAG_DIR}/phase123.stdout.txt" \
2>"${DIAG_DIR}/phase123.stderr.txt"
PHASE123_SUMMARY="${PHASE123_DIR}/phase123-nvme-tcp-bottleneck-triage-summary.txt"
PHASE120_SUMMARY="${PHASE123_DIR}/phase122-inner/phase120-inner/phase120-nvme-tcp-performance-baseline-summary.txt"
if [[ "$(require_summary_value "${PHASE123_SUMMARY}" phase123_nvme_tcp_bottleneck_triage_status)" != "ok" ]]; then
echo "phase123 inner gate did not finish ok" >&2
exit 1
fi
NETWORK_MIBPS="$(require_summary_value "${PHASE123_SUMMARY}" network_baseline_mibps)"
BLOCK_WRITE="$(require_summary_value "${PHASE123_SUMMARY}" k8s_mounted_seq_write_mibps)"
BLOCK_READ="$(require_summary_value "${PHASE123_SUMMARY}" k8s_mounted_seq_read_mibps)"
BLOCK_IOPS="$(require_summary_value "${PHASE123_SUMMARY}" k8s_mounted_small_write_iops)"
APP_NODE="$(summary_value "${PHASE120_SUMMARY}" app_node)"
if [[ -z "${APP_NODE}" ]]; then
APP_NODE="$(first_ready_node)"
fi
LOCAL_SC="$(resolve_local_storageclass)"
write_summary "network_baseline_mibps=${NETWORK_MIBPS}"
write_summary "publish_target=$(require_summary_value "${PHASE123_SUMMARY}" publish_target)"
write_summary "route_dev=$(require_summary_value "${PHASE123_SUMMARY}" route_dev)"
write_summary "publish_target_network_class=$(require_summary_value "${PHASE123_SUMMARY}" publish_target_network_class)"
write_summary "management_ip=$(require_summary_value "${PHASE123_SUMMARY}" management_ip)"
write_summary "frontend_ip=$(require_summary_value "${PHASE123_SUMMARY}" frontend_ip)"
write_summary "block_app_node=${APP_NODE}"
write_summary "local_path_storageclass=${LOCAL_SC}"
write_summary "block_nvme_seq_write_mibps=${BLOCK_WRITE}"
write_summary "block_nvme_seq_read_mibps=${BLOCK_READ}"
write_summary "block_nvme_small_write_iops=${BLOCK_IOPS}"
cleanup_local_path
measure_local_path "${LOCAL_SC}" "${APP_NODE}"
LOCAL_WRITE="$(require_summary_value "${SUMMARY}" local_path_seq_write_mibps)"
LOCAL_READ="$(require_summary_value "${SUMMARY}" local_path_seq_read_mibps)"
LOCAL_NOFSYNC="$(require_summary_value "${SUMMARY}" local_path_seq_write_nofsync_mibps)"
FSYNC_PENALTY="$(ratio "${LOCAL_NOFSYNC}" "${LOCAL_WRITE}")"
READ_RATIO="$(ratio "${BLOCK_READ}" "${LOCAL_READ}")"
WRITE_RATIO="$(ratio "${BLOCK_WRITE}" "${LOCAL_WRITE}")"
LOCAL_NET_READ_RATIO="$(ratio "${LOCAL_READ}" "${NETWORK_MIBPS}")"
LOCAL_NET_WRITE_RATIO="$(ratio "${LOCAL_WRITE}" "${NETWORK_MIBPS}")"
TOP_BOTTLENECK="$(classify_split "${NETWORK_MIBPS}" "${LOCAL_WRITE}" "${LOCAL_READ}" "${BLOCK_WRITE}" "${BLOCK_READ}" "${FSYNC_PENALTY}")"
NEXT_RECOMMENDATION="$(recommendation_for "${TOP_BOTTLENECK}")"
write_summary "block_vs_local_read_ratio=${READ_RATIO}"
write_summary "block_vs_local_write_ratio=${WRITE_RATIO}"
write_summary "local_vs_network_read_ratio=${LOCAL_NET_READ_RATIO}"
write_summary "local_vs_network_write_ratio=${LOCAL_NET_WRITE_RATIO}"
write_summary "shape_fsync_penalty=${FSYNC_PENALTY}"
write_summary "top_bottleneck=${TOP_BOTTLENECK}"
write_summary "next_recommendation=${NEXT_RECOMMENDATION}"
cleanup_local_path
SW_BLOCK_CLEANUP_WAIT_SECONDS="${SW_BLOCK_CLEANUP_WAIT_SECONDS:-180}" \
SW_BLOCK_ARTIFACT_DIR="${ARTIFACT_DIR}/cleanup/verify" \
bash "${ROOT}/scripts/verify-helm-cleanup.sh" "${ROOT}" \
>"${ARTIFACT_DIR}/cleanup-verify.stdout.txt" \
2>"${ARTIFACT_DIR}/cleanup-verify.stderr.txt"
grep -q '^cleanup_status=ok$' "${ARTIFACT_DIR}/cleanup/verify/cleanup-summary.txt"
write_summary "cleanup_status=ok"
write_summary "phase124_nvme_tcp_target_backend_shape_split_status=ok"
@@ -0,0 +1,143 @@
name: nvme-tcp-target-backend-shape-split-chain
timeout: 70m
env:
product_root: "/tmp/seaweed_block"
ssh_key: "C:\\work\\dev_server\\testdev_key"
topology:
nodes:
m02:
host: 192.168.1.184
user: testdev
key: "{{ ssh_key }}"
phases:
- name: pre_clean
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,blockcsi,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
timeout: 5m
cmd: "helm status sw-block --namespace kube-system >/dev/null 2>&1 && helm uninstall sw-block --namespace kube-system --wait --timeout 240s || true; kubectl -n default delete pod sw-block-phase124-block-perf sw-block-phase124-local-perf --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n default delete pvc sw-block-phase124-block-pvc sw-block-phase124-local-pvc --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete storageclass sw-block-phase124-block --ignore-not-found=true --wait=true --timeout=60s || true; kubectl get pv --no-headers | awk '/sw-block-phase124/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers | awk '/sw-block-phase124/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; kubectl -n kube-system get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | xargs -r -n1 kubectl -n kube-system patch --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l app.kubernetes.io/instance=sw-block --ignore-not-found=true >/dev/null 2>&1 || true; kubectl delete crd swblockclusters.block.seaweedfs.com swblockvolumes.block.seaweedfs.com swblockreplicaeligibilities.block.seaweedfs.com swblockreplicarebuilds.block.seaweedfs.com swblockreplicafailbacks.block.seaweedfs.com swblockfrontendpublications.block.seaweedfs.com --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- name: run_gate
actions:
- action: exec
node: m02
timeout: 62m
cmd: "cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split SW_BLOCK_PHASE124_FRONTEND_IP_MAP=m01=10.0.0.1,m02=10.0.0.3 SW_BLOCK_PHASE124_EXPECTED_ROUTE_DEV=enp1s0np0 SW_BLOCK_IMPORT_K3S_SSH_KEY=/opt/work/testdev_key bash scripts/run-phase124-nvme-tcp-target-backend-shape-split-gate.sh {{ product_root }}"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- name: assert_summary
actions:
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^phase124_nvme_tcp_target_backend_shape_split_status=ok$"
save_as: phase124_status_ok
- action: assert_greater
actual: "{{ phase124_status_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^network_baseline_mibps=[0-9]"
save_as: network_metric
- action: assert_greater
actual: "{{ network_metric }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^local_path_seq_write_mibps=[0-9]"
save_as: local_write_metric
- action: assert_greater
actual: "{{ local_write_metric }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^local_path_seq_read_mibps=[0-9]"
save_as: local_read_metric
- action: assert_greater
actual: "{{ local_read_metric }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^block_nvme_seq_write_mibps=[0-9]"
save_as: block_write_metric
- action: assert_greater
actual: "{{ block_write_metric }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^block_nvme_seq_read_mibps=[0-9]"
save_as: block_read_metric
- action: assert_greater
actual: "{{ block_read_metric }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^block_vs_local_read_ratio="
save_as: read_ratio_named
- action: assert_greater
actual: "{{ read_ratio_named }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^block_vs_local_write_ratio="
save_as: write_ratio_named
- action: assert_greater
actual: "{{ write_ratio_named }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^shape_fsync_penalty="
save_as: fsync_penalty_named
- action: assert_greater
actual: "{{ fsync_penalty_named }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^top_bottleneck="
save_as: bottleneck_named
- action: assert_greater
actual: "{{ bottleneck_named }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^next_recommendation=phase125_"
save_as: recommendation_named
- action: assert_greater
actual: "{{ recommendation_named }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split/phase124-nvme-tcp-target-backend-shape-split-summary.txt"
pattern: "^cleanup_status=ok$"
save_as: cleanup_ok
- action: assert_greater
actual: "{{ cleanup_ok }}"
threshold: "0"
- name: collect
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase124-nvme-split"
name: "remote-phases"
ignore_error: true