Add script/loadtest to measure throughput, latency and memory (closes #81) #209

Merged
clawbot merged 5 commits from issue-81-loadtest into next 2026-10-05 02:58:41 +02:00
5 Commits
Author SHA1 Message Date
clawbot 04755c93ff Refuse a script/loadtest clients count that starts with 0
check / check (push) Failing after 2s
vegeta reads a leading 0 in its worker count as octal, so 00 gave no
workers and 010 gave eight. The clients check before the build now
refuses any value starting with 0, zero included. The duration needs no
change: vegeta reads it as decimal, so 05s is five seconds.

TODO.md: the load test entry is once, at the top of Completed Steps,
and the entries for #206 and
#204 are no longer repeated.

Model: opus-5-5
2026-10-05 00:08:29 +00:00
clawbot 32136ff505 Check script/loadtest's duration before the build
A duration must be a whole number above zero followed by ms, s, m or
h; anything else prints the usage line and exits 2 before the image
build, as a bad number of clients already did. vegeta takes 0 to mean
no end. The load test's entry moves to the top of Completed Steps in
TODO.md.

Model: opus-5-5
2026-10-05 00:08:01 +00:00
clawbot 700c27c1fa Move the load-test origin's logic into internal/loadtestorigin
REPO_POLICIES.md requires cmd/ to be thin: one main.go whose body is a
single call into internal/ or pkg/. The image, the handler, the server
and their test move unchanged into internal/loadtestorigin, whose Run
does what main did; cmd/loadtest-origin/main.go only calls it.

Model: opus-5-5
2026-10-05 00:08:01 +00:00
clawbot b87c09920d Add script/loadtest to measure throughput, latency and memory (closes #81)
script/loadtest [duration [clients]], or make loadtest, is a benchmark
that script/check does not run. It builds the image and vegeta from a
pinned commit, then for each scenario starts a new pixad container and
a new cmd/loadtest-origin container, an upstream host that answers every
path with one generated JPEG: a cached image (hit), a new source image
per request (miss), and each new source image asked for by all clients
at once (herd). It prints vegeta's report, pixad's peak resident memory
and the requests the origin got. The containers share a network in
203.0.113.0/24, as pixad refuses private and local upstream addresses.
README.md says how to run and read it; TODO.md records a small baseline.

Model: opus-5-5
2026-10-05 00:08:01 +00:00
clawbot f4a3810c01 Test that the load-test origin serves one JPEG at every path
script/loadtest, added in the next commit, needs an upstream host that
answers any path with the same image, so each new path is a new source
image for pixad to fetch. This test checks that the origin's handler
answers several paths with 200, Content-Type image/jpeg and the same
bytes, and that the image decodes as a JPEG of the expected size. It
does not build until the origin exists.

Model: opus-5-5
2026-10-05 00:08:01 +00:00