Skip to content

Commit 1bbd240

Browse files
n1hilityclaude
andcommitted
CARRY: ci(forge): run both forward-sweep sets on one runner
The first run put the two image sets on different runners whose disks differed five-fold in fdatasync cost, which confounds a before/after comparison. Run baseline and patched back to back in one job with a fresh state directory each. Serve the probe with a 1024-entry listen backlog: `python3 -m http.server` listens with a backlog of 5, and once the gateway stops serializing connections on disk commits a burst of 16+ overflows it and the supervisor's connect only succeeds after a 1 s SYN retransmit, which showed up as a fake 1 s floor in the patched rows. Break the forward warnings down (limit refusals vs. broken pipes from the client closing after 64 bytes) and count the gateway's sqlx `slow statement` warnings, which the baseline logged on every burst. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
1 parent 993a75e commit 1bbd240

4 files changed

Lines changed: 71 additions & 62 deletions

File tree

‎.github/workflows/forward-sweep.yml‎

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ name: forward-sweep
88
# with the rh-forge images (patched: SQLite store in WAL + synchronous=NORMAL),
99
# and prints a before/after table. Evidence for NVIDIA/OpenShell#3494.
1010
#
11-
# Each set runs in its own job: the gateway and CLI binaries are extracted
12-
# from the images, a single-node gateway runs on the runner with the Docker
13-
# compute driver (mTLS, file-backed SQLite on the runner disk, supervisor
14-
# taken from that set's supervisor image), a sandbox serves loopback HTTP,
15-
# and scripts/forward-sweep/sweep.py opens bursts of TCP connections through
16-
# the forward. See scripts/forward-sweep/run-set.sh.
11+
# Both sets run back to back on the same runner (same disk, fresh state
12+
# directory each) so the disk commit cost is identical for the comparison.
13+
# For each set the gateway and CLI binaries are extracted from the images, a
14+
# single-node gateway runs on the runner with the Docker compute driver
15+
# (mTLS, file-backed SQLite on the runner disk, supervisor taken from that
16+
# set's supervisor image), a sandbox serves loopback HTTP, and
17+
# scripts/forward-sweep/sweep.py opens bursts of TCP connections through the
18+
# forward. See scripts/forward-sweep/run-set.sh.
1719

1820
on:
1921
workflow_dispatch:
@@ -35,21 +37,13 @@ permissions:
3537

3638
jobs:
3739
sweep:
38-
name: Sweep (${{ matrix.set }})
40+
name: Sweep baseline then patched
3941
runs-on: ubuntu-latest
40-
timeout-minutes: 45
41-
strategy:
42-
fail-fast: false
43-
matrix:
44-
include:
45-
- set: baseline
46-
prefix: quay.io/opendatahub
47-
- set: patched
48-
prefix: ghcr.io/rh-forge
42+
timeout-minutes: 60
4943
env:
50-
SET_NAME: ${{ matrix.set }}
51-
IMAGE_TAG: ${{ matrix.set == 'baseline' && inputs.baseline_tag || inputs.patched_tag }}
52-
IMAGE_PREFIX: ${{ matrix.prefix }}
44+
BASELINE_TAG: ${{ inputs.baseline_tag }}
45+
PATCHED_TAG: ${{ inputs.patched_tag }}
46+
OUT_ROOT: ${{ runner.temp }}/forward-sweep-out
5347
steps:
5448
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5549
with:
@@ -62,60 +56,59 @@ jobs:
6256
username: ${{ github.actor }}
6357
password: ${{ secrets.GITHUB_TOKEN }}
6458

65-
- name: Run the sweep
59+
- name: Runner facts
60+
run: |
61+
docker info --format 'docker {{.ServerVersion}} on {{.OperatingSystem}} ({{.Architecture}}, {{.NCPU}} cpu, {{.MemTotal}} bytes)'
62+
df -hT "$RUNNER_TEMP" | tail -n 1
63+
uname -r
64+
65+
- name: Baseline (opendatahub images)
6666
shell: bash
6767
env:
68-
OUT_DIR: ${{ runner.temp }}/forward-sweep-out
68+
SET_NAME: baseline
69+
IMAGE_PREFIX: quay.io/opendatahub
70+
IMAGE_TAG: ${{ env.BASELINE_TAG }}
6971
run: |
7072
set -euo pipefail
7173
export GATEWAY_IMAGE="${IMAGE_PREFIX}/odh-openshell-gateway:${IMAGE_TAG}"
7274
export SUPERVISOR_IMAGE="${IMAGE_PREFIX}/odh-openshell-supervisor:${IMAGE_TAG}"
7375
export CLI_IMAGE="${IMAGE_PREFIX}/odh-openshell-cli:${IMAGE_TAG}"
74-
docker info --format 'docker {{.ServerVersion}} on {{.OperatingSystem}} ({{.Architecture}})'
76+
export OUT_DIR="${OUT_ROOT}/${SET_NAME}"
7577
scripts/forward-sweep/run-set.sh
7678
77-
- name: Upload raw outputs
78-
if: always()
79-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
80-
with:
81-
name: forward-sweep-${{ matrix.set }}
82-
path: ${{ runner.temp }}/forward-sweep-out
83-
if-no-files-found: warn
84-
85-
report:
86-
name: Before/after report
87-
needs: sweep
88-
if: always()
89-
runs-on: ubuntu-latest
90-
timeout-minutes: 5
91-
steps:
92-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
93-
with:
94-
persist-credentials: false
95-
96-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
97-
with:
98-
pattern: forward-sweep-*
99-
path: results
79+
- name: Patched (rh-forge images)
80+
if: ${{ !cancelled() }}
81+
shell: bash
82+
env:
83+
SET_NAME: patched
84+
IMAGE_PREFIX: ghcr.io/rh-forge
85+
IMAGE_TAG: ${{ env.PATCHED_TAG }}
86+
run: |
87+
set -euo pipefail
88+
export GATEWAY_IMAGE="${IMAGE_PREFIX}/odh-openshell-gateway:${IMAGE_TAG}"
89+
export SUPERVISOR_IMAGE="${IMAGE_PREFIX}/odh-openshell-supervisor:${IMAGE_TAG}"
90+
export CLI_IMAGE="${IMAGE_PREFIX}/odh-openshell-cli:${IMAGE_TAG}"
91+
export OUT_DIR="${OUT_ROOT}/${SET_NAME}"
92+
scripts/forward-sweep/run-set.sh
10093
101-
- name: Render report
94+
- name: Before/after report
95+
if: ${{ !cancelled() }}
10296
shell: bash
10397
run: |
10498
set -euo pipefail
105-
ls -R results
106-
if [ ! -f results/forward-sweep-baseline/results.json ] || [ ! -f results/forward-sweep-patched/results.json ]; then
107-
echo "::error::one or both sweep jobs produced no results.json; see the sweep job logs"
99+
if [ ! -f "${OUT_ROOT}/baseline/results.json" ] || [ ! -f "${OUT_ROOT}/patched/results.json" ]; then
100+
echo "::error::one or both sets produced no results.json; see the step logs"
108101
exit 1
109102
fi
110103
python3 scripts/forward-sweep/report.py \
111-
--baseline results/forward-sweep-baseline/results.json \
112-
--patched results/forward-sweep-patched/results.json \
113-
| tee results/report.md >> "$GITHUB_STEP_SUMMARY"
104+
--baseline "${OUT_ROOT}/baseline/results.json" \
105+
--patched "${OUT_ROOT}/patched/results.json" \
106+
| tee "${OUT_ROOT}/report.md" >> "$GITHUB_STEP_SUMMARY"
114107
115-
- name: Upload report
108+
- name: Upload raw outputs
116109
if: always()
117110
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
118111
with:
119-
name: forward-sweep-report
120-
path: results
112+
name: forward-sweep
113+
path: ${{ runner.temp }}/forward-sweep-out
121114
if-no-files-found: warn

‎deploy/docker/README-forge.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ SQLite store in WAL + `synchronous=NORMAL`), then prints a before/after table
3131
in the run summary. It is the evidence for
3232
[NVIDIA/OpenShell#3494](https://github.com/NVIDIA/OpenShell/issues/3494).
3333

34-
Each image set runs in its own job (`scripts/forward-sweep/run-set.sh`): the
35-
gateway and CLI binaries are extracted from the images; a single-node gateway
34+
Both image sets run back to back on the same runner, each with a fresh state
35+
directory (`scripts/forward-sweep/run-set.sh`), so the disk commit cost is the
36+
same for both. Per set: the gateway and CLI binaries are extracted from the
37+
images; a single-node gateway
3638
runs on the runner with the Docker compute driver, mTLS from
3739
`openshell-gateway generate-certs`, and a file-backed SQLite database on the
3840
runner disk; the set's supervisor image is pre-pulled (the gateway extracts the
@@ -44,5 +46,6 @@ forward and records wall time, completions and mean latency. The job also
4446
reports the raw `fdatasync`/`dd oflag=dsync` cost of the runner disk, the
4547
number of `connection limit reached` refusals in the forward log, and the
4648
`PRAGMA journal_mode` of the gateway database (`delete` for baseline, `wal`
47-
for patched). Raw logs and `results.json` are uploaded as artifacts; the
48-
`report` job merges both into one table.
49+
for patched) and the number of sqlx `slow statement` warnings the gateway
50+
logged. Raw logs and `results.json` are uploaded as one artifact; the final
51+
step merges both sets into one table in the run summary.

‎scripts/forward-sweep/report.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def main():
4242
("fsync_mean_ms", "fdatasync 4 KiB mean (ms)"),
4343
("dd_dsync", "dd oflag=dsync (200 x 4 KiB)"),
4444
("limit_hits", "`connection limit reached` in forward log"),
45+
("broken_pipes", "`Broken pipe` in forward log (client closed after 64 bytes)"),
4546
("forward_warnings", "forward warnings total"),
47+
("slow_statements", "sqlx `slow statement` warnings in gateway log"),
4648
("runner", "runner"),
4749
]:
4850
out.append(f"| {label} | {fmt(base.get(key))} | {fmt(new.get(key))} |")

‎scripts/forward-sweep/run-set.sh‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,14 @@ done
204204
"${CLI}" sandbox list
205205

206206
log "creating sandbox ${SANDBOX_NAME} serving HTTP on 127.0.0.1:${TARGET_PORT}"
207+
# `python3 -m http.server` listens with a backlog of 5; once the gateway stops
208+
# serializing connections on disk commits, a burst of 16+ overflows that queue
209+
# and the supervisor's connect only succeeds after a 1 s SYN retransmit, which
210+
# would show up as a fake 1 s floor. Serve the same handler with a large backlog.
211+
PROBE_SERVER="import http.server as h; h.ThreadingHTTPServer.request_queue_size = 1024; h.ThreadingHTTPServer(('127.0.0.1', ${TARGET_PORT}), h.SimpleHTTPRequestHandler).serve_forever()"
207212
timeout 600 "${CLI}" sandbox create --name "${SANDBOX_NAME}" --from "${PROBE_IMAGE}" \
208213
--no-auto-providers --detach -- \
209-
sh -lc "exec python3 -m http.server ${TARGET_PORT} --bind 127.0.0.1"
214+
sh -lc "exec python3 -c \"${PROBE_SERVER}\""
210215
for i in $(seq 1 180); do
211216
phase="$("${CLI}" sandbox get "${SANDBOX_NAME}" -o json 2>/dev/null \
212217
| python3 -c 'import json,sys; print(json.load(sys.stdin).get("phase",""))' 2>/dev/null || true)"
@@ -233,8 +238,10 @@ sleep 3
233238

234239
log "post-run evidence"
235240
LIMIT_HITS="$(grep -c 'connection limit reached' "${FORWARD_LOG}" || true)"
241+
BROKEN_PIPES="$(grep -c 'Broken pipe' "${FORWARD_LOG}" || true)"
236242
FORWARD_WARNINGS="$(grep -c 'service forward' "${FORWARD_LOG}" || true)"
237-
echo "connection limit reached: ${LIMIT_HITS} (forward warnings: ${FORWARD_WARNINGS})"
243+
SLOW_STATEMENTS="$(grep -c 'slow statement' "${GATEWAY_LOG}" || true)"
244+
echo "connection limit reached: ${LIMIT_HITS}; broken pipe (client closed after 64 bytes): ${BROKEN_PIPES}; forward warnings: ${FORWARD_WARNINGS}; sqlx slow statements: ${SLOW_STATEMENTS}"
238245
ls -la "${DB_DIR}"
239246
JOURNAL_MODE="$(python3 -c '
240247
import sqlite3, sys
@@ -248,6 +255,7 @@ SET_NAME="${SET_NAME}" GATEWAY_IMAGE="${GATEWAY_IMAGE}" SUPERVISOR_IMAGE="${SUPE
248255
CLI_IMAGE="${CLI_IMAGE}" GATEWAY_VERSION="${GATEWAY_VERSION}" CLI_VERSION="${CLI_VERSION}" \
249256
JOURNAL_MODE="${JOURNAL_MODE}" SIDECARS="${SIDECARS}" DD_OUT="${DD_OUT}" \
250257
LIMIT_HITS="${LIMIT_HITS}" FORWARD_WARNINGS="${FORWARD_WARNINGS}" \
258+
BROKEN_PIPES="${BROKEN_PIPES}" SLOW_STATEMENTS="${SLOW_STATEMENTS}" \
251259
python3 - "${WORK_DIR}" "${OUT_DIR}" <<'PY'
252260
import json, os, platform, sys
253261
work, out = sys.argv[1], sys.argv[2]
@@ -269,6 +277,8 @@ result = {
269277
"dd_dsync": env["DD_OUT"],
270278
"limit_hits": int(env["LIMIT_HITS"] or 0),
271279
"forward_warnings": int(env["FORWARD_WARNINGS"] or 0),
280+
"broken_pipes": int(env["BROKEN_PIPES"] or 0),
281+
"slow_statements": int(env["SLOW_STATEMENTS"] or 0),
272282
"runner": f"{platform.node()} {platform.release()}",
273283
"sweep": sweep,
274284
}
@@ -278,7 +288,8 @@ lines = [
278288
"",
279289
f"- gateway: `{result['gateway_version']}`, journal_mode: **{result['journal_mode']}**, sidecars: `{result['db_sidecars']}`",
280290
f"- fdatasync 4 KiB: mean {result['fsync_mean_ms']} ms, p50 {result['fsync_p50_ms']} ms, max {result['fsync_max_ms']} ms; dd oflag=dsync: {result['dd_dsync']}",
281-
f"- `connection limit reached` in forward log: {result['limit_hits']}",
291+
f"- `connection limit reached` in forward log: {result['limit_hits']} (other forward warnings: {result['forward_warnings'] - result['limit_hits']}, of which `Broken pipe` from the client closing after 64 bytes: {result['broken_pipes']})",
292+
f"- sqlx `slow statement` warnings in gateway log: {result['slow_statements']}",
282293
"",
283294
]
284295
lines += open(os.path.join(work, "sweep.txt")).read().split("\n\n", 1)[1].splitlines()

0 commit comments

Comments
 (0)