Skip to content

test: Add focused performance test for GET /api/dataEntry/metadata#24384

Draft
jason-p-pickering wants to merge 7 commits into
masterfrom
perf/dataentry-metadata-test
Draft

test: Add focused performance test for GET /api/dataEntry/metadata#24384
jason-p-pickering wants to merge 7 commits into
masterfrom
perf/dataentry-metadata-test

Conversation

@jason-p-pickering

Copy link
Copy Markdown
Contributor

Summary

  • Adds DataEntryMetadataPerformanceTest, a focused Gatling performance test for GET /api/dataEntry/metadata, which takes no parameters and currently has no way to isolate its cost in the existing test suite.
  • The endpoint has no server-side result cache — every request without a matching If-None-Match header rebuilds the full data-entry metadata payload (data sets, data elements, indicators, category combos/categories/options, option sets), so every iteration in the test measures a genuine cold fetch.
  • Documents the new test in dhis-test-performance/README.md.
  • Includes the design spec written during brainstorming (docs/superpowers/specs/2026-07-07-dataentry-metadata-perf-test-design.md).

Baseline measurement (fix/hibernate-fetch-size vs master)

This test was used to compare fix/hibernate-fetch-size against master on a local Sierra Leone demo DB (5 requests each, single run, local Docker images built from source):

Metric fix/hibernate-fetch-size master
mean 480ms 530ms
p50 416ms 472ms
p95 / max 771ms 926ms
success 5/5 5/5

fix/hibernate-fetch-size is faster on every percentile here — no regression, and directionally consistent with the fetch-size fix helping this endpoint's collection-heavy payload assembly. Assertion thresholds (p95 < 1200ms, max < 1500ms) are set above the slower (master) run with headroom for variance at this sample size.

Test plan

  • mvn spotless:check passes
  • mvn test-compile passes
  • Ran the simulation against a local Sierra Leone demo DB instance built from fix/hibernate-fetch-size — 5/5 successful, assertions pass
  • Ran the simulation against a local Sierra Leone demo DB instance built from master — 5/5 successful, assertions pass

🤖 Generated with Claude Code

jason-p-pickering and others added 7 commits July 7, 2026 10:11
Covers the new focused Gatling test for GET /api/dataEntry/metadata
and the local build-and-compare workflow for fix/hibernate-fetch-size
vs master on the Sierra Leone demo DB.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cold-fetch baseline for the data-entry metadata payload endpoint,
to be used for comparing fix/hibernate-fetch-size against master.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…EADME

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Calibrated against a Sierra Leone demo DB run on both branches
(5 requests each, single run):

  fix/hibernate-fetch-size: p95/max 771ms, mean 480ms, 5/5 successful
  master:                   p95/max 926ms, mean 530ms, 5/5 successful

hibernate-fetch-size is faster on every percentile here, consistent
with the fetch-size fix helping this endpoint's collection-heavy
payload assembly. Thresholds set at p95<1200ms/max<1500ms, above the
slower (master) run with headroom for variance at this sample size.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Basic Auth re-authenticates on every request, mixing DHIS2's login
cost into what should be a pure measurement of the metadata endpoint
itself. Switch to logging in once per virtual user (matching a real
logged-in user) and measuring only the subsequent GET requests, under
a separate "Authentication" group excluded from the assertions.

Also parameterize concurrentUsers/rampDurationSeconds (both default
to the previous single-user behavior) and raise the default iteration
count from 5 to 20 for more statistically meaningful percentiles.
Thresholds are placeholders again pending recalibration against this
new flow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
.group(METADATA_REQUEST) wrapped the entire repeat(ITERATIONS) loop
under a group sharing the request's name. With one virtual user,
Gatling only has one sample of that group's cumulative duration
(summed across all iterations), so details(METADATA_REQUEST) picked
up that one bogus ~7.5s sample instead of the per-request p95
distribution across the 20 individual requests (real p95 was 550ms).

The Authentication group (distinct name) is unaffected and still
correctly isolates login timing from the metadata assertions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Calibrated from 3 repeated single-user runs per branch (60 requests
each), combined via gstat, so the numbers reflect a real distribution
rather than a single noisy sample:

  fix/hibernate-fetch-size: p95 500ms, p99 535ms
  master:                   p95 585ms, p99 609ms

Thresholds set above the worse (master) branch with headroom.
Absolute numbers will differ on other hardware (e.g. the performance
CI runner) -- what matters here is the relative comparison this test
is designed to catch a regression against.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@jason-p-pickering jason-p-pickering marked this pull request as draft July 7, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant