Files
HealthAppRepositoryB/tools/energy-jmeter/ARCHITECTURE-B.md
T

75 lines
4.6 KiB
Markdown

# Architecture B adaptation
Copied tracked JMeter tooling and PasswordHash source from read-only Architecture A
revision `2117236366130775214d9fd2611984d4348f2b79`. Original file SHA-256 hashes
are preserved in source-manifest.json. Private credentials, generated hash binaries,
raw experiment runs and installed JMeter/Java/plugins were not copied. Historical
26-thread calibration evidence is retained and labelled as Architecture A evidence.
## Compatibility findings and changes
All six generated JMX plans remain byte-for-byte identical to the source. The public
HTTPS routes, DTO fields, opaque bearer-ticket login/renewal, patient ownership and
professional assignment interfaces are preserved by B. There is no need to replace
scenario requests or add internal service calls. Workload mix, Gaussian pacing,
random seed, ramp, 30-minute warmup and four-hour measurement defaults are retained.
No automatic retries or acceptance of 503/504 as success were added. B's admission
limits may make a workload fail; those failures must remain visible.
Account provisioning did require adaptation: create-accounts.py now generates a
private COPY of B appsettings.json instead of A gateway.env. It supports both the
native installer's colon-delimited keys and nested example JSON, retains existing
settings/accounts, refuses regeneration and writes mode-600 files in a private new
directory. Mixed flat/nested account definitions are rejected. PasswordHash is built
from source. Installation/restart remains an explicit test-host administration step;
use root:healthapp-b mode 640 for installed config. The runner records architecture B.
Python 3.13+ enables additional strict X.509 profile checks. The B-generated prototype
certificate lacks Authority Key Identifier, so the unchanged Python preflight failed
on Python 3.14. tls.application_context removes only VERIFY_X509_STRICT, preserving
CERT_REQUIRED, trusted-CA chain/signature/expiry verification and hostname checks.
There is no trust-all fallback. This matches standard verification used by older
Python versions. JMeter's inherited HTTPS client behavior is unchanged: encrypted
traffic, but its stock client does not establish certificate-validation correctness.
Use the Python preflight; this workload is not a TLS security test.
## Running
Follow README.md to build the hash helper, prepare accounts/history outside the
measurement window and run the selected scenario against B's host/port (default
5443). The native unit is healthapp-b.service, configuration is under /etc/healthapp-b,
and public client CA is healthapp-ca.crt. Never export installed configuration to the
load generator; it contains database/private-key secrets. No A database is accessed.
Install JMeter 5.6.3, compatible Java (the existing launcher uses Java 17), jpgc-perfmon
2.1 and Matplotlib on the load generator. The default launcher path is
~/.local/bin/jmeter, override with --jmeter. These dependencies are not bundled.
For isolated checks use --no-perfmon --no-shelly; real experiments need separately
verified agents/meter settings. Original monitoring host defaults are configurable
and must be checked for the B test environment.
## Verification
- generate-plans.py regenerated six plans identically to their source hashes.
- verify-plans.py passed HTTPS contract-stub checks: preparation, recording/review/
correction/mixed/professional, dynamic IDs, short-lived token renewal, unexpected
503 invalidation, and synthetic four-hour power integration.
- verify-idle.py passed: no application requests, no login/preflight, warmup excluded.
- verify-tls.py passed: trusted CA accepted, wrong hostname and untrusted CA rejected.
- verify-report.py passed: one-second timing, aggregation and missing-data handling.
- verify-b.py is a reproducible short smoke against the actual published B host,
verified HTTPS and a disposable PostgreSQL 18.6 database with restricted runtime
credentials. All six scenarios passed with zero failed HTTP requests (idle sent zero HTTP requests). See [verification-b.json](verification-b.json) for counts and the tested application DLL hash.
Reproduce real-host smoke after building a new B release and hash helper:
```bash
python3 tools/energy-jmeter/verify-b.py --release /absolute/path/to/release --dotnet /absolute/path/to/dotnet
```
This optional check requires Docker access and the PostgreSQL image; Docker is test
infrastructure, not an application deployment requirement. It uses synthetic data,
local ephemeral ports and a unique disposable container, then cleans up. PerfMon and
Shelly are disabled. No full-duration capacity run, physical testserver load, live
monitoring validation or energy comparison is established by these smoke tests.