Skip to content

app/: a busy database answers 503 fast; load test of 20 unchanged 331-snapshot builds (sc-8900) - #86

Merged
ndbroadbent merged 4 commits into
mainfrom
laravel-load
Dec 2, 2026
Merged

ndbroadbent merged 4 commits into
mainfrom
laravel-load

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Part of sc-8900. Prompted by a production hang on 3 Dec 2026, 16:02–16:07 UTC. Talira infra traced it to the path between Cloudflare and the products tunnel: requests reached Envoy late or not at all, and every request that arrived was answered in 25–150 ms. So it wasn't the app or its pool. This makes the app fail fast if its pool ever does run out.

Changes

  • Pool acquire timeout: DB_ACQUIRE_TIMEOUT (seconds, default 5) replaces the framework's 30 s wait for a pooled connection. The pool size stays DB_MAX_CONNECTIONS (default 10 per process).
  • A busy pool answers fast: a request that can't get a connection gets a 503 with Retry-After: 5.
    • The API answers {"error": "busy"}.
    • /status answers {"ok": false, "database": "busy" | "error"}. /status reads the database, so Gatus sees a fast 503 rather than a hang. /up stays database-free, for readiness.
  • Load test (tests/load.rs):
    • A baseline build, then 20 unchanged builds of 331 text snapshots, each sent the way the CLI sends them (register every snapshot, then finalize).
    • It asserts that they write no page rows and finish within 120 s. On docspring-dev they take 39.6 s, about 2 s a build through the per-snapshot path. The groups API (sc-8868) skips that per-snapshot work for unchanged groups.
    • The requests run one after another: a refreshed test database has one connection, so they can't overlap inside #[laravel::test]. The concurrent burst needs a benchmark against a dev server, which comes before cutover.
  • A unit test checks that a pool timeout maps to the 503.

Cutover (sc-8900 tasks): each process sets application_name in DATABASE_URL (web, worker, scheduler), so Postgres's metrics split by it.

@ndbroadbent
ndbroadbent force-pushed the laravel-forge-domain branch 2 times, most recently from a3a525b to d2e764d Compare December 2, 2026 16:52
@visualci-com

visualci-com Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #402 · 333 unchanged · no changes

This PR vs base: 22 changed, 2 added since #343, across 8 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent force-pushed the laravel-forge-domain branch 2 times, most recently from 3144410 to 3ac441d Compare December 2, 2026 20:39
@ndbroadbent
ndbroadbent force-pushed the laravel-load branch 2 times, most recently from 19cc34a to d005ab1 Compare December 2, 2026 21:03
@ndbroadbent
ndbroadbent force-pushed the laravel-forge-domain branch 2 times, most recently from 7baea0d to 3a218cf Compare December 2, 2026 21:45
@ndbroadbent
ndbroadbent changed the base branch from laravel-forge-domain to main December 2, 2026 21:56
…RE_TIMEOUT (default 5 s) for a connection, and a request that can't get one answers 503 with Retry-After (the API's 'busy' error, /status with ok: false); a load test sends 20 unchanged builds of 331 snapshots, which store no page rows and finish within a bound
… a backstop when the scheduler is down; the builds sweep pushes VISUALCI_BUILDS_EXPIRE_HEARTBEAT, the key Gatus watches today
@ndbroadbent
ndbroadbent merged commit 90722e5 into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-load branch December 2, 2026 22:11
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.

1 participant