Skip to content

Add deterministic trace replay benchmark#18

Open
tillkruss wants to merge 5 commits into
mainfrom
claude/wordpress-benchmark-simulation-7VVTv
Open

Add deterministic trace replay benchmark#18
tillkruss wants to merge 5 commits into
mainfrom
claude/wordpress-benchmark-simulation-7VVTv

Conversation

@tillkruss

Copy link
Copy Markdown
Member

Add replay.js, a k6 script that fires a fixed corpus of captured requests
against a stateless replay endpoint instead of a live WordPress site. Each
run executes an identical, reproducible workload (default 100 traces x 100
repeats = 10,000 requests, closed-loop) using per-vu-iterations with a
segment-safe trace mapping, so it scales across load generators via k6
execution segments.

Add stubs/replay-server.php, a dummy endpoint that fakes the work and returns
the metric shape replay.js parses, as a starting point for the real payload
executor.

claude added 5 commits June 2, 2026 03:54
Add replay.js, a k6 script that fires a fixed corpus of captured requests
against a stateless replay endpoint instead of a live WordPress site. Each
run executes an identical, reproducible workload (default 100 traces x 100
repeats = 10,000 requests, closed-loop) using per-vu-iterations with a
segment-safe trace mapping, so it scales across load generators via k6
execution segments.

Add stubs/replay-server.php, a dummy endpoint that fakes the work and returns
the metric shape replay.js parses, as a starting point for the real payload
executor.
Add TODO.md with a high-level overview of the trace-capture/replay benchmark,
component status, remaining work, and a separate PhpBench track for running the
Redis fake workload as an isolated micro-benchmark.

Make replay.js load profile configurable via SCENARIO (fixed / ramping /
constant / shared), with tunable stages, duration and concurrency. The
deterministic, segment-safe trace mapping now works uniformly across all
executors.
Switch replay.js to the shared Metrics class from lib/metrics.js (same as
wp.js and the woo-* scripts) instead of bespoke replay_* metrics, and add an
errors Rate to match. Metrics are now parsed from the Object Cache Pro footnote
comment in the response body, so the real SUT needs no special handling beyond
enabling analytics.footnote.

Make stubs/replay-server.php print a fake OCP footnote comment in the exact
format the real mu-plugin emits (see k6-metrics.php), with a configurable
?client= so the using-* metrics populate.
Add CAPTURE.md: handoff instructions for building the WordPress request-capture
mu-plugin (Redis commands, SQL queries, and per-op timeline), including capture
sources, binary-safe encoding rules, race-free file writing, and verification.

Add corpus/00000.json and corpus/manifest.json as the canonical, hand-authored
examples of the capture format: an ordered php/redis/sql timeline with verbatim
(base64) Redis values, pipeline round-trips, full SQL text, and a summary block
aligned with the existing metric vocabulary.
Add replay/ executor that replays captured corpus traces against a real Redis:
- config.php: env-driven config (.env supported), client/connection/SQL settings
- redis.php: phpredis/relay wrapper issuing commands via rawCommand, preserving
  single/pipeline/multi round-trips
- replayer.php: walks the timeline (php usleep, redis commands with {b64} value
  decoding, SQL sleep-or-execute), returns measured metrics; reusable by PhpBench
- index.php: stateless ?id=N HTTP endpoint, preloaded corpus + persistent
  connections per worker, emits a measured OCP-style footnote for replay.js

SQL defaults to reproducing timing as a sleep (no DB needed); REPLAY_SQL_MODE=
execute runs queries against MySQL. Credentials come from environment variables
(.env.example added, .env gitignored). Fix the example trace's zero-TTL SETEX to
a plain SET. README documents both the real executor and the no-Redis dummy.

Verified end-to-end against a live Redis via phpredis: writes land, hit/miss
detection works (cold=misses, pre-warmed=hits), pipeline/multi replay, and the
footnote parses via lib/metrics.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants