mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
phase125: profile nvme tcp write path
This commit is contained in:
1 parent
0ae73d4add
commit
d9a5e8152c
9 files changed
+982
-65
No files matched your search
@@ -62,6 +62,7 @@ The supported-lab claim is intentionally narrow:
|
||||
| 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 |
|
||||
| 125 | Block NVMe/TCP write-path profile with coarse target CPU evidence | PASS |
|
||||
|
||||
Key QA sign-offs:
|
||||
|
||||
@@ -70,6 +71,7 @@ Key QA sign-offs:
|
||||
- `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`
|
||||
- `internal/docs/qa-assignments/phase125-block-nvme-tcp-write-path-profile-qa-signoff.md`
|
||||
|
||||
## Performance Baseline
|
||||
|
||||
@@ -128,6 +130,28 @@ 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.
|
||||
|
||||
Phase 125 profiles a larger 512MiB write and captures coarse blockvolume CPU
|
||||
samples during the write:
|
||||
|
||||
```text
|
||||
network_baseline_mibps=3836.30
|
||||
local_path_seq_write_mibps=1147.98
|
||||
local_path_seq_read_mibps=513.54
|
||||
block_nvme_seq_write_mibps=174.33
|
||||
block_nvme_seq_read_mibps=544.10
|
||||
block_vs_local_write_ratio=0.152
|
||||
block_vs_local_read_ratio=1.060
|
||||
blockvolume_cpu_sample_count=3
|
||||
blockvolume_cpu_peak_percent=0.80
|
||||
write_path_observation=backend_sync
|
||||
next_recommendation=phase126_durable_backend_write_optimization
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
The CPU evidence is coarse and does not prove a specific backend function is
|
||||
the bottleneck. It is enough to defer NVMe/RDMA and require product-owned
|
||||
write-path instrumentation next.
|
||||
|
||||
## Representative Release Smoke
|
||||
|
||||
When matching release images exist, the smoke should use the exact image pair:
|
||||
|
||||
@@ -672,11 +672,19 @@ Recommended order from here:
|
||||
`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.
|
||||
83. Phase 125: Block NVMe/TCP Write-Path Profile. **Closed 2026-07-03,
|
||||
QA PASS**
|
||||
Profiled a 512MiB write over the configured `10.0.0.x` NVMe/TCP path and a
|
||||
same-node `local-path` comparator. Block write was `174.33 MiB/s` while
|
||||
local-path write was `1147.98 MiB/s` (`0.152x`), but Block read was
|
||||
`544.10 MiB/s` versus local-path read `513.54 MiB/s` (`1.060x`). Coarse
|
||||
pod-level CPU samples did not show target CPU saturation
|
||||
(`blockvolume_cpu_peak_percent=0.80`), so the next direction is backend /
|
||||
sync write instrumentation.
|
||||
84. Phase 126: Block NVMe/TCP Backend Write Instrumentation. **Active**
|
||||
Add minimal product-owned write-path timing/counter evidence to separate
|
||||
target protocol/copy cost from backend write and sync/flush cost. This is
|
||||
still diagnostic work, not a performance/SLO or NVMe/RDMA claim.
|
||||
|
||||
The internal release-train contract is
|
||||
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
|
||||
|
||||
@@ -1,79 +1,80 @@
|
||||
# Current Plan: Phase 125 Block NVMe/TCP Write-Path Profile
|
||||
# Current Plan: Phase 126 Block NVMe/TCP Backend Write Instrumentation
|
||||
|
||||
Status: planning and implementation.
|
||||
|
||||
Phase 124 split the current NVMe/TCP performance question with an independent
|
||||
local-path comparator:
|
||||
Phase 125 profiled a 512MiB Block NVMe/TCP write against a same-node local-path
|
||||
comparator:
|
||||
|
||||
```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
|
||||
network_baseline_mibps=3836.30
|
||||
block_nvme_seq_write_mibps=174.33
|
||||
block_nvme_seq_read_mibps=544.10
|
||||
local_path_seq_write_mibps=1147.98
|
||||
local_path_seq_read_mibps=513.54
|
||||
block_vs_local_write_ratio=0.152
|
||||
block_vs_local_read_ratio=1.060
|
||||
blockvolume_cpu_sample_count=3
|
||||
blockvolume_cpu_peak_percent=0.80
|
||||
write_path_observation=backend_sync
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
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.
|
||||
The read path is not behind local-path. The write path is far behind
|
||||
local-path, and coarse pod-level CPU sampling did not show target CPU
|
||||
saturation. Phase 126 should instrument the write path closer to code before
|
||||
choosing optimization work.
|
||||
|
||||
## Goal
|
||||
|
||||
Identify whether the Block NVMe/TCP write gap is mainly:
|
||||
Add minimal, targeted write-path evidence that can distinguish:
|
||||
|
||||
```text
|
||||
blockvolume target CPU / copy path
|
||||
durable backend write or fsync path
|
||||
current benchmark shape
|
||||
instrumentation gap / unknown
|
||||
target receive / protocol handling
|
||||
target-to-backend copy/write
|
||||
durable backend write
|
||||
sync / flush boundary
|
||||
benchmark shape artifact
|
||||
```
|
||||
|
||||
Required output:
|
||||
|
||||
```text
|
||||
phase125_block_nvme_tcp_write_path_profile_status=ok
|
||||
network_baseline_mibps=<number>
|
||||
local_path_seq_write_mibps=<number>
|
||||
phase126_block_nvme_tcp_backend_write_instrumentation_status=ok
|
||||
block_nvme_seq_write_mibps=<number>
|
||||
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>
|
||||
local_path_seq_write_mibps=<number>
|
||||
target_write_observed=true
|
||||
target_write_bytes=<number>
|
||||
target_write_ops=<number>
|
||||
target_write_duration_ms=<number|unknown>
|
||||
backend_write_duration_ms=<number|unknown>
|
||||
backend_sync_duration_ms=<number|unknown>
|
||||
write_path_observation=<target_protocol|target_copy|backend_write|backend_sync|benchmark_shape|unknown>
|
||||
next_recommendation=<specific next phase>
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
## Why This Is Next
|
||||
|
||||
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?
|
||||
Metrics-server CPU samples are too coarse to be the final answer. They are
|
||||
useful enough to avoid jumping directly to RDMA, but not precise enough to pick
|
||||
an optimization patch. The next gate should produce product-owned timing or
|
||||
counter evidence from the Block write path itself.
|
||||
|
||||
## Deliverables
|
||||
|
||||
1. Add a Phase 125 gate that reuses Phase 124 and collects write-time runtime
|
||||
evidence:
|
||||
1. Add minimal instrumentation behind an explicit debug/profile flag or test
|
||||
env path. Keep default runtime behavior unchanged.
|
||||
|
||||
2. Capture per-volume write evidence in the Phase 126 gate:
|
||||
|
||||
```text
|
||||
kubectl top pods --containers during write
|
||||
blockvolume process CPU snapshots
|
||||
blockvolume logs around write workload
|
||||
app pod write duration
|
||||
local-path comparator write duration
|
||||
bytes written
|
||||
write op count
|
||||
target-visible duration
|
||||
backend/durable duration if available
|
||||
sync/flush duration if available
|
||||
```
|
||||
|
||||
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
|
||||
@@ -82,25 +83,27 @@ the write path makes Block much slower than a same-node local-path PVC?
|
||||
performance_slo_claim_allowed=false
|
||||
```
|
||||
|
||||
4. Emit one concrete recommendation:
|
||||
4. Emit one concrete next recommendation:
|
||||
|
||||
```text
|
||||
phase126_target_copy_cpu_optimization
|
||||
phase126_durable_backend_write_optimization
|
||||
phase126_benchmark_shape_correction
|
||||
phase126_start_real_nvme_rdma_target
|
||||
phase127_backend_write_optimization
|
||||
phase127_sync_boundary_optimization
|
||||
phase127_target_copy_optimization
|
||||
phase127_benchmark_shape_correction
|
||||
phase127_start_real_nvme_rdma_target
|
||||
```
|
||||
|
||||
## Exit Criteria
|
||||
|
||||
- Runner scenario passes and archives the evidence bundle.
|
||||
- Runner scenario passes and archives evidence.
|
||||
- Cleanup verifier reports zero residue.
|
||||
- The gate names a write-path bottleneck class, or records `unknown` with the
|
||||
missing evidence needed to classify it.
|
||||
- The gate records target/backend write evidence generated by the product code,
|
||||
not only external `kubectl top` samples.
|
||||
- The next recommendation is tied to the observed write-path stage.
|
||||
- No RoCE/NVMe-RDMA or performance/SLO claim is added.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
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.
|
||||
Phase 126 still does not implement NVMe/RDMA, RoCE, GPU Direct, cuFile/cuObject,
|
||||
NIXL, production HA, or a performance SLO. It is an instrumentation phase to
|
||||
make the next optimization evidence-backed.
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
# Phase 125 Finished Plan: Block NVMe/TCP Write-Path Profile
|
||||
|
||||
Status: closed, QA PASS on 2026-07-03.
|
||||
|
||||
## Problem
|
||||
|
||||
Phase 124 showed an asymmetric performance gap: Block NVMe/TCP read was not
|
||||
behind the local-path comparator, but Block write was much slower than
|
||||
same-node local-path write. That made NVMe/RDMA premature: the next question was
|
||||
whether Block write looked CPU-bound, benchmark-shape-bound, or wait/sync bound.
|
||||
|
||||
## What Changed
|
||||
|
||||
- Added `scripts/run-phase125-block-nvme-tcp-write-path-profile-gate.sh`.
|
||||
- Added `testops/scenarios/nvme-tcp-write-path-profile-chain.yaml`.
|
||||
- Added an opt-in Phase 120 profiling hook:
|
||||
|
||||
```text
|
||||
SW_BLOCK_PHASE120_PROFILE_WRITE=true
|
||||
```
|
||||
|
||||
The hook records `kubectl top pods -A --containers`, node top, and process
|
||||
snapshots while the seq-write command runs. It is default-off and does not
|
||||
change previous gates unless explicitly enabled.
|
||||
|
||||
## Verification
|
||||
|
||||
Local checks:
|
||||
|
||||
```text
|
||||
bash -n scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh
|
||||
bash -n scripts/run-phase125-block-nvme-tcp-write-path-profile-gate.sh
|
||||
swblock validate testops/scenarios/nvme-tcp-write-path-profile-chain.yaml
|
||||
```
|
||||
|
||||
Runner gate:
|
||||
|
||||
```text
|
||||
nvme-tcp-write-path-profile-chain PASS
|
||||
22 actions: 22 passed, 0 failed
|
||||
```
|
||||
|
||||
Key evidence:
|
||||
|
||||
```text
|
||||
network_baseline_mibps=3836.30
|
||||
block_seq_size_mib=512
|
||||
block_nvme_seq_write_mibps=174.33
|
||||
block_nvme_seq_read_mibps=544.10
|
||||
local_path_seq_write_mibps=1147.98
|
||||
local_path_seq_read_mibps=513.54
|
||||
block_vs_local_write_ratio=0.152
|
||||
block_vs_local_read_ratio=1.060
|
||||
blockvolume_cpu_sample_count=3
|
||||
blockvolume_cpu_peak_percent=0.80
|
||||
write_path_observation=backend_sync
|
||||
next_recommendation=phase126_durable_backend_write_optimization
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
QA sign-off:
|
||||
|
||||
```text
|
||||
internal/docs/qa-assignments/phase125-block-nvme-tcp-write-path-profile-qa-signoff.md
|
||||
```
|
||||
|
||||
## Product Meaning
|
||||
|
||||
The current Block NVMe/TCP write gap is not explained by network capacity or by
|
||||
read-path behavior. The profiled write did not show target CPU saturation in
|
||||
the coarse pod-level samples, so the next work should instrument the write-side
|
||||
backend/sync path rather than start a new RDMA target.
|
||||
|
||||
## Next Step
|
||||
|
||||
Phase 126 should add targeted write-path instrumentation:
|
||||
|
||||
```text
|
||||
target receive timing
|
||||
target-to-backend write timing
|
||||
durable/sync timing
|
||||
bytes written and flush boundaries
|
||||
read/write asymmetry evidence
|
||||
```
|
||||
|
||||
The output should choose between backend write optimization, target copy
|
||||
optimization with stronger evidence, or a corrected benchmark shape.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
Phase 125 does not implement or validate NVMe/RDMA, RoCE, GPU Direct,
|
||||
cuFile/cuObject, NIXL, production HA, broad host compatibility, or a
|
||||
performance SLO.
|
||||
@@ -357,8 +357,15 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
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.
|
||||
- Phase 125 is closed. It profiled a 512MiB Block NVMe/TCP write and same-node
|
||||
local-path comparator: Block write `174.33 MiB/s`, local write
|
||||
`1147.98 MiB/s`, Block/local write ratio `0.152`, while Block read stayed
|
||||
comparable to local-path. Coarse pod-level CPU samples did not show target
|
||||
CPU saturation (`0.80%` peak), so the next direction is backend/sync write
|
||||
instrumentation.
|
||||
- Phase 126 is active for product-owned Block NVMe/TCP backend write
|
||||
instrumentation: target receive/copy timing, backend write timing, and
|
||||
sync/flush timing.
|
||||
- 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
|
||||
@@ -953,7 +960,10 @@ Approximate engineering effort if scope remains tight:
|
||||
- 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 125 is closed for Block NVMe/TCP write-path profiling. It narrowed the
|
||||
gap to write-side backend/sync behavior rather than read path, network, or
|
||||
immediate RDMA work.
|
||||
- Phase 126 is active for Block NVMe/TCP backend write instrumentation.
|
||||
- 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.
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
# Phase 125 Block NVMe/TCP Write-Path Profile 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`, ran a 512MiB profiled Block NVMe/TCP write, then
|
||||
ran a same-node 512MiB `local-path` write comparator.
|
||||
|
||||
## 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-write-path-profile-chain.yaml
|
||||
```
|
||||
|
||||
Runner result:
|
||||
|
||||
```text
|
||||
=== nvme-tcp-write-path-profile-chain === PASS (4m7.455s)
|
||||
22 actions: 22 passed, 0 failed
|
||||
run bundle: results\20260703-005137-2fc9
|
||||
```
|
||||
|
||||
Summary:
|
||||
|
||||
```text
|
||||
phase125_block_nvme_tcp_write_path_profile_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_profiled_seq_write
|
||||
network_baseline_mibps=3836.30
|
||||
publish_target=10.0.0.1:4420
|
||||
route_dev=enp1s0np0
|
||||
publish_target_network_class=100gbe_tcp
|
||||
block_seq_size_mib=512
|
||||
block_write_duration_ms=2937
|
||||
block_nvme_seq_write_mibps=174.33
|
||||
block_nvme_seq_read_mibps=544.10
|
||||
local_path_seq_write_duration_ms=446
|
||||
local_path_seq_write_mibps=1147.98
|
||||
local_path_seq_read_mibps=513.54
|
||||
block_vs_local_write_ratio=0.152
|
||||
block_vs_local_read_ratio=1.060
|
||||
blockvolume_cpu_sample_count=3
|
||||
blockvolume_cpu_peak_percent=0.80
|
||||
blockvolume_cpu_avg_percent=0.80
|
||||
write_path_observation=backend_sync
|
||||
top_bottleneck=backend_sync
|
||||
next_recommendation=phase126_durable_backend_write_optimization
|
||||
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 512MiB shape makes the write gap clearer:
|
||||
|
||||
```text
|
||||
local_path_seq_write_mibps=1147.98
|
||||
block_nvme_seq_write_mibps=174.33
|
||||
block_vs_local_write_ratio=0.152
|
||||
```
|
||||
|
||||
The read path still does not show the same gap:
|
||||
|
||||
```text
|
||||
local_path_seq_read_mibps=513.54
|
||||
block_nvme_seq_read_mibps=544.10
|
||||
block_vs_local_read_ratio=1.060
|
||||
```
|
||||
|
||||
During the profiled Block write, `kubectl top pods -A --containers` captured
|
||||
three blockvolume samples and did not show target CPU saturation:
|
||||
|
||||
```text
|
||||
blockvolume_cpu_peak_percent=0.80
|
||||
blockvolume_cpu_avg_percent=0.80
|
||||
```
|
||||
|
||||
This points away from a simple CPU-bound target-copy loop and toward a
|
||||
write-side wait/sync/backend path. The evidence is still coarse because
|
||||
metrics-server samples are low-frequency and only three samples landed during
|
||||
the 2.9s write. Phase 126 should instrument the write path closer to code:
|
||||
target receive/write timing, backend/durable write timing, and sync boundaries.
|
||||
|
||||
## Harness Findings
|
||||
|
||||
- Initial run used 2Gi PVCs and timed out before the profiled pod became Ready.
|
||||
The gate was narrowed to 1Gi PVCs with a 512MiB test file, which is sufficient
|
||||
for the profile and avoids unnecessary provisioning/attach risk.
|
||||
- Phase 120 gained an opt-in profiling hook:
|
||||
`SW_BLOCK_PHASE120_PROFILE_WRITE=true`. It is default-off, so existing
|
||||
Phase 120/122/123/124 gates keep their previous behavior unless explicitly
|
||||
enabled.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
Phase 125 does not implement or validate NVMe/RDMA, RoCE, GPU Direct,
|
||||
cuFile/cuObject, NIXL, production HA, broad host compatibility, or a
|
||||
performance SLO. It only narrows the current write-side bottleneck direction
|
||||
and recommends Phase 126 backend/write instrumentation.
|
||||
@@ -20,8 +20,10 @@ SMALL_BLOCK_BYTES="${SW_BLOCK_PHASE120_SMALL_BLOCK_BYTES:-4096}"
|
||||
FRONTEND_IP_MAP="${SW_BLOCK_FRONTEND_IP_MAP:-}"
|
||||
FRONTEND_NETWORK_CLASS="${SW_BLOCK_FRONTEND_NETWORK_CLASS:-}"
|
||||
EXPECTED_FRONTEND_ROUTE_DEV="${SW_BLOCK_EXPECTED_FRONTEND_ROUTE_DEV:-}"
|
||||
PROFILE_WRITE="${SW_BLOCK_PHASE120_PROFILE_WRITE:-false}"
|
||||
PROFILE_INTERVAL_SECONDS="${SW_BLOCK_PHASE120_PROFILE_INTERVAL_SECONDS:-1}"
|
||||
|
||||
mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,pvc,perf,status,cleanup}
|
||||
mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,pvc,perf,status,cleanup,profile}
|
||||
: >"${SUMMARY}"
|
||||
|
||||
write_summary() {
|
||||
@@ -142,6 +144,58 @@ print(max((end - start) // 1_000_000, 1))
|
||||
PY
|
||||
}
|
||||
|
||||
profile_write_sample_loop() {
|
||||
local target_pid="$1"
|
||||
local sample_file="$2"
|
||||
local sample=0
|
||||
: >"${sample_file}"
|
||||
while kill -0 "${target_pid}" >/dev/null 2>&1; do
|
||||
{
|
||||
echo "=== sample=${sample} ts=$(date -u +%Y-%m-%dT%H:%M:%SZ) ==="
|
||||
kubectl get pods -A -o wide 2>&1 || true
|
||||
kubectl top pods -A --containers 2>&1 || true
|
||||
kubectl top nodes 2>&1 || true
|
||||
ps -eo pid,ppid,pcpu,pmem,comm,args | grep -E 'blockmaster|blockvolume|blockcsi|sw-block' | grep -v grep || true
|
||||
kubectl -n "${APP_NAMESPACE}" logs -l app=sw-blockvolume --tail=30 --prefix 2>&1 || true
|
||||
} >>"${sample_file}"
|
||||
sample=$((sample + 1))
|
||||
sleep "${PROFILE_INTERVAL_SECONDS}"
|
||||
done
|
||||
}
|
||||
|
||||
measure_profiled_exec_ms() {
|
||||
local log="$1"
|
||||
local sample_file="$2"
|
||||
shift 2
|
||||
local start_ns end_ns cmd_pid sampler_pid rc
|
||||
start_ns="$(date +%s%N)"
|
||||
"$@" >"${log}" 2>&1 &
|
||||
cmd_pid=$!
|
||||
sampler_pid=""
|
||||
if [[ "${PROFILE_WRITE}" == "true" ]]; then
|
||||
profile_write_sample_loop "${cmd_pid}" "${sample_file}" &
|
||||
sampler_pid=$!
|
||||
fi
|
||||
set +e
|
||||
wait "${cmd_pid}"
|
||||
rc=$?
|
||||
set -e
|
||||
if [[ -n "${sampler_pid}" ]]; then
|
||||
kill "${sampler_pid}" >/dev/null 2>&1 || true
|
||||
wait "${sampler_pid}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
end_ns="$(date +%s%N)"
|
||||
if [[ "${rc}" -ne 0 ]]; then
|
||||
return "${rc}"
|
||||
fi
|
||||
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
|
||||
@@ -384,7 +438,7 @@ 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" \
|
||||
SEQ_WRITE_MS="$(measure_profiled_exec_ms "${ARTIFACT_DIR}/perf/seq-write.log" "${ARTIFACT_DIR}/profile/seq-write-samples.txt" \
|
||||
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" \
|
||||
|
||||
@@ -0,0 +1,484 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="${1:-$(pwd)}"
|
||||
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase125-block-nvme-tcp-write-path-profile-gate}"
|
||||
SUMMARY="${ARTIFACT_DIR}/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
BLOCK_DIR="${ARTIFACT_DIR}/block-profile"
|
||||
LOCAL_DIR="${ARTIFACT_DIR}/local-path"
|
||||
DIAG_DIR="${ARTIFACT_DIR}/diagnostics"
|
||||
|
||||
APP_NAMESPACE="${SW_BLOCK_APP_NAMESPACE:-default}"
|
||||
SEQ_MIB="${SW_BLOCK_PHASE125_SEQ_MIB:-512}"
|
||||
LOCAL_PVC="${SW_BLOCK_PHASE125_LOCAL_PVC_NAME:-sw-block-phase125-local-pvc}"
|
||||
LOCAL_POD="${SW_BLOCK_PHASE125_LOCAL_POD:-sw-block-phase125-local-perf}"
|
||||
LOCAL_PVC_SIZE="${SW_BLOCK_PHASE125_LOCAL_PVC_SIZE:-1Gi}"
|
||||
|
||||
FRONTEND_IP_MAP="${SW_BLOCK_PHASE125_FRONTEND_IP_MAP:-m01=10.0.0.1,m02=10.0.0.3}"
|
||||
FRONTEND_NETWORK_CLASS="${SW_BLOCK_PHASE125_FRONTEND_NETWORK_CLASS:-100gbe_tcp}"
|
||||
EXPECTED_ROUTE_DEV="${SW_BLOCK_PHASE125_EXPECTED_ROUTE_DEV:-enp1s0np0}"
|
||||
IMPORT_K3S_NODES="${SW_BLOCK_IMPORT_K3S_NODES:-192.168.1.181,192.168.1.184}"
|
||||
NETWORK_SERVER_NODE="${SW_BLOCK_PHASE125_NETWORK_SERVER_NODE:-m01}"
|
||||
NETWORK_CLIENT_NODE="${SW_BLOCK_PHASE125_NETWORK_CLIENT_NODE:-m02}"
|
||||
NETWORK_SERVER_HOST="${SW_BLOCK_PHASE125_NETWORK_SERVER_HOST:-192.168.1.181}"
|
||||
NETWORK_SSH_USER="${SW_BLOCK_PHASE125_NETWORK_SSH_USER:-testdev}"
|
||||
NETWORK_SSH_KEY="${SW_BLOCK_PHASE125_NETWORK_SSH_KEY:-${SW_BLOCK_IMPORT_K3S_SSH_KEY:-/opt/work/testdev_key}}"
|
||||
IPERF_PORT="${SW_BLOCK_PHASE125_IPERF_PORT:-51225}"
|
||||
IPERF_SECONDS="${SW_BLOCK_PHASE125_IPERF_SECONDS:-5}"
|
||||
|
||||
mkdir -p "${ARTIFACT_DIR}" "${BLOCK_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}"
|
||||
}
|
||||
|
||||
map_value() {
|
||||
local key="$1"
|
||||
local pair name value
|
||||
IFS=',' read -r -a pairs <<<"${FRONTEND_IP_MAP}"
|
||||
for pair in "${pairs[@]}"; do
|
||||
name="${pair%%=*}"
|
||||
value="${pair#*=}"
|
||||
if [[ "${name}" == "${key}" && "${value}" != "${pair}" ]]; then
|
||||
printf '%s\n' "${value}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
mibps_from_iperf_json() {
|
||||
python3 - "$1" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1], "r", encoding="utf-8") as f:
|
||||
doc = json.load(f)
|
||||
end = doc.get("end", {})
|
||||
bits = 0.0
|
||||
for key in ("sum_received", "sum", "sum_sent"):
|
||||
item = end.get(key)
|
||||
if isinstance(item, dict):
|
||||
bits = float(item.get("bits_per_second") or 0)
|
||||
if bits > 0:
|
||||
break
|
||||
print(f"{bits / 8 / 1048576:.2f}")
|
||||
PY
|
||||
}
|
||||
|
||||
run_network_baseline() {
|
||||
local server_ip="$1"
|
||||
local client_ip="$2"
|
||||
|
||||
write_summary "network_baseline_server_node=${NETWORK_SERVER_NODE}"
|
||||
write_summary "network_baseline_client_node=${NETWORK_CLIENT_NODE}"
|
||||
write_summary "network_baseline_server_ip=${server_ip}"
|
||||
write_summary "network_baseline_client_ip=${client_ip}"
|
||||
write_summary "network_baseline_tool=iperf3"
|
||||
|
||||
if ! command -v iperf3 >/dev/null 2>&1; then
|
||||
write_summary "network_baseline_status=unavailable"
|
||||
write_summary "network_baseline_reason=local_iperf3_missing"
|
||||
write_summary "network_baseline_mibps=unavailable"
|
||||
return 0
|
||||
fi
|
||||
if [[ ! -r "${NETWORK_SSH_KEY}" ]]; then
|
||||
write_summary "network_baseline_status=unavailable"
|
||||
write_summary "network_baseline_reason=ssh_key_missing"
|
||||
write_summary "network_baseline_mibps=unavailable"
|
||||
return 0
|
||||
fi
|
||||
if ! ssh -i "${NETWORK_SSH_KEY}" -o BatchMode=yes -o ConnectTimeout=5 "${NETWORK_SSH_USER}@${NETWORK_SERVER_HOST}" \
|
||||
"command -v iperf3 >/dev/null 2>&1" \
|
||||
>"${DIAG_DIR}/iperf3-remote-check.stdout.txt" \
|
||||
2>"${DIAG_DIR}/iperf3-remote-check.stderr.txt"; then
|
||||
write_summary "network_baseline_status=unavailable"
|
||||
write_summary "network_baseline_reason=remote_iperf3_or_ssh_unavailable"
|
||||
write_summary "network_baseline_mibps=unavailable"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ssh -i "${NETWORK_SSH_KEY}" -o BatchMode=yes -o ConnectTimeout=5 "${NETWORK_SSH_USER}@${NETWORK_SERVER_HOST}" \
|
||||
"pkill -x iperf3 >/dev/null 2>&1 || true; nohup iperf3 -s -1 -B ${server_ip} -p ${IPERF_PORT} >/tmp/phase125-iperf3-${IPERF_PORT}.log 2>&1 &" \
|
||||
>"${DIAG_DIR}/iperf3-server-start.stdout.txt" \
|
||||
2>"${DIAG_DIR}/iperf3-server-start.stderr.txt" || {
|
||||
write_summary "network_baseline_status=unavailable"
|
||||
write_summary "network_baseline_reason=remote_iperf3_start_failed"
|
||||
write_summary "network_baseline_mibps=unavailable"
|
||||
return 0
|
||||
}
|
||||
sleep 2
|
||||
|
||||
if iperf3 -J -c "${server_ip}" -B "${client_ip}" -p "${IPERF_PORT}" -t "${IPERF_SECONDS}" \
|
||||
>"${DIAG_DIR}/iperf3-client.json" \
|
||||
2>"${DIAG_DIR}/iperf3-client.stderr.txt"; then
|
||||
write_summary "network_baseline_status=ok"
|
||||
write_summary "network_baseline_mibps=$(mibps_from_iperf_json "${DIAG_DIR}/iperf3-client.json")"
|
||||
else
|
||||
write_summary "network_baseline_status=unavailable"
|
||||
write_summary "network_baseline_reason=iperf3_client_failed"
|
||||
write_summary "network_baseline_mibps=unavailable"
|
||||
fi
|
||||
|
||||
ssh -i "${NETWORK_SSH_KEY}" -o BatchMode=yes -o ConnectTimeout=5 "${NETWORK_SSH_USER}@${NETWORK_SERVER_HOST}" \
|
||||
"cat /tmp/phase125-iperf3-${IPERF_PORT}.log 2>/dev/null || true; pkill -x iperf3 >/dev/null 2>&1 || true" \
|
||||
>"${DIAG_DIR}/iperf3-server.log" \
|
||||
2>"${DIAG_DIR}/iperf3-server-fetch.stderr.txt" || true
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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 --no-headers 2>/dev/null | awk -v pvc="${LOCAL_PVC}" '$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="${LOCAL_PVC}" '$0 ~ pvc {print $1}' | \
|
||||
xargs -r kubectl delete pv --wait=false >/dev/null 2>&1
|
||||
set -e
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
cleanup_local_path || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
measure_local_write() {
|
||||
local storage_class="$1"
|
||||
local app_node="$2"
|
||||
local seq_bytes seq_write_ms seq_read_ms seq_write_mibps seq_read_mibps
|
||||
|
||||
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: phase125-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 pod "${LOCAL_POD}" -o wide >"${LOCAL_DIR}/pod.after-ready.txt" 2>&1
|
||||
|
||||
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/phase125-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/phase125-seq.bin of=/dev/null bs=1M; test \$(wc -c < /data/phase125-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 "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}"
|
||||
}
|
||||
|
||||
parse_blockvolume_cpu_profile() {
|
||||
python3 - "$1" <<'PY'
|
||||
import re
|
||||
import sys
|
||||
|
||||
path = sys.argv[1]
|
||||
values = []
|
||||
|
||||
def cpu_to_millicores(token):
|
||||
token = token.strip()
|
||||
if token.endswith("m"):
|
||||
return float(token[:-1])
|
||||
if token.endswith("n"):
|
||||
return float(token[:-1]) / 1_000_000
|
||||
if token.endswith("u"):
|
||||
return float(token[:-1]) / 1000
|
||||
return float(token) * 1000
|
||||
|
||||
try:
|
||||
lines = open(path, encoding="utf-8", errors="replace").read().splitlines()
|
||||
except OSError:
|
||||
lines = []
|
||||
|
||||
for line in lines:
|
||||
parts = line.split()
|
||||
if len(parts) < 5:
|
||||
continue
|
||||
if not parts[1].startswith("sw-blockvolume-"):
|
||||
continue
|
||||
cpu = parts[3]
|
||||
if not re.match(r"^[0-9.]+(m|u|n)?$", cpu):
|
||||
continue
|
||||
try:
|
||||
values.append(cpu_to_millicores(cpu))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if not values:
|
||||
print("blockvolume_cpu_sample_count=0")
|
||||
print("blockvolume_cpu_peak_percent=unknown")
|
||||
print("blockvolume_cpu_avg_percent=unknown")
|
||||
else:
|
||||
peak = max(values)
|
||||
avg = sum(values) / len(values)
|
||||
print(f"blockvolume_cpu_sample_count={len(values)}")
|
||||
print(f"blockvolume_cpu_peak_percent={peak / 10:.2f}")
|
||||
print(f"blockvolume_cpu_avg_percent={avg / 10:.2f}")
|
||||
PY
|
||||
}
|
||||
|
||||
classify_write_path() {
|
||||
python3 - "$1" "$2" "$3" <<'PY'
|
||||
import sys
|
||||
|
||||
def f(v):
|
||||
try:
|
||||
return float(v)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
block_vs_local = f(sys.argv[1])
|
||||
cpu_peak = f(sys.argv[2])
|
||||
cpu_samples = f(sys.argv[3])
|
||||
if block_vs_local is None or block_vs_local <= 0:
|
||||
print("unknown")
|
||||
elif block_vs_local >= 0.80:
|
||||
print("benchmark_shape")
|
||||
elif cpu_samples is None or cpu_samples <= 0 or cpu_peak is None:
|
||||
print("unknown")
|
||||
elif cpu_peak >= 80:
|
||||
print("target_cpu")
|
||||
elif cpu_peak <= 50:
|
||||
print("backend_sync")
|
||||
else:
|
||||
print("unknown")
|
||||
PY
|
||||
}
|
||||
|
||||
recommendation_for() {
|
||||
case "$1" in
|
||||
target_cpu)
|
||||
printf '%s' "phase126_target_copy_cpu_optimization"
|
||||
;;
|
||||
backend_sync)
|
||||
printf '%s' "phase126_durable_backend_write_optimization"
|
||||
;;
|
||||
benchmark_shape)
|
||||
printf '%s' "phase126_benchmark_shape_correction"
|
||||
;;
|
||||
*)
|
||||
printf '%s' "phase126_write_path_instrumentation"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [[ -z "${KUBECONFIG:-}" && -f /etc/rancher/k3s/k3s.yaml ]]; then
|
||||
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||
fi
|
||||
|
||||
SERVER_FRONTEND_IP="$(map_value "${NETWORK_SERVER_NODE}")"
|
||||
CLIENT_FRONTEND_IP="$(map_value "${NETWORK_CLIENT_NODE}")"
|
||||
if [[ -z "${SERVER_FRONTEND_IP}" || -z "${CLIENT_FRONTEND_IP}" ]]; then
|
||||
echo "frontend map ${FRONTEND_IP_MAP} must include ${NETWORK_SERVER_NODE} and ${NETWORK_CLIENT_NODE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
write_summary "phase125_block_nvme_tcp_write_path_profile_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_profiled_seq_write"
|
||||
|
||||
run_network_baseline "${SERVER_FRONTEND_IP}" "${CLIENT_FRONTEND_IP}"
|
||||
|
||||
SW_BLOCK_ARTIFACT_DIR="${BLOCK_DIR}" \
|
||||
SW_BLOCK_FRONTEND_IP_MAP="${FRONTEND_IP_MAP}" \
|
||||
SW_BLOCK_FRONTEND_NETWORK_CLASS="${FRONTEND_NETWORK_CLASS}" \
|
||||
SW_BLOCK_EXPECTED_FRONTEND_ROUTE_DEV="${EXPECTED_ROUTE_DEV}" \
|
||||
SW_BLOCK_IMPORT_K3S_NODES="${IMPORT_K3S_NODES}" \
|
||||
SW_BLOCK_PHASE120_PVC_NAME="${SW_BLOCK_PHASE125_BLOCK_PVC_NAME:-sw-block-phase125-block-pvc}" \
|
||||
SW_BLOCK_PHASE120_STORAGECLASS="${SW_BLOCK_PHASE125_BLOCK_STORAGECLASS:-sw-block-phase125-block}" \
|
||||
SW_BLOCK_PHASE120_POD="${SW_BLOCK_PHASE125_BLOCK_POD:-sw-block-phase125-block-perf}" \
|
||||
SW_BLOCK_PHASE120_PVC_SIZE="${SW_BLOCK_PHASE125_BLOCK_PVC_SIZE:-1Gi}" \
|
||||
SW_BLOCK_PHASE120_SEQ_MIB="${SEQ_MIB}" \
|
||||
SW_BLOCK_PHASE120_PROFILE_WRITE=true \
|
||||
SW_BLOCK_PHASE120_PROFILE_INTERVAL_SECONDS="${SW_BLOCK_PHASE125_PROFILE_INTERVAL_SECONDS:-1}" \
|
||||
bash "${ROOT}/scripts/run-phase120-nvme-tcp-performance-baseline-gate.sh" "${ROOT}" \
|
||||
>"${DIAG_DIR}/phase120-profile.stdout.txt" \
|
||||
2>"${DIAG_DIR}/phase120-profile.stderr.txt"
|
||||
|
||||
BLOCK_SUMMARY="${BLOCK_DIR}/phase120-nvme-tcp-performance-baseline-summary.txt"
|
||||
if [[ "$(require_summary_value "${BLOCK_SUMMARY}" phase120_nvme_tcp_performance_baseline_status)" != "ok" ]]; then
|
||||
echo "profiled block gate did not finish ok" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP_NODE="$(require_summary_value "${BLOCK_SUMMARY}" app_node)"
|
||||
LOCAL_SC="$(resolve_local_storageclass)"
|
||||
cleanup_local_path
|
||||
measure_local_write "${LOCAL_SC}" "${APP_NODE}"
|
||||
|
||||
BLOCK_WRITE="$(require_summary_value "${BLOCK_SUMMARY}" seq_write_mibps)"
|
||||
BLOCK_READ="$(require_summary_value "${BLOCK_SUMMARY}" seq_read_mibps)"
|
||||
BLOCK_WRITE_MS="$(require_summary_value "${BLOCK_SUMMARY}" seq_write_duration_ms)"
|
||||
LOCAL_WRITE="$(require_summary_value "${SUMMARY}" local_path_seq_write_mibps)"
|
||||
LOCAL_READ="$(require_summary_value "${SUMMARY}" local_path_seq_read_mibps)"
|
||||
LOCAL_WRITE_MS="$(require_summary_value "${SUMMARY}" local_path_seq_write_duration_ms)"
|
||||
WRITE_RATIO="$(ratio "${BLOCK_WRITE}" "${LOCAL_WRITE}")"
|
||||
READ_RATIO="$(ratio "${BLOCK_READ}" "${LOCAL_READ}")"
|
||||
|
||||
write_summary "publish_target=$(require_summary_value "${BLOCK_SUMMARY}" publish_target)"
|
||||
write_summary "route_dev=$(require_summary_value "${BLOCK_SUMMARY}" publish_target_route_dev)"
|
||||
write_summary "publish_target_network_class=$(require_summary_value "${BLOCK_SUMMARY}" publish_target_network_class)"
|
||||
write_summary "management_ip=$(require_summary_value "${BLOCK_SUMMARY}" management_ip)"
|
||||
write_summary "frontend_ip=$(require_summary_value "${BLOCK_SUMMARY}" frontend_ip)"
|
||||
write_summary "block_app_node=${APP_NODE}"
|
||||
write_summary "local_path_storageclass=${LOCAL_SC}"
|
||||
write_summary "block_seq_size_mib=$(require_summary_value "${BLOCK_SUMMARY}" seq_size_mib)"
|
||||
write_summary "block_write_duration_ms=${BLOCK_WRITE_MS}"
|
||||
write_summary "block_nvme_seq_write_mibps=${BLOCK_WRITE}"
|
||||
write_summary "block_nvme_seq_read_mibps=${BLOCK_READ}"
|
||||
write_summary "local_write_duration_ms=${LOCAL_WRITE_MS}"
|
||||
write_summary "block_vs_local_write_ratio=${WRITE_RATIO}"
|
||||
write_summary "block_vs_local_read_ratio=${READ_RATIO}"
|
||||
parse_blockvolume_cpu_profile "${BLOCK_DIR}/profile/seq-write-samples.txt" | while IFS= read -r line; do
|
||||
write_summary "${line}"
|
||||
done
|
||||
|
||||
CPU_PEAK="$(summary_value "${SUMMARY}" blockvolume_cpu_peak_percent)"
|
||||
CPU_SAMPLES="$(summary_value "${SUMMARY}" blockvolume_cpu_sample_count)"
|
||||
WRITE_OBSERVATION="$(classify_write_path "${WRITE_RATIO}" "${CPU_PEAK:-unknown}" "${CPU_SAMPLES:-0}")"
|
||||
NEXT_RECOMMENDATION="$(recommendation_for "${WRITE_OBSERVATION}")"
|
||||
write_summary "write_path_observation=${WRITE_OBSERVATION}"
|
||||
write_summary "top_bottleneck=${WRITE_OBSERVATION}"
|
||||
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 "phase125_block_nvme_tcp_write_path_profile_status=ok"
|
||||
@@ -0,0 +1,119 @@
|
||||
name: nvme-tcp-write-path-profile-chain
|
||||
timeout: 80m
|
||||
|
||||
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-phase125-block-perf sw-block-phase125-local-perf --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n default delete pvc sw-block-phase125-block-pvc sw-block-phase125-local-pvc --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete storageclass sw-block-phase125-block --ignore-not-found=true --wait=true --timeout=60s || true; kubectl get pv --no-headers | awk '/sw-block-phase125/ {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-phase125/ {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 }}-phase125-write-profile && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
|
||||
- name: run_gate
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 72m
|
||||
cmd: "cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile SW_BLOCK_PHASE125_FRONTEND_IP_MAP=m01=10.0.0.1,m02=10.0.0.3 SW_BLOCK_PHASE125_EXPECTED_ROUTE_DEV=enp1s0np0 SW_BLOCK_IMPORT_K3S_SSH_KEY=/opt/work/testdev_key bash scripts/run-phase125-block-nvme-tcp-write-path-profile-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 }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
pattern: "^phase125_block_nvme_tcp_write_path_profile_status=ok$"
|
||||
save_as: phase125_status_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ phase125_status_ok }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-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 }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-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 }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-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 }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
pattern: "^blockvolume_cpu_sample_count="
|
||||
save_as: cpu_sample_count
|
||||
- action: assert_greater
|
||||
actual: "{{ cpu_sample_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
pattern: "^blockvolume_cpu_peak_percent="
|
||||
save_as: cpu_peak_named
|
||||
- action: assert_greater
|
||||
actual: "{{ cpu_peak_named }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
pattern: "^write_path_observation="
|
||||
save_as: observation_named
|
||||
- action: assert_greater
|
||||
actual: "{{ observation_named }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-summary.txt"
|
||||
pattern: "^next_recommendation=phase126_"
|
||||
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 }}-phase125-write-profile/phase125-block-nvme-tcp-write-path-profile-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 }}-phase125-write-profile"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user