Documentation
¶
Overview ¶
Command perf measures how many concurrent requests a running Dilion server sustains, and at what latency, with a given number of accounts in its database. It is what .github/workflows/perf.yml runs; locally:
make up && DILION_DSN=... DILION_JWT_SECRET=... go run ./cmd/dilion &
go run ./test/perf -dsn postgres://dilion:dilion@localhost:55432/dilion_dev \
-url http://localhost:8787 -accounts 1000
It seeds the accounts straight into auth.users (one bcrypt hash at the server's cost, shared by all of them), then runs each scenario in steps of increasing concurrency. Every step is a closed loop: that many virtual users each send their next request as soon as the previous one answers, with no think time, so "concurrency" is requests in flight, not people signed in. A step passes when its p95 latency is within -slo and fewer than 1% of its requests fail; the ramp stops at the first step that does not. The largest passing step is the scenario's sustained concurrency.
Scenarios:
sign-in POST /token?grant_type=password for a random account
(bcrypt dominates: this is the CPU-bound path)
session-check per virtual user, signed in beforehand: GET /user, over
and over (what a client or an API checking a session
sends most)
session-mix per virtual user, signed in beforehand: four GET /user,
then one POST /token?grant_type=refresh_token rotating
its own token (signed-in clients, refresh included)
The server, Postgres and this load generator share one machine in CI, so the numbers are for comparing runs with each other, not a capacity plan.