Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copy to .env for local overrides. Never commit .env.

# Pinned Tracewick package version used by the workload app (must match stand/app/composer.json).
# Actual Composer package constraint used by image builds (exact source refs supported).
TRACEWICK_VERSION=0.1.0

# Image pins (defaults match compose.yaml).
Expand Down Expand Up @@ -40,3 +40,15 @@ TRACEWICK_SPOOL_MAX_FILES=500
# M3 chaos: drain URL override (default http://pyroscope:4040)
# TRACEWICK_PYROSCOPE_URL=http://toxiproxy:14040


# Observed soak requires explicit exported pins; see docs/soak.md.
# TRACEWICK_VERSION=dev-develop#<full-commit-sha>
# AGENT_REF=<full-commit-sha>
# AGENT_VERSION=0.2.1 # release mode, when AGENT_REF is unset
# EXCIMER_REF=<full-commit-sha> # optional exact source build
# EXCIMER_VERSION=1.2.7
# BASELINE_DURATION=5m
# WARMUP_DURATION=5m
# COOLDOWN_DURATION=2m
# DRAIN_TIMEOUT=2m
# STATS_INTERVAL=15
22 changes: 22 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Checks
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Soak regression tests
run: python3 -m unittest discover -s tests -v
- name: Shell syntax and Compose configuration
run: |
bash -n scripts/run-soak.sh scripts/run-soak-matrix.sh scripts/run-soak-legacy.sh
sh -n scripts/soak_probe.sh
docker compose config --quiet
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ Thumbs.db
# Cursor / agent scratch
.cursor/
scripts/__pycache__/

tests/__pycache__/
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ k6 runs via a pinned Docker image (`K6_IMAGE` in the Makefile). Host-installed k
- Link the scenario / report you changed.
- If you change methodology, update `METHOD.md` and call it out in the PR.
- Library API changes belong upstream in [tracewick/tracewick](https://github.com/tracewick/tracewick) — open an issue there rather than forking behavior here.

For observed-soak changes, run `make check-soak` and a short real-Excimer
RR/agent/Pyroscope pilot using [docs/soak.md](docs/soak.md). Include negative
controls for worker replacement or missing telemetry when changing validity gates.
A managed shared-cgroup smoke is harness evidence only, never resource attribution
or a completed long soak. Optional plotting needs Matplotlib after collection.
10 changes: 10 additions & 0 deletions LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ capacity, or 72h stability.

- Secrets never belong in git; use `.env` from `.env.example`.
- Toxiproxy chaos scenarios are optional and documented when enabled; default smoke does not require them.

## Observed-soak instrumentation

The new [soak runner](docs/soak.md) separates process RSS from cgroup memory and
checks worker/container continuity. Historical Docker-stats CSVs do not provide
per-process RSS, FD, thread, queue or restart evidence. Current instrumentation
does not retroactively close the 72h depth-48 gate. Shared-cgroup managed runners
can test the harness only; resource attribution must be validated on the actual
Linux benchmark server. k6 REST quantiles are cumulative, not hourly quantiles;
Go goroutine/heap and FPM/Swoole writer-drop totals are not collected.
11 changes: 11 additions & 0 deletions METHOD.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ Use `reports/TEMPLATE.md`. Every checked-in report should record:
- Metric table for layers A/B (and C if checked)
- Screenshots (relative paths under `reports/…`)
- Honesty paragraph: what was *not* measured

## Observed soak validity

The [observed-soak runbook](docs/soak.md) specifies exact source/runtime identity,
a short unprofiled baseline, profiling warmup, steady load, drain and cooldown.
Process RSS/anonymous memory are separate from container memory. Worker recycling,
container changes, missing telemetry and undelivered work invalidate continuity.
Record both first/last windows and whole-series growth slopes, CPU per completed
k6 HTTP request, queue and delivery counters. A valid observation is not an
automatic leak-free verdict; the elapsed steady duration and resource trends must
be reviewed. No new 72-hour result is implied by adding this instrumentation.
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PYROSCOPE_PORT ?= 4040
RATE ?= 20
DURATION ?= 2m

.PHONY: help build build-rr build-swoole up up-rr up-swoole down up-chaos wait-ready wait-app k6-version bench-smoke bench-overhead bench-spool-pressure bench-chaos bench-soak bench-rps prepare-reports-dir collect-report smoke-check
.PHONY: check-soak plot-soak help build build-rr build-swoole up up-rr up-swoole down up-chaos wait-ready wait-app k6-version bench-smoke bench-overhead bench-spool-pressure bench-chaos bench-soak bench-rps prepare-reports-dir collect-report smoke-check

help: ## Show targets
@awk 'BEGIN {FS = ":.*##"; printf "Targets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " %-18s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
Expand Down Expand Up @@ -142,16 +142,16 @@ bench-chaos: ## M3 optional: Toxiproxy latency toward Pyroscope (READER=drain|ag
READER="$${READER:-drain}" \
./scripts/run-chaos-pyroscope.sh

bench-soak: ## Soak: fixed RPS + workload/reader RSS·CPU (RUNTIME=fpm|rr|swoole READER=drain|agent)
bench-soak: ## Observed soak: explicit pins + process/queue/CPU telemetry (default RR + agent)
@chmod +x scripts/run-soak.sh scripts/sample-container-stats.sh scripts/summarize-soak.py scripts/ensure-reader.sh scripts/recreate-workload.sh
RATE="$${RATE:-10}" DURATION="$${DURATION:-72h}" BASE_URL="$(BASE_URL)" K6_IMAGE="$(K6_IMAGE)" \
COMPOSE="$(COMPOSE)" REPORTS_DIR="$(REPORTS_DIR)" STATS_INTERVAL="$${STATS_INTERVAL:-60}" \
RATE="$${RATE:-10}" DURATION="$${DURATION:-72h}" BASE_URL="$${BASE_URL:-}" K6_IMAGE="$(K6_IMAGE)" \
COMPOSE="$(COMPOSE)" REPORTS_DIR="$(REPORTS_DIR)" STATS_INTERVAL="$${STATS_INTERVAL:-15}" \
TRACEWICK_SAMPLE_RATE="$${TRACEWICK_SAMPLE_RATE:-0.1}" \
READER="$${READER:-drain}" RUNTIME="$${RUNTIME:-fpm}" \
WORK_STACK_DEPTH="$${WORK_STACK_DEPTH:-0}" \
PHP_FPM_MAX_CHILDREN="$${PHP_FPM_MAX_CHILDREN:-4}" \
RR_NUM_WORKERS="$${RR_NUM_WORKERS:-4}" \
SWOOLE_WORKER_NUM="$${SWOOLE_WORKER_NUM:-4}" \
READER="$${READER:-agent}" RUNTIME="$${RUNTIME:-rr}" \
WORK_STACK_DEPTH="$${WORK_STACK_DEPTH:-48}" \
PHP_FPM_MAX_CHILDREN="$${PHP_FPM_MAX_CHILDREN:-1}" \
RR_NUM_WORKERS="$${RR_NUM_WORKERS:-1}" \
SWOOLE_WORKER_NUM="$${SWOOLE_WORKER_NUM:-1}" \
./scripts/run-soak.sh

bench-rps: ## High-RPS pipeline: deep stacks + spool (RUNTIME=fpm|rr|swoole READER=drain|agent|off)
Expand Down Expand Up @@ -188,3 +188,12 @@ collect-report: ## Gather local host meta under reports/_local/
@echo "BASE_URL=$(BASE_URL)" >> "$(CURDIR)/$(REPORTS_DIR)/meta.txt"
@git rev-parse HEAD >> "$(CURDIR)/$(REPORTS_DIR)/meta.txt" 2>/dev/null || true
@echo "Wrote $(REPORTS_DIR)/uname.txt and meta.txt"

check-soak: ## Soak telemetry/validity regression tests and configuration syntax
python3 -m unittest discover -s tests -v
bash -n scripts/run-soak.sh scripts/run-soak-legacy.sh scripts/run-soak-matrix.sh
sh -n scripts/soak_probe.sh stand/app/install-excimer.sh
$(COMPOSE) config --quiet

plot-soak: ## Render preserved soak telemetry (RUN_DIR=..., requires python3-matplotlib)
python3 scripts/plot-soak.py "$(RUN_DIR)"
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cp .env.example .env # optional
make up # build + Pyroscope + Grafana + PHP workload + drain
make bench-smoke # wiring smoke (profiles → Pyroscope)
make bench-overhead # M2: baseline vs on @ fixed RPS (~2× duration)
make bench-soak # soak: RSS/CPU series (default 10 RPS / 72h; use tmux)
# Long soaks run separately: see docs/soak.md for pins and the pilot.
make down
```

Expand Down Expand Up @@ -63,29 +63,22 @@ reports/ checked-in reports; local scratch under reports/_local/
| `make bench-overhead` | M2 A/B at `RATE` req/s (default 20) for `DURATION` (default `2m`) |
| `make bench-spool-pressure` | M3: stop drain, fill spool, measure catch-up |
| `make bench-chaos` | M3: Toxiproxy latency toward Pyroscope |
| `make bench-soak` | Soak: fixed RPS + FPM/drain RSS·CPU (default `10` / `72h`) |
| `make bench-soak` | Observed soak: explicit pins, RR/agent by default; [runbook](docs/soak.md) |
| `make bench-rps` | High-RPS pipeline: deep stacks + spool series (default `500` / `5m`) |
| `make collect-report` | Stash host meta under `reports/_local/` |

### Soak (manual / tmux)
### Observed soak (manual)

Run on the VPS outside an IDE terminal so logout does not kill k6:

```bash
cd /root/benchmarks && git pull --ff-only && make up
tmux new -s soak
# inside tmux:
make bench-soak
# Detach: Ctrl-b d | Reattach: tmux attach -t soak
# Agent + depth-48 short matrix (FPM → RR → Swoole), e.g. 6h each:
# DURATION=6h RATE=10 READER=agent WORK_STACK_DEPTH=48 ./scripts/run-soak-matrix.sh
```

Defaults: `RATE=10`, `DURATION=72h`, `STATS_INTERVAL=60`, `sampleRate=0.1`. `RUNTIME=fpm|rr|swoole`, `READER=drain|agent`. Artifacts: `reports/_local/soak-<utc>/` and `soak-latest.md`.
Follow [docs/soak.md](docs/soak.md): explicit source pins → short pilot → calibrated
72-hour run under tmux. The runner starts its own Compose project; do not run
`make up` alongside it on the same ports. Defaults: RR/agent, one RR worker,
depth 48, sample rate 0.1, 15-second telemetry. Raw evidence and validity/resource
reports are under `reports/_local/soak-<utc>/`. `make check-soak` runs regression
checks; `make plot-soak RUN_DIR=...` renders preserved telemetry.

### High-RPS pipeline (manual)

Uses the same `/work` wall budget (`WORK_BUSY_MS` / `WORK_SLEEP_MS`) as overhead/soak. Opt-in `WORK_STACK_DEPTH` deepens call stacks so spool payloads are larger (closer to a real app). Default scenarios keep `WORK_STACK_DEPTH=0`.
Uses the same `/work` wall budget (`WORK_BUSY_MS` / `WORK_SLEEP_MS`) as overhead/soak. Opt-in `WORK_STACK_DEPTH` deepens call stacks so spool payloads are larger (closer to a real app). Other legacy scenarios keep `WORK_STACK_DEPTH=0`; observed soak defaults to 48.

**Honesty:** these runs are **one instance** (typically app + drain + Pyroscope + k6 on a single VPS). The sustained RPS you publish is the **ceiling of that server configuration and synthetic work unit**, not “Tracewick handles N RPS everywhere” and not a multi-node fleet result. On the Timeweb 8 vCPU stand with depth-48 `/work` (~25 ms busy + 10 ms sleep, 32 FPM workers), overload probes showed ~760 achieved RPS with multi-second latency — so a clean hold is expected around **~700 RPS**, not 1.5–3k.

Expand Down
21 changes: 13 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ x-app-build: &app-build
args:
PHP_VERSION: ${PHP_VERSION:-8.4}
EXCIMER_VERSION: ${EXCIMER_VERSION:-1.2.6}
EXCIMER_REF: ${EXCIMER_REF:-}
TRACEWICK_VERSION: ${TRACEWICK_VERSION:-0.1.0}

x-app-env: &app-env
Expand Down Expand Up @@ -66,21 +67,21 @@ services:

app-fpm:
build: *app-build
image: tracewick-benchmarks-fpm:${TRACEWICK_VERSION:-0.1.0}
image: tracewick-benchmarks-fpm:${TRACEWICK_IMAGE_TAG:-${TRACEWICK_VERSION:-0.1.0}}
environment:
<<: *app-env
volumes:
- ./stand/app/public:/srv/app/public:ro
- app-spool:/var/spool/tracewick
depends_on: [pyroscope]
healthcheck:
test: [CMD-SHELL, php -r 'exit(extension_loaded("excimer")?0:1);']
test: ["CMD-SHELL", "php -r 'exit(extension_loaded(\"excimer\")?0:1);'"]
interval: 10s
timeout: 3s
retries: 12

app-drain:
image: tracewick-benchmarks-fpm:${TRACEWICK_VERSION:-0.1.0}
image: tracewick-benchmarks-fpm:${TRACEWICK_IMAGE_TAG:-${TRACEWICK_VERSION:-0.1.0}}
user: www-data
entrypoint: [vendor/bin/tracewick-drain]
command: [--memory-limit=128M]
Expand All @@ -101,7 +102,9 @@ services:
context: stand/agent
args:
AGENT_VERSION: ${AGENT_VERSION:-0.1.0}
image: tracewick-benchmarks-agent:${AGENT_VERSION:-0.1.0}
AGENT_REF: ${AGENT_REF:-}
AGENT_BUILD_TARGET: ${AGENT_BUILD_TARGET:-release}
image: tracewick-benchmarks-agent:${AGENT_IMAGE_TAG:-${AGENT_VERSION:-0.1.0}}
user: "33:33"
environment:
TRACEWICK_SPOOL_DIR: ${TRACEWICK_SPOOL_DIR:-/var/spool/tracewick}
Expand Down Expand Up @@ -148,9 +151,10 @@ services:
args:
PHP_VERSION: ${PHP_VERSION:-8.4}
EXCIMER_VERSION: ${EXCIMER_VERSION:-1.2.6}
EXCIMER_REF: ${EXCIMER_REF:-}
TRACEWICK_VERSION: ${TRACEWICK_VERSION:-0.1.0}
ROADRUNNER_VERSION: ${ROADRUNNER_VERSION:-2025.1.15}
image: tracewick-benchmarks-rr:${TRACEWICK_VERSION:-0.1.0}
image: tracewick-benchmarks-rr:${TRACEWICK_IMAGE_TAG:-${TRACEWICK_VERSION:-0.1.0}}
user: "33:33"
environment:
<<: *app-env
Expand All @@ -161,7 +165,7 @@ services:
- 127.0.0.1:${RR_PORT:-8082}:8080
depends_on: [pyroscope]
healthcheck:
test: [CMD-SHELL, php -r 'exit(extension_loaded("excimer")?0:1);']
test: ["CMD-SHELL", "php -r 'exit(extension_loaded(\"excimer\")?0:1);'"]
interval: 10s
timeout: 3s
retries: 12
Expand All @@ -174,9 +178,10 @@ services:
args:
PHP_VERSION: ${PHP_VERSION:-8.4}
EXCIMER_VERSION: ${EXCIMER_VERSION:-1.2.6}
EXCIMER_REF: ${EXCIMER_REF:-}
TRACEWICK_VERSION: ${TRACEWICK_VERSION:-0.1.0}
SWOOLE_VERSION: ${SWOOLE_VERSION:-6.0.2}
image: tracewick-benchmarks-swoole:${TRACEWICK_VERSION:-0.1.0}
image: tracewick-benchmarks-swoole:${TRACEWICK_IMAGE_TAG:-${TRACEWICK_VERSION:-0.1.0}}
user: "33:33"
environment:
<<: *app-env
Expand All @@ -187,7 +192,7 @@ services:
- 127.0.0.1:${SWOOLE_PORT:-8083}:8080
depends_on: [pyroscope]
healthcheck:
test: [CMD-SHELL, php -r 'exit(extension_loaded("excimer")&&extension_loaded("swoole")?0:1);']
test: ["CMD-SHELL", "php -r 'exit(extension_loaded(\"excimer\")&&extension_loaded(\"swoole\")?0:1);'"]
interval: 10s
timeout: 3s
retries: 12
Expand Down
Loading
Loading