Skip to content

test: allow profiling performance tests DHIS2-20175#22080

Merged
teleivo merged 4 commits into
masterfrom
DHIS2-20175
Oct 1, 2025
Merged

test: allow profiling performance tests DHIS2-20175#22080
teleivo merged 4 commits into
masterfrom
DHIS2-20175

Conversation

@teleivo
Copy link
Copy Markdown
Contributor

@teleivo teleivo commented Sep 26, 2025

run-simulation.sh is used in our performance test comparison workflow added in #22026. The script can also be used locally to run the tests in the exact same way if we want to investigate any results in more detail. One method to get more insights is profiling which this PR adds. We could in theory profile on the GH runner. For now I suggest we only profile locally as the profiling artifact can be large depending on what you profile.

Pass PROF_ARGS to run-simulation.sh with any of https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md and it will start/stop the profiler before/after the simulation run. The profiler results will be next to the Gatling results as flamegraph and in JFR (Java Flight Recorder) format. JFR is very flexible and allows us to keep the run-simulation.sh logic small. Users can then use https://github.com/async-profiler/async-profiler/blob/master/docs/ConverterUsage.md to convert it to whatever they need.

Test

Checkout PR and run this locally if you like

PROF_ARGS="-e cpu" \
DHIS2_IMAGE=dhis2/core-dev:master \
DHIS2_DB_DUMP_URL=https://databases.dhis2.org/sierra-leone/2.42.1/dhis2-db-sierra-leone.sql.gz \
DHIS2_DB_IMAGE_SUFFIX=sierra-leone-2.42.1 \
SIMULATION_CLASS=org.hisp.dhis.test.tracker.EnrollmentsTest \
./run-simulation.sh

Misc

  • added usage to run-simulation.sh
./run-simulation.sh
Error: DHIS2_IMAGE environment variable is required

USAGE:
  DHIS2_IMAGE=<tag> SIMULATION_CLASS=<class> [OPTIONS] ./run-simulation.sh

REQUIRED:
  DHIS2_IMAGE           Docker image tag for DHIS2
                        Available tags: https://github.com/dhis2/dhis2-core/blob/master/docker/DOCKERHUB.md
  SIMULATION_CLASS      Fully qualified Gatling Simulation class name

OPTIONS:
  DHIS2_DB_DUMP_URL     Database dump URL
                        Available database dumps: https://databases.dhis2.org
                        Default: https://databases.dhis2.org/sierra-leone/dev/dhis2-db-sierra-leone.sql.gz
  DHIS2_DB_IMAGE_SUFFIX Docker image suffix for DB (default: sierra-leone-dev)
                        WARNING: Must match the version in DHIS2_DB_DUMP_URL
  PROF_ARGS             Async-profiler arguments (enables profiling)
                        Options: https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md
  MVN_ARGS              Additional Maven arguments passed to mvn gatling:test
  HEALTHCHECK_TIMEOUT   Max wait time for DHIS2 startup in seconds (default: 300)
  HEALTHCHECK_INTERVAL  Check interval for DHIS2 startup in seconds (default: 10)

EXAMPLES:
  # Basic test run
  DHIS2_IMAGE=dhis2/core-dev:latest \
  SIMULATION_CLASS=org.hisp.dhis.test.tracker.TrackerTest ./run-simulation.sh

  # With CPU profiling
  PROF_ARGS="-e cpu" \
  DHIS2_IMAGE=dhis2/core-dev:latest \
  SIMULATION_CLASS=org.hisp.dhis.test.tracker.TrackerTest ./run-simulation.sh

Next

Enrico will add his performance test using a scenario derived from Capture app usage.

@teleivo teleivo force-pushed the DHIS2-20175 branch 2 times, most recently from 16e8461 to 3a64255 Compare September 29, 2025 14:24
@teleivo teleivo changed the title test(wip): profile performance tests test: allow profiling performance tests DHIS2-20175 Sep 29, 2025
@teleivo teleivo marked this pull request as ready for review September 29, 2025 14:51
@teleivo teleivo requested a review from a team as a code owner September 30, 2025 07:36
Comment thread .github/workflows/run-performance-tests.yml
@teleivo teleivo enabled auto-merge (squash) September 30, 2025 11:40
@teleivo teleivo disabled auto-merge September 30, 2025 13:54
@ameenhere
Copy link
Copy Markdown
Contributor

ameenhere commented Sep 30, 2025

Just flagging this one
I had to add
platform: linux/amd64
in docker-compose.yml for the db service for the docker compose to be successful and run simulation to work (except that the test classes are yet to be added).
I have an arm64 Mac m3 and postgis tags are only built for linux/amd64.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 1, 2025

@teleivo teleivo merged commit 00a00aa into master Oct 1, 2025
16 checks passed
@teleivo teleivo deleted the DHIS2-20175 branch October 1, 2025 04:11
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.

3 participants