diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 61c6a317a4..c63a4bcc1e 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -616,16 +616,22 @@ Recommended order from here: unsupported error at the target layer, and `blockvolume --nvme-transport=rdma` still refuses publicly until a real RDMA listener lands. -77. Phase 119: Mono RDMA Evidence And NVMe/RDMA Decision. **Active** +77. Phase 119: Mono RDMA Evidence And NVMe/RDMA Decision. **Closed + 2026-07-02, evidence decision** Use the current mono RDMA/VFS/RustVolume/NIXL work under `C:\work\rdma\seaweed-mono-rdma-refresh` as read-only evidence before adding more block RDMA code. That work proves real VFS/object acceleration and NIXL-shaped object compatibility, but it is not an NVMe-oF/RDMA target implementation. Phase 119 records the reusable components and performance - evidence, keeps RoCE/NVMe-RDMA as a non-claim, and chooses the next concrete - path: build or bind a real NVMe-oF/RDMA protocol layer, keep RDMA scoped to - VFS/object/NIXL for now, or first run a block NVMe/TCP performance baseline - to find the actual bottleneck. + evidence, keeps RoCE/NVMe-RDMA as a non-claim, and chooses the conservative + next step: first run a block NVMe/TCP performance baseline to find the + actual bottleneck. +78. Phase 120: NVMe/TCP Performance Baseline. **Active** + Add a supported-lab Kubernetes PVC gate that measures the current NVMe/TCP + path before any RoCE/NVMe-RDMA investment. The gate records sequential + write/read MiB/s and small-write IOPS as baseline evidence only, with + explicit non-claims for RoCE, NVMe/RDMA, performance SLO, GPU/cuObject, + NIXL, broad compatibility, and published-image support. The internal release-train contract is `internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 188c7b9c09..9b77f00751 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,150 +1,116 @@ -# Current Plan: Phase 119 Mono RDMA Evidence And NVMe/RDMA Decision +# Current Plan: Phase 120 NVMe/TCP Performance Baseline -Status: planning/evidence import. No block data-plane code changes yet. +Status: implementation and QA-gate packaging. -Phase 118 added the narrow NVMe target transport seam: +Phase 119 closed the RDMA evidence review: the mono RDMA/VFS/RustVolume/NIXL +work proves real object/VFS acceleration, but it is not a Linux +`nvme connect -t rdma` compatible NVMe-oF/RDMA target. Phase 120 therefore +takes the conservative next step: measure the supported block path +(`NVMe/TCP`) before spending more engineering time on RoCE/NVMe-RDMA. + +This is a baseline phase, not a performance claim phase. + +## Why This Phase Exists + +The product already has a supported-lab NVMe/TCP path: ```text -TCP target path: implemented and default -RDMA target path: typed unsupported at target layer -blockvolume --nvme-transport=rdma: still public refusal +Kubernetes PVC + -> CSI dynamic provisioning + -> blockmaster/blockvolume external NVMe/TCP publication + -> Linux host nvme-tcp attach + -> pod mount + write/read ``` -Phase 119 answers the next question before adding code: can the RDMA work in -`C:\work\rdma\seaweed-mono-rdma-refresh` be reused for Seaweed Block's -NVMe/RDMA path, and what does its performance evidence actually prove? +The next question is not whether RDMA can move memory quickly in another +project. The next question is where the current Seaweed Block NVMe/TCP path +actually spends time under a real Kubernetes PVC workload. -## Source Under Review +Phase 120 records a repeatable baseline so later work can compare: -Read-only source: - -```text -C:\work\rdma\seaweed-mono-rdma-refresh -branch: rdma/object-protocol-migration -``` - -Important: that repo currently has unrelated dirty worktree changes. Treat it -as a reference source only unless explicitly working in that repo. - -Relevant mono components: - -- `enterprise/rust/sw-rdma`: Linux `real-rdma` one-sided RC verbs over - `rdma_cm`/libibverbs; memory registration, RDMA READ/WRITE, local MR reuse, - completions, and typed unsupported behavior outside Linux/feature builds. -- `enterprise/rust/sw-rdma-loader`: volume transport and `pipes x slots` - runtime pool used by VFS/object paths. -- `enterprise/rust/sw-rdma-vfs`: VFS adapter and M01/M02 read/write gates. -- `enterprise/rust/sw-rdma-object`: S3/object RDMA token and `x-rdma-info` - registered-client path. -- NIXL research path: `type=seaweed` object/storage adapter work, currently - CPU descriptor focused; no GPU/cuObject production claim. - -## What The Mono Evidence Proves - -The mono work proves real acceleration in the VFS/object lanes: - -- VFS 128 MiB read matrix: HTTP about `87 MiB/s`; native RC about - `627-646 MiB/s` in the recorded smoke. -- Later VFS 1 GiB sequential read after copy-path fixes: practical release - ceiling about `1.0-1.1 GiB/s` through the mount. -- S3 registered-client empty-body GET: recorded about `298.5 MiB/s` for - `20MiB/c32` and `1799.6 MiB/s` for `128MiB/c32`. -- NIXL-shaped CPU smoke and local NIXL `type=seaweed` external-descriptor - plugin smoke pass, but they are object/storage compatibility proofs, not - GPU/cuObject or block-device proofs. - -The mono work also records an important negative result: - -- Old SRA object path is still materially faster: normal-body old SRA around - `3.3 GiB/s`, sink/status path around `5.5 GiB/s`. -- Current mono object path is correctness-migrated but not performance-parity - with the old SRA hot path. - -## Why This Does Not Directly Implement Block NVMe/RDMA - -Seaweed Block's NVMe frontend is an NVMe-oF target surface. A Linux host -initiator expects: - -```text -nvme connect -t rdma ... - -> NVMe-oF/RDMA capsules and queue pairs - -> controller/session semantics - -> namespace I/O commands -``` - -The mono `sw-rdma` path provides: - -```text -RDMA READ/WRITE primitives - -> registered memory descriptors - -> VFS/object transfer maps - -> out-of-band control plane for addr/rkey -``` - -Those primitives are useful engineering substrate and performance evidence, but -they are not an NVMe-oF/RDMA listener. Reusing them for block requires a real -NVMe/RDMA protocol layer or a dependency that already provides one. A plain -`net.Listener`-style adapter is not enough. +- NVMe/TCP tuning; +- storage-engine changes; +- NVMe/RDMA work; +- object/VFS/NIXL acceleration work that is not directly block PVC. ## Deliverables -1. Record a mono RDMA evidence assessment for block engineers: +1. Add an executable lab gate: ```text - internal/docs/ref/phase119-mono-rdma-acceleration-assessment.md + scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh + testops/scenarios/nvme-tcp-performance-baseline-chain.yaml ``` -2. Keep the Phase 118 public boundary unchanged: +2. The gate must use the supported Kubernetes NVMe/TCP path, not a standalone + helper path. + +3. The gate must collect terminal `key=value` evidence: ```text - --nvme-transport=rdma remains unsupported - no RoCE attach claim - no NVMe/RDMA performance claim + phase120_nvme_tcp_performance_baseline_status=ok + protocol=nvme + frontend_transport=tcp + managed_volume_status=ready + publish_target_loopback=false + marker_verified=true + final_data_verified=true + seq_write_mibps= + seq_read_mibps= + small_write_iops= + cleanup_status=ok ``` -3. Define the next implementation decision as one of: +4. The gate must explicitly record non-claims: - - **Path A:** build or bind a real NVMe-oF/RDMA target protocol layer; - - **Path B:** prove a concrete blocker and keep RDMA scoped to - VFS/object/NIXL, while block continues on NVMe/TCP; - - **Path C:** defer NVMe/RDMA and first run a block NVMe/TCP performance - baseline so the product has a measured storage-performance reference. + ```text + roce_claim_allowed=false + nvme_rdma_claim_allowed=false + performance_claim_allowed=false + performance_slo_claim_allowed=false + perf_gate_type=baseline_no_slo + ``` -## Gate Commands To Reuse From Mono +5. Add a QA assignment: -If the RDMA lab is available, the relevant mono gates are: + ```text + internal/docs/qa-assignments/phase120-nvme-tcp-performance-baseline-qa.md + ``` + +## Verification + +Local/source checks: ```powershell -# VFS/RustVolume read/write and matrix smoke -cd C:\work\rdma\seaweed-mono-rdma-refresh -.\enterprise\rust\sw-rdma-vfs\tests\lab\rdma-write-gate\run.ps1 ` - -RunV1Acceptance -RunReadMatrixSmoke - -# S3 object registered CPU descriptor / NIXL-shaped CPU path -.\enterprise\rust\sw-rdma-object\tests\lab\s3-object-loader-store\run.ps1 ` - -ClientRdmaEndpoint -RegisteredClientGetPerf - -# NIXL-shaped CPU and local type=seaweed plugin smoke -.\enterprise\rust\sw-rdma-object\tests\lab\s3-object-loader-store\run.ps1 ` - -NixlCpuSmoke -NixlPluginSmoke +bash -n scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh +C:\work\swblock.exe validate testops/scenarios/nvme-tcp-performance-baseline-chain.yaml +go test ./cmd/blockvolume ./cmd/sw-block ``` -These gates answer whether the mono VFS/object RDMA lanes are healthy. They do -not answer whether Seaweed Block has a working NVMe/RDMA initiator attach. +Live gate: + +```powershell +C:\work\swblock.exe run ` + testops/scenarios/nvme-tcp-performance-baseline-chain.yaml ` + -env product_root=/tmp/seaweed_block +``` + +The live gate may use local images while this remains a development phase. A +future release claim still needs matching published `seaweed-block` and +`seaweed-block-csi` images. ## Exit Criteria -Phase 119 can close when: +Phase 120 can close when: -- the assessment doc lists the reusable mono components, measured evidence, and - non-claims; -- roadmap wording separates VFS/object/NIXL acceleration from block - NVMe/RDMA; -- the next block phase has a concrete implementation choice instead of a vague - "add RoCE" task. +- the source checks pass; +- the TestOps scenario validates; +- the live supported-lab gate passes or has a concrete lab/artifact blocker; +- the summary contains numeric baseline rows and the explicit non-claim rows; +- cleanup leaves `cleanup_status=ok`. ## Non-Claims -Phase 119 does not claim NVMe/RDMA attach, RoCE I/O, SPDK parity, GPU/cuObject, -NIXL production support, performance/SLO, broad distro compatibility, or -published-image support. +Phase 120 does not claim RoCE, NVMe/RDMA attach, NVMe/RDMA performance, a +performance SLO, production tuning, broad kernel/distro compatibility, +GPU/cuObject, NIXL production support, or published-image support. diff --git a/seaweed-block/internal/docs/finished-plans/phase119_finishedplan_mono_rdma_evidence_and_nvme_rdma_decision.md b/seaweed-block/internal/docs/finished-plans/phase119_finishedplan_mono_rdma_evidence_and_nvme_rdma_decision.md new file mode 100644 index 0000000000..5b387cd5e1 --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase119_finishedplan_mono_rdma_evidence_and_nvme_rdma_decision.md @@ -0,0 +1,46 @@ +# Phase 119 Finished Plan: Mono RDMA Evidence And NVMe/RDMA Decision + +Status: closed as an evidence and decision phase. + +Phase 119 reviewed `C:\work\rdma\seaweed-mono-rdma-refresh` as read-only +evidence for Seaweed Block's future RDMA direction. + +## Result + +The mono RDMA work is useful, but it does not directly implement block +NVMe/RDMA: + +- `enterprise/rust/sw-rdma` proves real Linux RC verbs, memory registration, + RDMA READ/WRITE, and typed unsupported behavior outside supported builds. +- `sw-rdma-vfs` and related gates prove practical VFS/object acceleration. +- NIXL-shaped object work is CPU descriptor / plugin compatibility evidence, + not GPU/cuObject or block-device evidence. +- None of those components is a Linux `nvme connect -t rdma` compatible + NVMe-oF/RDMA target listener. + +## Product Decision + +Seaweed Block keeps the Phase 118 boundary: + +```text +NVMe/TCP: implemented supported-lab path +NVMe/RDMA/RoCE: typed unsupported / public non-claim +``` + +Before implementing a real NVMe-oF/RDMA target, the next phase should collect +a repeatable NVMe/TCP performance baseline for the supported Kubernetes PVC +path. That became Phase 120. + +## Reference + +Detailed evidence assessment: + +```text +internal/docs/ref/phase119-mono-rdma-acceleration-assessment.md +``` + +## Non-Claims + +This phase did not claim NVMe/RDMA attach, RoCE I/O, SPDK parity, +GPU/cuObject, NIXL production support, performance/SLO, broad distro support, +or published-image support. diff --git a/seaweed-block/internal/docs/product-roadmap.md b/seaweed-block/internal/docs/product-roadmap.md index 3492d6111f..1eb87d53f2 100644 --- a/seaweed-block/internal/docs/product-roadmap.md +++ b/seaweed-block/internal/docs/product-roadmap.md @@ -325,13 +325,17 @@ rebuild, delete safety, or cleanup must start as a separate gated phase. seam inside `core/frontend/nvme.Target`. TCP remains the only implemented public path; RDMA is now a typed target-layer unsupported transport rather than just a CLI string rejection. -- Phase 119 uses `C:\work\rdma\seaweed-mono-rdma-refresh` as the current +- Phase 119 used `C:\work\rdma\seaweed-mono-rdma-refresh` as the current RDMA/VFS/RustVolume/NIXL evidence source. That repo proves useful VFS/object acceleration and NIXL-shaped object compatibility, but it does not implement - a Linux `nvme connect -t rdma` compatible target. The current decision gate is - therefore: build or bind a real NVMe-oF/RDMA protocol layer, keep RDMA scoped - to VFS/object/NIXL for now, or first run a block NVMe/TCP performance + a Linux `nvme connect -t rdma` compatible target. The decision was to keep + RoCE/NVMe-RDMA as a non-claim and first run a block NVMe/TCP performance baseline before spending more time on RoCE. +- Phase 120 is the active plan. It adds a supported-lab Kubernetes PVC gate for + the implemented NVMe/TCP path and records sequential write/read MiB/s plus + small-write IOPS as baseline evidence only. It does not create a performance + SLO, RoCE/NVMe-RDMA claim, GPU/cuObject claim, NIXL claim, broad compatibility + claim, or published-image claim. - 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 @@ -908,11 +912,14 @@ Approximate engineering effort if scope remains tight: - Phase 118 NVMe/RDMA Transport Seam is implemented locally: the target has a TCP/RDMA selector seam, TCP remains the only implemented path, and RDMA stays a typed unsupported/public refusal. -- Phase 119 is the active plan. It imports the current mono RDMA/VFS/RustVolume - and NIXL evidence from `C:\work\rdma\seaweed-mono-rdma-refresh`, separates - object/VFS acceleration from block NVMe/RDMA, and chooses whether the next - block protocol step is a real NVMe-oF/RDMA implementation, a scoped non-claim, - or a block NVMe/TCP performance baseline. +- Phase 119 is closed as an evidence decision. It imported the current mono + RDMA/VFS/RustVolume and NIXL evidence from + `C:\work\rdma\seaweed-mono-rdma-refresh`, separated object/VFS acceleration + from block NVMe/RDMA, and chose a block NVMe/TCP performance baseline as the + next conservative step. +- Phase 120 is active. It packages the supported-lab NVMe/TCP performance + baseline gate and keeps all performance, RoCE/NVMe-RDMA, GPU/cuObject, NIXL, + broad compatibility, and published-image claims explicitly out of scope. - 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. diff --git a/seaweed-block/internal/docs/qa-assignments/phase120-nvme-tcp-performance-baseline-qa.md b/seaweed-block/internal/docs/qa-assignments/phase120-nvme-tcp-performance-baseline-qa.md new file mode 100644 index 0000000000..528a5370be --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase120-nvme-tcp-performance-baseline-qa.md @@ -0,0 +1,67 @@ +# Phase 120 QA: NVMe/TCP Performance Baseline + +Purpose: collect a repeatable supported-lab NVMe/TCP performance baseline before +deciding whether RoCE/NVMe-RDMA is the next protocol investment. + +This is a baseline gate, not an SLO gate. Numeric throughput and IOPS are +evidence rows; they are not pass/fail floors. + +## Gate + +Scenario: + +```text +testops/scenarios/nvme-tcp-performance-baseline-chain.yaml +``` + +Script: + +```text +scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh +``` + +## PASS Criteria + +The summary must contain: + +```text +phase120_nvme_tcp_performance_baseline_status=ok +protocol=nvme +frontend_transport=tcp +performance_claim_allowed=false +roce_claim_allowed=false +nvme_rdma_claim_allowed=false +pvc_bound=true +perf_pod_ready=true +managed_volume_status=ready +managed_volume_reason=first_volume_verified +publish_target_loopback=false +marker_verified=true +final_data_verified=true +seq_write_mibps= +seq_read_mibps= +small_write_iops= +cleanup_status=ok +``` + +## Required Verdict Shape + +Report: + +- branch and commit tested; +- scenario run id and bundle path; +- full summary `key=value` rows; +- whether the baseline ran on local images or published images; +- residue status from `verify-helm-cleanup.sh`; +- any lab caveat such as image import, node availability, disk pressure, or + noisy neighbor. + +## Non-Claims + +PASS does not claim: + +- RoCE or NVMe/RDMA; +- performance SLO; +- production tuning; +- broad kernel/distro compatibility; +- GPU/NIXL/cuObject. diff --git a/seaweed-block/scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh b/seaweed-block/scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh new file mode 100644 index 0000000000..270ff458cb --- /dev/null +++ b/seaweed-block/scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh @@ -0,0 +1,380 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase120-nvme-tcp-performance-baseline-gate}" +SUMMARY="${ARTIFACT_DIR}/phase120-nvme-tcp-performance-baseline-summary.txt" +HELM_RELEASE="${SW_BLOCK_HELM_RELEASE:-sw-block}" +HELM_NAMESPACE="${SW_BLOCK_HELM_NAMESPACE:-kube-system}" +APP_NAMESPACE="${SW_BLOCK_APP_NAMESPACE:-default}" +IMAGE="${SW_BLOCK_IMAGE:-sw-block:local}" +CSI_IMAGE="${SW_BLOCK_CSI_IMAGE:-sw-block-csi:local}" +STATUS_PORT="${SW_BLOCK_MASTER_PORT_FORWARD_PORT:-29335}" +PVC_NAME="${SW_BLOCK_PHASE120_PVC_NAME:-sw-block-phase120-pvc}" +SC_NAME="${SW_BLOCK_PHASE120_STORAGECLASS:-sw-block-phase120}" +PERF_POD="${SW_BLOCK_PHASE120_POD:-sw-block-phase120-perf}" +PVC_SIZE="${SW_BLOCK_PHASE120_PVC_SIZE:-512Mi}" +SEQ_MIB="${SW_BLOCK_PHASE120_SEQ_MIB:-64}" +SMALL_OPS="${SW_BLOCK_PHASE120_SMALL_OPS:-256}" +SMALL_BLOCK_BYTES="${SW_BLOCK_PHASE120_SMALL_BLOCK_BYTES:-4096}" + +mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,pvc,perf,status,cleanup} +: >"${SUMMARY}" + +write_summary() { + echo "$*" | tee -a "${SUMMARY}" >/dev/null +} + +require_cmd() { + if ! command -v "$1" >/dev/null 2>&1; then + echo "missing required command: $1" >&2 + exit 2 + fi +} + +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 +} + +cleanup() { + set +e + kubectl -n "${APP_NAMESPACE}" delete pod "${PERF_POD}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + kubectl -n "${APP_NAMESPACE}" delete pvc "${PVC_NAME}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + kubectl delete storageclass "${SC_NAME}" --ignore-not-found=true --wait=true --timeout=120s >/dev/null 2>&1 + kubectl get pv --no-headers 2>/dev/null | awk -v pvc="${PVC_NAME}" '$0 ~ pvc {print $1}' | \ + xargs -r -n1 kubectl patch pv --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1 + kubectl get pv --no-headers 2>/dev/null | awk -v pvc="${PVC_NAME}" '$0 ~ pvc {print $1}' | \ + xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 + sudo -n nvme disconnect-all >/dev/null 2>&1 || true + helm status "${HELM_RELEASE}" --namespace "${HELM_NAMESPACE}" >/dev/null 2>&1 && \ + helm uninstall "${HELM_RELEASE}" --namespace "${HELM_NAMESPACE}" --wait --timeout 240s \ + >"${ARTIFACT_DIR}/cleanup/helm-uninstall.txt" 2>&1 + kubectl -n "${HELM_NAMESPACE}" get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | \ + xargs -r -n1 kubectl -n "${HELM_NAMESPACE}" patch --type=merge -p '{"metadata":{"finalizers":[]}}' >/dev/null 2>&1 + kubectl -n "${HELM_NAMESPACE}" delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 + kubectl -n "${HELM_NAMESPACE}" delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 + kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l "app.kubernetes.io/instance=${HELM_RELEASE}" --ignore-not-found=true >/dev/null 2>&1 + 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 + sudo -n nvme disconnect-all >/dev/null 2>&1 || true + set -e +} +trap cleanup EXIT + +wait_for_port() { + local port="$1" + for _ in $(seq 1 60); do + if (echo >"/dev/tcp/127.0.0.1/${port}") >/dev/null 2>&1; then + return 0 + fi + sleep 1 + done + return 1 +} + +with_master_port_forward() { + local log="$1" + shift + kubectl -n "${HELM_NAMESPACE}" port-forward deploy/sw-blockmaster "${STATUS_PORT}:9333" >"${log}" 2>&1 & + local pf_pid=$! + if ! wait_for_port "${STATUS_PORT}"; then + kill "${pf_pid}" >/dev/null 2>&1 || true + wait "${pf_pid}" >/dev/null 2>&1 || true + return 1 + fi + "$@" + local rc=$? + kill "${pf_pid}" >/dev/null 2>&1 || true + wait "${pf_pid}" >/dev/null 2>&1 || true + return "${rc}" +} + +collect_cluster_evidence() { + "${ARTIFACT_DIR}/bin/sw-block" ops cluster \ + --master-api "127.0.0.1:${STATUS_PORT}" \ + --timeout 30s -o json \ + >"${ARTIFACT_DIR}/status/cluster-evidence.json" \ + 2>"${ARTIFACT_DIR}/status/cluster-evidence.stderr.txt" + "${ARTIFACT_DIR}/bin/sw-block" ops inventory \ + --namespace "${APP_NAMESPACE}" \ + --master "127.0.0.1:${STATUS_PORT}" \ + --timeout 30s \ + --out "${ARTIFACT_DIR}/status/inventory" \ + >"${ARTIFACT_DIR}/status/inventory.stdout.txt" \ + 2>"${ARTIFACT_DIR}/status/inventory.stderr.txt" +} + +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 +} + +require_cmd go +require_cmd helm +require_cmd kubectl +require_cmd python3 + +if [[ -z "${KUBECONFIG:-}" && -f /etc/rancher/k3s/k3s.yaml ]]; then + export KUBECONFIG=/etc/rancher/k3s/k3s.yaml +fi + +write_summary "phase120_nvme_tcp_performance_baseline_status=running" +write_summary "protocol=nvme" +write_summary "frontend_transport=tcp" +write_summary "roce_claim_allowed=false" +write_summary "nvme_rdma_claim_allowed=false" +write_summary "performance_claim_allowed=false" +write_summary "performance_slo_claim_allowed=false" +write_summary "perf_gate_type=baseline_no_slo" + +cd "${ROOT}" +go test ./cmd/blockvolume ./cmd/sw-block >"${ARTIFACT_DIR}/go-test.log" 2>&1 +write_summary "go_test_blockvolume_sw_block=pass" + +import_env=( + "SW_BLOCK_IMPORT_K3S=1" + "SW_BLOCK_IMPORT_K3S_NODES=${SW_BLOCK_IMPORT_K3S_NODES:-192.168.1.181}" + "SW_BLOCK_IMPORT_K3S_SSH_USER=${SW_BLOCK_IMPORT_K3S_SSH_USER:-testdev}" + "SW_BLOCK_ARTIFACT_DIR=${ARTIFACT_DIR}/build" +) +if [[ -n "${SW_BLOCK_IMPORT_K3S_SSH_KEY:-}" ]]; then + import_env+=("SW_BLOCK_IMPORT_K3S_SSH_KEY=${SW_BLOCK_IMPORT_K3S_SSH_KEY}") +fi +env "${import_env[@]}" bash scripts/build-alpha-images.sh "${ROOT}" +grep -q 'SW_BLOCK_IMAGE_ID=' "${ARTIFACT_DIR}/build/alpha-images.env" +grep -q 'SW_BLOCK_CSI_IMAGE_ID=' "${ARTIFACT_DIR}/build/alpha-images.env" +write_summary "image_ready=true" + +go build -o "${ARTIFACT_DIR}/bin/sw-block" ./cmd/sw-block +"${ARTIFACT_DIR}/bin/sw-block" ops generate-helm-values \ + --kubeconfig "${KUBECONFIG}" \ + --out "${ARTIFACT_DIR}/values/values.nvme.yaml" \ + --image "${IMAGE}" \ + --csi-image "${CSI_IMAGE}" \ + --protocol nvme \ + --node-limit 2 \ + >"${ARTIFACT_DIR}/values/generate.stdout.txt" \ + 2>"${ARTIFACT_DIR}/values/generate.stderr.txt" +grep -q '^network_mode=external-nvme$' "${ARTIFACT_DIR}/values/generate.stdout.txt" +write_summary "generated_external_nvme=true" + +python3 - "${ARTIFACT_DIR}/values/values.nvme.yaml" "${ARTIFACT_DIR}/values" <<'PY' +from pathlib import Path +import sys +values = Path(sys.argv[1]) +out = Path(sys.argv[2]) +nodes = [] +cur = None +for raw in values.read_text().splitlines(): + line = raw.strip() + if line.startswith("- name:"): + if cur: + nodes.append(cur) + cur = {} + if cur is None: + continue + if line.startswith("kubernetesNode:"): + cur["kubernetesNode"] = line.split(":", 1)[1].strip().strip('"') +if cur: + nodes.append(cur) +if len(nodes) < 2: + raise SystemExit("need at least two generated nodes") +(out / "blockvolume-node.txt").write_text(nodes[0]["kubernetesNode"] + "\n") +(out / "app-node.txt").write_text(nodes[1]["kubernetesNode"] + "\n") +PY + +BLOCK_NODE="$(cat "${ARTIFACT_DIR}/values/blockvolume-node.txt")" +APP_NODE="$(cat "${ARTIFACT_DIR}/values/app-node.txt")" +write_summary "blockvolume_node=${BLOCK_NODE}" +write_summary "app_node=${APP_NODE}" + +helm lint charts/seaweed-block -f "${ARTIFACT_DIR}/values/values.nvme.yaml" >"${ARTIFACT_DIR}/install/helm-lint.txt" 2>&1 +helm template "${HELM_RELEASE}" charts/seaweed-block --namespace "${HELM_NAMESPACE}" \ + -f "${ARTIFACT_DIR}/values/values.nvme.yaml" \ + >"${ARTIFACT_DIR}/install/helm-template.yaml" \ + 2>"${ARTIFACT_DIR}/install/helm-template.stderr.txt" +grep -q -- '--launcher-external-nvme' "${ARTIFACT_DIR}/install/helm-template.yaml" +if grep -q -- '--launcher-external-iscsi' "${ARTIFACT_DIR}/install/helm-template.yaml"; then + echo "unexpected iSCSI launcher flag in NVMe render" >&2 + exit 1 +fi +write_summary "helm_template_external_nvme=true" + +helm install "${HELM_RELEASE}" charts/seaweed-block \ + --namespace "${HELM_NAMESPACE}" \ + --create-namespace \ + -f "${ARTIFACT_DIR}/values/values.nvme.yaml" \ + --wait --timeout 10m \ + >"${ARTIFACT_DIR}/install/helm-install.txt" \ + 2>"${ARTIFACT_DIR}/install/helm-install.stderr.txt" +write_summary "helm_install=pass" + +cat >"${ARTIFACT_DIR}/pvc/perf-pvc.yaml" <"${ARTIFACT_DIR}/pvc/apply-pvc.log" 2>&1 +kubectl -n "${APP_NAMESPACE}" wait --for=jsonpath='{.status.phase}'=Bound "pvc/${PVC_NAME}" --timeout=180s \ + >"${ARTIFACT_DIR}/pvc/wait-pvc-bound.log" 2>&1 +kubectl -n "${APP_NAMESPACE}" get pvc "${PVC_NAME}" -o wide >"${ARTIFACT_DIR}/pvc/pvc.after-bound.txt" 2>&1 +write_summary "pvc_bound=true" + +cat >"${ARTIFACT_DIR}/perf/perf-pod.yaml" <"${ARTIFACT_DIR}/perf/apply-perf-pod.log" 2>&1 +kubectl -n "${APP_NAMESPACE}" wait --for=condition=Ready "pod/${PERF_POD}" --timeout=240s \ + >"${ARTIFACT_DIR}/perf/wait-perf-pod-ready.log" 2>&1 +write_summary "perf_pod_ready=true" + +with_master_port_forward "${ARTIFACT_DIR}/status/blockmaster-port-forward.log" collect_cluster_evidence +python3 - "${ARTIFACT_DIR}/status/cluster-evidence.json" "${ARTIFACT_DIR}/status/phase120-status-summary.txt" <<'PY' +import json +import sys +doc = json.load(open(sys.argv[1])) +vols = doc.get("volumes") or [] +if len(vols) != 1: + raise SystemExit(f"volume_count={len(vols)}, want 1") +vol = vols[0] +target = vol.get("publish_target") or "" +if vol.get("status") != "ready": + raise SystemExit(f"volume status={vol.get('status')}, want ready") +if ":4420" not in target: + raise SystemExit(f"unexpected publish_target={target}") +if target.startswith("127.") or target.startswith("localhost"): + raise SystemExit(f"loopback target={target}") +with open(sys.argv[2], "w") as f: + f.write("managed_volume_status=ready\n") + f.write("managed_volume_reason=first_volume_verified\n") + f.write("publish_target_loopback=false\n") + f.write(f"publish_target={target}\n") +PY +cat "${ARTIFACT_DIR}/status/phase120-status-summary.txt" >>"${SUMMARY}" + +MARKER_MS="$(measure_exec_ms "${ARTIFACT_DIR}/perf/marker.log" \ + kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \ + 'set -eu; dd if=/dev/urandom of=/data/phase120-marker.bin bs=4096 count=1; sha256sum /data/phase120-marker.bin > /data/phase120-marker.sha256; sync; sha256sum -c /data/phase120-marker.sha256')" +write_summary "marker_verify_ms=${MARKER_MS}" +write_summary "marker_verified=true" + +SEQ_BYTES=$((SEQ_MIB * 1024 * 1024)) +SEQ_WRITE_MS="$(measure_exec_ms "${ARTIFACT_DIR}/perf/seq-write.log" \ + kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \ + "set -eu; dd if=/dev/zero of=/data/phase120-seq.bin bs=1M count=${SEQ_MIB} conv=fsync; sync")" +SEQ_READ_MS="$(measure_exec_ms "${ARTIFACT_DIR}/perf/seq-read.log" \ + kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \ + "set -eu; dd if=/data/phase120-seq.bin of=/dev/null bs=1M; test \$(wc -c < /data/phase120-seq.bin) -eq ${SEQ_BYTES}")" +SEQ_WRITE_MIBPS="$(rate_mibps "${SEQ_BYTES}" "${SEQ_WRITE_MS}")" +SEQ_READ_MIBPS="$(rate_mibps "${SEQ_BYTES}" "${SEQ_READ_MS}")" +write_summary "seq_size_mib=${SEQ_MIB}" +write_summary "seq_write_duration_ms=${SEQ_WRITE_MS}" +write_summary "seq_write_mibps=${SEQ_WRITE_MIBPS}" +write_summary "seq_read_duration_ms=${SEQ_READ_MS}" +write_summary "seq_read_mibps=${SEQ_READ_MIBPS}" + +SMALL_BYTES=$((SMALL_OPS * SMALL_BLOCK_BYTES)) +SMALL_WRITE_MS="$(measure_exec_ms "${ARTIFACT_DIR}/perf/small-write.log" \ + kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \ + "set -eu; rm -f /data/phase120-small.bin; i=0; while [ \$i -lt ${SMALL_OPS} ]; do seek=\$(( (i * 17) % 1024 )); dd if=/dev/zero of=/data/phase120-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 "small_write_ops=${SMALL_OPS}" +write_summary "small_write_block_bytes=${SMALL_BLOCK_BYTES}" +write_summary "small_write_duration_ms=${SMALL_WRITE_MS}" +write_summary "small_write_iops=${SMALL_IOPS}" +write_summary "small_write_mibps=${SMALL_MIBPS}" + +kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \ + 'set -eu; sha256sum -c /data/phase120-marker.sha256; test -s /data/phase120-seq.bin; test -s /data/phase120-small.bin' \ + >"${ARTIFACT_DIR}/perf/final-verify.log" 2>&1 +write_summary "final_data_verified=true" + +kubectl -n "${APP_NAMESPACE}" delete pod "${PERF_POD}" --ignore-not-found=true --wait=true --timeout=120s \ + >"${ARTIFACT_DIR}/cleanup/delete-perf-pod.txt" 2>&1 +kubectl -n "${APP_NAMESPACE}" delete pvc "${PVC_NAME}" --ignore-not-found=true --wait=true --timeout=120s \ + >"${ARTIFACT_DIR}/cleanup/delete-pvc.txt" 2>&1 +kubectl delete storageclass "${SC_NAME}" --ignore-not-found=true --wait=true --timeout=120s \ + >"${ARTIFACT_DIR}/cleanup/delete-storageclass.txt" 2>&1 +sudo -n nvme disconnect-all >/dev/null 2>&1 || true +helm uninstall "${HELM_RELEASE}" --namespace "${HELM_NAMESPACE}" --wait --timeout 240s \ + >"${ARTIFACT_DIR}/cleanup/helm-uninstall.txt" 2>&1 || true +SW_BLOCK_ARTIFACT_DIR="${ARTIFACT_DIR}/cleanup/verify" bash scripts/verify-helm-cleanup.sh "${ROOT}" \ + >"${ARTIFACT_DIR}/cleanup/verify-helm-cleanup.stdout.txt" \ + 2>"${ARTIFACT_DIR}/cleanup/verify-helm-cleanup.stderr.txt" +grep -q '^cleanup_status=ok$' "${ARTIFACT_DIR}/cleanup/verify/cleanup-summary.txt" +write_summary "cleanup_status=ok" + +write_summary "phase120_nvme_tcp_performance_baseline_status=ok" diff --git a/seaweed-block/testops/scenarios/nvme-tcp-performance-baseline-chain.yaml b/seaweed-block/testops/scenarios/nvme-tcp-performance-baseline-chain.yaml new file mode 100644 index 0000000000..f6368c9ce5 --- /dev/null +++ b/seaweed-block/testops/scenarios/nvme-tcp-performance-baseline-chain.yaml @@ -0,0 +1,128 @@ +name: nvme-tcp-performance-baseline-chain +timeout: 40m + +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-phase120-perf --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n default delete pvc sw-block-phase120-pvc --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete storageclass sw-block-phase120 --ignore-not-found=true --wait=true --timeout=60s || true; kubectl get pv --no-headers | awk '/sw-block-phase120/ {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-phase120/ {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 }}-phase120-nvme-perf && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf" + env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml" + + - name: run_gate + actions: + - action: exec + node: m02 + timeout: 35m + cmd: "cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf bash scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh {{ product_root }}" + env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml" + env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "/opt/work/testdev_key" + + - name: assert_summary + actions: + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^phase120_nvme_tcp_performance_baseline_status=ok$" + save_as: phase120_status_ok + - action: assert_greater + actual: "{{ phase120_status_ok }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^protocol=nvme$" + save_as: protocol_nvme + - action: assert_greater + actual: "{{ protocol_nvme }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^frontend_transport=tcp$" + save_as: frontend_transport_tcp + - action: assert_greater + actual: "{{ frontend_transport_tcp }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^performance_claim_allowed=false$" + save_as: performance_claim_denied + - action: assert_greater + actual: "{{ performance_claim_denied }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^roce_claim_allowed=false$" + save_as: roce_claim_denied + - action: assert_greater + actual: "{{ roce_claim_denied }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^seq_write_mibps=[0-9]" + save_as: seq_write_metric + - action: assert_greater + actual: "{{ seq_write_metric }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^seq_read_mibps=[0-9]" + save_as: seq_read_metric + - action: assert_greater + actual: "{{ seq_read_metric }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^small_write_iops=[0-9]" + save_as: small_write_metric + - action: assert_greater + actual: "{{ small_write_metric }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-summary.txt" + pattern: "^final_data_verified=true$" + save_as: final_data_verified + - action: assert_greater + actual: "{{ final_data_verified }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase120-nvme-perf/phase120-nvme-tcp-performance-baseline-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 }}-phase120-nvme-perf" + name: "remote-phases" + ignore_error: true