managarten/load-tests
Till JS 45790ffbb8 refactor(mana): rename inventar → inventory across the codebase
The workbench-registry app id 'inventar' did not match its
@mana/shared-branding MANA_APPS counterpart 'inventory', so the tier-
gating join in apps/web/src/lib/app-registry/registry.ts silently
failed for the inventory module — it fell into the "no MANA_APPS
entry, default visible" fallback and was effectively un-gated. The
codebase had also voted overwhelmingly for 'inventar' (53 files) vs
'inventory' (3 files in shared-branding), so the long-standing
mismatch was just bookkeeping debt waiting to bite.

Pre-release, no live data, so the cleanest fix is to align everything
on the English 'inventory':

- Workbench-registry id, module.config.ts appId, module folder, route
  folder and i18n locale folder all renamed via git mv
- Standalone apps/inventar/ workspace package renamed
- All imports, store identifiers (InventarEvents → InventoryEvents,
  INVENTAR_GUEST_SEED, inventarModuleConfig), i18n keys and href/goto
  paths follow the rename
- The German display label "Inventar" is preserved everywhere it is a
  user-visible string (page titles, i18n values, toast labels)
- Dexie table prefixes (invCollections, invItems, …) are unchanged
- Drive-by fix: ListView.svelte was querying non-existent
  inventarCollections/inventarItems tables — corrected to the actual
  invCollections/invItems names from module.config
- The "inventar ↔ inventory id mismatch" workaround comment in
  registry.ts is removed since the mismatch no longer exists

module-registry.ts also picks up the user's parallel newsModuleConfig
addition because both edits land in the same import block — keeping
them split would have left the build in an inconsistent state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 15:50:24 +02:00
..
api.js test(load): k6 script for the unified apps/api server 2026-04-09 12:27:54 +02:00
auth-api.js feat: GPU offload, signup limit, load tests & capacity planning 2026-03-28 21:14:24 +01:00
llm-ollama.js feat: GPU offload, signup limit, load tests & capacity planning 2026-03-28 21:14:24 +01:00
README.md test(load): k6 script for the unified apps/api server 2026-04-09 12:27:54 +02:00
sync-websocket.js feat: GPU offload, signup limit, load tests & capacity planning 2026-03-28 21:14:24 +01:00
web-apps.js refactor(mana): rename inventar → inventory across the codebase 2026-04-09 15:50:24 +02:00

Load Tests

k6-basierte Load Tests fuer die Mana-Infrastruktur.

Setup

# k6 installieren (macOS)
brew install k6

# WebSocket-Extension (fuer Sync-Tests)
# k6 hat WebSocket-Support eingebaut

Tests ausfuehren

# Gegen lokale Umgebung
k6 run load-tests/web-apps.js
k6 run load-tests/auth-api.js
k6 run load-tests/api.js
k6 run load-tests/sync-websocket.js
k6 run load-tests/llm-ollama.js

# api.js braucht ein gültiges JWT — entweder via $MANA_API_TOKEN
# oder es loggt sich mit den TEST_EMAIL/TEST_PASSWORD env vars ein
# (default: loadtest-api@mana.test / LoadTestApi123!).
k6 run -e MANA_API_TOKEN=eyJhbGc... load-tests/api.js

# Gegen Produktion (vorsichtig!)
k6 run -e BASE_URL=https://mana.how load-tests/web-apps.js

# Mit mehr/weniger Last
k6 run --vus 100 --duration 5m load-tests/web-apps.js

# JSON-Output fuer Grafana
k6 run --out json=results.json load-tests/web-apps.js

Test-Szenarien

Script Ziel Default VUs Dauer
web-apps.js SvelteKit Frontends (HTML-Responses) 10→50→10 5 min
auth-api.js Login, Register, Token Validation 5→20→5 4 min
api.js Unified apps/api Hono server (16 Module) — gemixte Workload mit Auth, Compute & Validation 10→50→100→0 4 min
sync-websocket.js mana-sync WebSocket Connections 10→30→10 5 min
llm-ollama.js Ollama Chat Completions 1→3→1 3 min

api.js Thresholds

Pro Route-Klasse hat das Script eigene p95-Budgets über tags:

Klasse Endpoints p95-Budget
health GET /health < 100ms
authed_get GET /api/v1/moodlit/presets, GET /api/v1/chat/models < 300ms
authed_post POST /api/v1/calendar/events/expand, POST /api/v1/todo/compute/* < 500ms
Global alle Requests aggregiert p95 < 500ms, p99 < 2s

Application-level error rate (4xx + 5xx + Check-Failures) muss unter 1% bleiben, sonst exit-code 1 → CI-Build bricht.

Metriken interpretieren

Metrik Gut Akzeptabel Schlecht
http_req_duration (p95) < 200ms < 1s > 2s
http_req_failed 0% < 1% > 5%
ws_connecting (p95) < 100ms < 500ms > 1s
iterations Steigend Stabil Fallend

Monitoring waehrend Tests

Grafana-Dashboard auf http://localhost:8080 (oder https://grafana.mana.how) beobachten:

  • Container CPU/RAM (cAdvisor)
  • PostgreSQL Connections
  • Redis Commands/sec
  • Netzwerk-Throughput