181 lines
8.9 KiB
Markdown
181 lines
8.9 KiB
Markdown
# Why the loaded measurement uses 26 threads
|
||
|
||
**Decision, 9 October 2026:** use **26 JMeter threads** for the main loaded energy
|
||
experiment, with **30 minutes of warmup followed by four measured hours**. Collect
|
||
CPU, memory, power and request results at one-second resolution. This is the chosen
|
||
protocol; the four-hour loaded run has not yet been performed.
|
||
|
||
The aim is to produce substantial application load while preserving headroom for
|
||
background activity. The response-time knee informs the choice, but the main
|
||
experiment deliberately operates below its steep-rise region.
|
||
|
||
## Measurements used for the decision
|
||
|
||
Calibration used the same read-only review workflow and one shared patient dataset.
|
||
Each thread repeatedly retrieved profile, latest observation, filtered history,
|
||
insights, trends and overview, with an initial login and renewal if required.
|
||
Account provisioning and synthetic data preparation were separate from measurement.
|
||
This is concurrent use of one shared dataset, not 26 independently provisioned patients.
|
||
|
||
All comparable trials used:
|
||
|
||
- One-minute ramp/warmup followed by ten measured minutes.
|
||
- Gaussian request pauses with a **500 ms minimum**, **1,000 ms expected mean** and
|
||
**1,500 ms maximum**. The parent Gaussian standard deviation is 250 ms; symmetric
|
||
truncation preserves the expected mean and changes the resulting standard deviation.
|
||
- No additional pause between review sessions; this represents sustained active use.
|
||
- The same dataset, application deployment, workflow, seed and one-second monitoring.
|
||
- Sequential runs to prevent workload overlap. Mean response times exclude think time.
|
||
|
||
The initial trials with 100 ms mean pauses are excluded from the comparable curve.
|
||
The incomplete 80-thread trial is also excluded. The latest identical-pacing
|
||
30-thread repeat is used; it closely reproduced the earlier 30-thread result.
|
||
All 19 selected calibration points completed with zero failed requests and valid
|
||
monitoring. This does not establish the same behaviour for different patients,
|
||
data volumes, workflow mixes or deployment arrangements.
|
||
|
||
| Threads | Mean response | Requests/s | Mean CPU | Mean power |
|
||
|---:|---:|---:|---:|---:|
|
||
| 25 | 128 ms | 22.15 | 78.16% | 8.76 W |
|
||
| **26 — selected** | **139 ms** | **22.81** | **80.60%** | **8.90 W** |
|
||
| 27 | 148 ms | 23.52 | 82.96% | 9.04 W |
|
||
| 30 | 183 ms | 25.34 | 89.00% | 9.34 W |
|
||
| 35 | 280 ms | 27.32 | 95.65% | 9.65 W |
|
||
| 40 | 425 ms | 28.05 | 98.25% | 9.75 W |
|
||
| 50 | 785 ms | 27.95 | 98.72% | 9.81 W |
|
||
|
||
Full measured points: [calibration.csv](evidence/26-thread-choice/calibration.csv).
|
||
|
||
## Response-time knee
|
||
|
||

|
||
|
||
The curve steepens as utilisation approaches saturation. From 35 to 40 threads,
|
||
mean response time rises from 280 to 425 ms, while throughput grows only about 2.7%.
|
||
At 50 threads, response time rises further without increased throughput.
|
||
|
||
We adopted **35 threads as a practical knee marker**, based on the response-time
|
||
curve and a mean response time of approximately 280 ms being barely acceptable
|
||
for this experiment. The finer 26–39-thread trials support a gradual bend followed
|
||
by a steep-rise region, rather than a uniquely established abrupt threshold.
|
||
The figures use **mean response time only**. P95 remains in the original results
|
||
but is not mixed into this particular queueing comparison.
|
||
|
||
The simplified queueing model used to interpret the shape is:
|
||
|
||
\[
|
||
R = W + S,\qquad W = \frac{SU}{1-U},\qquad R = \frac{S}{1-U}.
|
||
\]
|
||
|
||
Here, `R` is mean response time, `W` waiting time, `S` service time and `U`
|
||
utilisation expressed as a fraction. Near saturation, a small increase in `U`
|
||
produces a disproportionately large increase in `R`.
|
||
|
||
This model motivates preserving headroom. The plots show **measured points**,
|
||
not a fitted theoretical curve: service time was not measured separately, and
|
||
whole-machine CPU utilisation is being used as a practical utilisation proxy.
|
||
The model does not prove a precise knee or distinguish the application's individual
|
||
queues and resources.
|
||
|
||
## Background activity and the headroom rule
|
||
|
||

|
||
|
||
The four-hour idle baseline made **zero application requests**, with services and
|
||
monitoring running. It recorded 14,395 CPU samples at nominal one-second intervals:
|
||
mean utilisation **0.505%**, maximum **11.055%**, seven samples at least 5% and one
|
||
sample at least 10%. These include monitoring overhead and other background work;
|
||
we did not collect process-level attribution.
|
||
|
||
Loaded trials had application requests in every measured second. Consequently,
|
||
those traces cannot isolate request-free background spikes or establish which
|
||
process caused a particular loaded-run peak.
|
||
|
||
The agreed conservative planning rule reserves the observed idle maximum as
|
||
**11.055 percentage points** against a chosen **95% CPU reference**:
|
||
|
||
\[
|
||
U_{\text{planning ceiling}} = 95\% - 11.055\text{ percentage points}
|
||
= 83.945\%.
|
||
\]
|
||
|
||

|
||
|
||
At 26 threads, average CPU is **80.603%**, leaving approximately **14.397 percentage
|
||
points** below the 95% reference: about **3.342 points beyond the reserved budget**.
|
||
At 27 threads, the average still meets the planning ceiling, but leaves only about
|
||
0.983 points beyond that budget. At 28 threads, average CPU is already above it.
|
||
|
||
We therefore chose **26 rather than 27 threads** for additional margin, and 26
|
||
rather than 25 to retain slightly more application load. It is also close to the
|
||
original approximately 80% utilisation objective. The measured mean response time
|
||
was 139 ms with zero failed requests.
|
||
|
||
The idle maximum is **not** a proven incremental disturbance that can simply be
|
||
added to loaded CPU, and it is not a guaranteed future maximum. Reserving its full
|
||
observed value is a planning assumption. The 95% reference is likewise our operating
|
||
criterion, not a demonstrated universal performance boundary.
|
||
|
||
## What the choice does not guarantee
|
||
|
||

|
||
|
||
An average below the planning ceiling does not keep every second below it. The
|
||
26-thread trial reached **98.994% CPU**, with **25 of 600 samples at least 95%**
|
||
(4.17%) and seven at least 98% (1.17%). Those transient peaks caused no recorded
|
||
request errors in this ten-minute trial, but they show that saturation remains
|
||
possible. The choice reduces exposure; it does not guarantee its elimination.
|
||
|
||
Calibration contains one trial at most thread counts and only one matching repeat
|
||
at 30. Run order was generally ascending and was not randomised; thermal/background
|
||
drift and measurement variation have not been fully separated. Four-hour stability
|
||
must be assessed in the actual long run, and repeat measurements are needed to
|
||
quantify variability. CPU measurements are PerfMon/SIGAR readings and have not been
|
||
independently validated against Linux counters.
|
||
|
||
## Main loaded measurement protocol
|
||
|
||
Use the **same shared-data read-only review scenario**, with:
|
||
|
||
| Setting | Value |
|
||
|---|---|
|
||
| Concurrent threads | **26** |
|
||
| Ramp | 60 seconds, inside warmup |
|
||
| Warmup excluded from analysis | **1,800 seconds** |
|
||
| Measured duration | **14,400 seconds** |
|
||
| Request pauses | Gaussian, 500–1,500 ms, expected mean 1,000 ms |
|
||
| Between-session pause | None |
|
||
| CPU and Shelly polling | **1,000 ms** |
|
||
| Error handling | Record failures; begin the next read-only session |
|
||
|
||
Keep application configuration, dataset, monitoring, power settings and other
|
||
activity consistent across comparisons. Preserve raw measurements. Inspect
|
||
per-second CPU/latency/error traces rather than relying only on run averages.
|
||
The Shelly measures the connected equipment, including adapter losses; power-meter
|
||
accuracy has not been independently calibrated. Treat its cumulative counter delta
|
||
as a separate cross-check to integration of sampled watts.
|
||
|
||
See the [execution guide](README.md) for run commands and reporting. The experiment
|
||
runs from the development computer, using application and monitoring APIs, without
|
||
SSH or administrative changes to the NUC.
|
||
|
||
## Evidence and reproducibility
|
||
|
||
The evidence accompanying this document contains no passwords or tokens:
|
||
|
||
- [Calibration points](evidence/26-thread-choice/calibration.csv).
|
||
- [Idle CPU trace](evidence/26-thread-choice/idle-cpu.csv).
|
||
- [Selected workload CPU trace](evidence/26-thread-choice/selected-cpu.csv).
|
||
- [Calculated evidence summary and source run names](evidence/26-thread-choice/evidence-summary.json).
|
||
- PNG figures above and same-stem SVG files for export.
|
||
|
||
The original complete results remain under `tools/energy-jmeter/results/`, which
|
||
is Git-ignored. Regenerate this evidence from those files with:
|
||
|
||
```bash
|
||
python3 tools/energy-jmeter/document-choice.py
|
||
```
|
||
|
||
No architecture, service behaviour or authoritative requirements were changed by
|
||
this experiment decision.
|