Skip to content

Stress / Load Testing

Status: shipped. Four scenarios (S-01..S-04) wired into a dedicated runner alongside the regression / UAT suite, under usr/share/tests/backend/. Reports land in $BSS_HOME/var/log/stress/ by default (--reports-dir overrides).

The platform exposes the primitives needed to drive significant load:

  • bin/cdr_generator — emits arbitrary numbers of synthetic CDR files; consumed by cdr_loader.
  • bin/diameter_client — mock DIAMETER peer with single / sequential / parallel execution modes, configurable request count and thread count.
  • prepaid_mass_rating role — a developer-only mode of the billing handler that rates every un-rated online row in 200-row batches.

The Stage 6 runner sits next to these primitives and adds the orchestration, metrics capture, and pass/fail verdict that turns them into a regression-style stress suite. The runner reuses the regression suite's harness primitives (reserved MSISDN prefix 40799, verbose tag set, DB cleanup helpers) so test-owned rows never collide with operator data.

Quick start

cd usr/share/tests/backend

# Cold-start the platform, run one scenario, tear down.
./run_stress.sh --scenario S-01 --bring-up

# Run every scenario in order. Each gets its own cold start.
./run_stress.sh --all --bring-up

# Override scenario knobs (production-scale CDR loader saturation).
./run_stress.sh --scenario S-01 --bring-up --count 50000

# Higher-parallelism DIAMETER storm.
./run_stress.sh --scenario S-02 --bring-up --threads 32 --count 100000

--bring-up runs kill.sh all followed by run.sh all, waits for ports 10100 + 50051 to listen, then runs the scenario; on every exit path it tears the platform back down. Without --bring-up the runner assumes the platform is already up.

Reports land at $BSS_HOME/var/log/stress/STRESS_REPORT_<scenario>_<datetime>.md (or under --reports-dir), one file per scenario per run.

Scenarios

S-01 — CDR loader saturation

Pre-seeds a 100-MSISDN reserved-prefix subscriber pool, drops N CDRs into var/spool/cdr/new/ round-robin across the pool, and measures how long the loader takes to drain them. Each CDR is a 60-second voice event against the seeded plan id 3 (Free Plan, svc1_price=0.10) so Rater::pre_rate succeeds and the row lands in offline.

Knob Default Production proposal
--count 1 000 50 000

Measured:

  • throughput_files_per_s — rated rows ÷ drain time (excluding pre-load).
  • error_rate_pct — proportion of CDRs landing in var/spool/cdr/error/ or duplicate/.
  • slow_queries_delta — Slow_queries global counter change during the run.

S-02 — DIAMETER parallel CCR storm

Pre-seeds a 100-MSISDN reserved-prefix subscriber pool with 10 000 EUR balances each (so credit-limit rejections do not dominate). Fires N CCR-Initial frames across a worker pool and records per-CCR latency on the sender side. Uses the harness's raw RFC 6733 encoder via lib.diameter_client.send_raw so per-event timing is accurate; the platform's bin/diameter_client --mode parallel is available for operator-driven smoke checks but writes its results to a log file that is not as easy to consume.

Knob Default Production proposal
--count 1 000 100 000
--threads 8 32

Measured:

  • throughput_ccr_per_s, latency_p50/p95/p99/max_ms.
  • Per-result-code counts (result_code_2001, 4012, 4010), transport_errors.

S-03 — Bulk rating pass

Pre-seeds 100 subscribers, inserts N un-rated rows into online, then inserts an activity row with type = PREPAID_RATING (3) and status = 0. The prepaid_mass_rating poller (5 s interval) picks it up and drains the queue in 200-row batches. The scenario waits for activity status to flip to COMPLETED (1) AND for every row's status_id to be EVENT_STATUS_RATED (2).

Knob Default Production proposal
--count 5 000 500 000

Measured: throughput_rows_per_s, activity_terminal_status, slow_queries_delta.

S-04 — Bill-cycle scale-out

Pre-seeds N postpaid subscribers, each with four EVENT_STATUS_RATED offline CDRs in the target billing period (April 2026 by default). Parallel-calls CRMService.ExecuteBilling(subscriber_id, month, year) across --threads workers and waits for every bill to reach a terminal status (PAID|UNPAID|ERROR) AND a non-placeholder PDF URL.

The scenario deliberately keeps the per-subscriber RPC fan-out — it measures gRPC parallelism, not bulk-RPC throughput. The cycle-wide RPC (CRMService.ExecuteBillCycle, regression-tested by F3-07) is the right shape for "bill everyone on cycle X in one call"; S-04 is the right shape for "the platform can absorb N parallel billing requests".

Knob Default Production proposal
--count 10 1 000
--threads 8 8

Measured: total_wallclock_s, bills_reached_terminal, bills_with_pdf, throughput_bills_per_s, watchdog_evictions (currently a 0 placeholder), peak_rss_bill_formatter_mb (capped at 600 MB after the bill-formatter RSS empirical bound — see Thresholds below).

Thresholds

Per-scenario pass/fail thresholds live in stress/thresholds.toml (under the suite directory). Each metric block carries a value and a direction ("min" for ≥-pass, "max" for ≤-pass). Metrics without a threshold are informational only — captured in the report but not voted on.

For a slower CI host:

./run_stress.sh --scenario S-02 --bring-up \
    --thresholds /etc/ci_stress_thresholds.toml

The committed defaults are tuned for the reference dev box at the production-scale knob values. At smoke-scale (the defaults above divided by 10–50×), the throughput thresholds are unreachable because the loader / mass-rating polling intervals dominate the wall clock — that is a property of stress testing, not a bug. The smoke-scale defaults are committed so the runner is self-contained; production verdicts require the production-scale --count.

Report shape

Every run writes a markdown report under $BSS_HOME/var/log/stress/STRESS_REPORT_<scenario>_<datetime>.md:

  • Summary — date, build SHA, host, duration, top-level verdict.
  • Measurements — table of metric / threshold / measured value. Cells carry a ✅ / ❌ when a threshold applies.
  • Notes — free-form bullets the scenario appended at runtime (e.g. partial-teardown warnings).

Operational guardrails

  • Use the reserved MSISDN prefix 40799. Every Stage 6 scenario scopes its writes inside this prefix so the session-end cleanup is safe. Custom scenarios must keep the convention.
  • Cold-start between runs. The bill_formatter warms a process-wide template / plutobook cache on the first PDFs it renders; without a restart the second run inherits that warmed RSS (hence the 600 MB threshold). --bring-up is the right shape for any run whose verdict you intend to publish.
  • Watch MySQL. Connections held by the role pool ([db].poolsize in each TOML, default 15) ✕ 11 roles ≈ 165 connections at peak. Push MySQL's max_connections above that for production-scale runs.
  • License. Each role validates the license at startup and gates per-module features via the 32-bit feature mask (see Licensing). A stress run that fails immediately is most often a license issue.

See also

  • Regression — cadence / triage workflow that the stress runner inherits.
  • Scripts — reference for run.sh / kill.sh and the bin/cdr_generator + bin/diameter_client tools the scenarios drive.