Files
vnctalk-muc-rest/loadtest/README.md
T
Stefan-Sanger 683e224d67 test: add loadtest harness for telnet pool verification
Phase 4 verification harness in loadtest/:
- bench-pool.js: standalone dep-free model showing pool of 4 = 4x and
  pool of 8 = 8x throughput vs a single serialized connection.
- run.js: autocannon harness for the read path (req/s + p50/p90/p99).
- docker-compose.loadtest.yml + init.sql: seeded Postgres + app read-path
  stack (no Prosody) for local load testing.
- README.md: usage and staging validation checklist.

Part-of: <http://gitlab.vnc.biz/uxf/prosody-muc-rest/-/merge_requests/3>
2026-07-10 14:54:25 +02:00

1.7 KiB

loadtest/

Harnesses for validating the telnet-pool fix (PERFORMANCE-FINDINGS #1).

bench-pool.js — standalone model (no stack)

Pure-Node simulation comparing a single serialized connection vs a pool of N. No Prosody, no Postgres, no deps. Confirms the theoretical concurrency gain.

node loadtest/bench-pool.js [totalCommands] [cmdLatencyMs] [poolSize]
# defaults: 200 commands, 50 ms latency, pool size 4

Expected: pool of 4 ≈ 4x, pool of 8 ≈ 8x throughput vs the single connection.

run.js — autocannon against a live instance

HTTP load test of the read path (GET /api/groupchats, GET /api/healthcheck). Reports req/s and p50/p90/p99 latency. Mutating endpoints are excluded.

yarn add --dev autocannon          # one time
node loadtest/run.js [url] [durationSec] [connections]
# defaults: http://127.0.0.1:9511, 10 s, 50 connections

docker-compose.loadtest.yml — local read-path stack

Postgres (seeded via init.sql) + the app image. No Prosody, so only read endpoints are meaningful; the telnet pool fails to connect on startup (logged, non-fatal) and read paths don't use it.

docker compose -f loadtest/docker-compose.loadtest.yml up --build
# in another terminal:
node loadtest/run.js http://127.0.0.1:9511 10 50
# tear down:
docker compose -f loadtest/docker-compose.loadtest.yml down -v

What to verify on staging (no local Prosody/Postgres)

  • Concurrent POST /affiliations/:target requests do not cross telnet responses (the bug fixed by the pool).
  • POST /creategroup and PUT /groupchats/:target rename flows.
  • GET /healthcheck and GET /health.
  • Tune config.telnet.poolSize (env telnetPoolSize) against real Prosody load.