-
Notifications
You must be signed in to change notification settings - Fork 395
test: allow profiling performance tests DHIS2-20175 #22080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # DHIS2 Performance Tests | ||
|
|
||
| Run Gatling performance tests against DHIS2 Docker instances locally and in CI. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```sh | ||
| DHIS2_IMAGE=dhis2/core-dev:latest \ | ||
| SIMULATION_CLASS=org.hisp.dhis.test.tracker.TrackerTest \ | ||
| ./run-simulation.sh | ||
| ``` | ||
|
|
||
| Run `./run-simulation.sh` for full usage including profiling and database options. | ||
|
|
||
| ## Results | ||
|
|
||
| Test results are saved to `target/gatling/<simulation-class>-<timestamp>/`: | ||
|
|
||
| * `index.html` - Gatling HTML report | ||
| * `simulation.log` - Binary response times | ||
| * `simulation.csv` - Response times (automated in CI only, [see below](#simulationcsv)) | ||
| * `simulation-run.txt` - Run metadata | ||
| * `profile.html` - Flamegraph (when profiling enabled) | ||
| * `profile.jfr` - JFR (Java flight recorder) profiling data (when profiling enabled) | ||
|
|
||
| ### simulation.csv | ||
|
|
||
| If `index.html` doesn't provide the analysis you need, convert `simulation.log` to `simulation.csv` | ||
| for advanced analysis with [gatling-statistics](https://github.com/dhis2/gatling-statistics). | ||
|
|
||
| Since Gatling 3.12, test results are written in binary format. Use | ||
| [glog](https://github.com/dhis2/gatling/releases) (a CLI from our Gatling fork) to convert: | ||
|
|
||
| ```sh | ||
| glog --config ./src/test/resources/gatling.conf --scan-subdirs target/gatling | ||
| ``` | ||
|
|
||
| ## CI Usage | ||
|
|
||
| `./run-simulation.sh` is used in | ||
| [`../../.github/workflows/run-performance-tests.yml`](../../.github/workflows/run-performance-tests.yml) | ||
| to compare performance between baseline and candidate DHIS2 versions. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| services: | ||
| web: | ||
| # Required for async-profiler to access perf_events | ||
| # See: https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilingInContainer.md | ||
| cap_add: | ||
| - SYS_ADMIN # Access to performance counters | ||
| security_opt: | ||
| - seccomp:unconfined # Allow profiling syscalls | ||
| environment: | ||
| JAVA_OPTS: | ||
| "-Dlog4j2.configurationFile=/opt/dhis2/log4j2.xml \ | ||
| -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8081 \ | ||
| -XX:+UnlockDiagnosticVMOptions \ | ||
| -XX:+DebugNonSafepoints" # Accurate profiling at all code locations | ||
| volumes: | ||
| - async-profiler:/usr/local | ||
| - async-profiler-output:/profiler-output | ||
| ports: | ||
| - "127.0.0.1:8081:8081" # Debugger: connect using commandline flag -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8081 | ||
| depends_on: | ||
| async-profiler-setup: | ||
| condition: service_completed_successfully | ||
|
|
||
| async-profiler-setup: | ||
| image: busybox | ||
| command: | | ||
| sh -c ' | ||
| if [ ! -f /usr/local/bin/asprof ]; then | ||
| echo "Downloading async-profiler..." | ||
| wget -O /tmp/async-profiler.tar.gz https://github.com/async-profiler/async-profiler/releases/download/v4.0/async-profiler-4.0-linux-x64.tar.gz && | ||
| mkdir -p /usr/local/bin /usr/local/lib && | ||
| tar -xzf /tmp/async-profiler.tar.gz -C /tmp && | ||
| cp /tmp/async-profiler-4.0-linux-x64/bin/* /usr/local/bin/ && | ||
| cp /tmp/async-profiler-4.0-linux-x64/lib/* /usr/local/lib/ && | ||
| chmod +x /usr/local/bin/asprof && | ||
| chmod +x /usr/local/bin/jfrconv && | ||
| echo "async-profiler installed to /usr/local" | ||
| else | ||
| echo "async-profiler already installed" | ||
| fi && | ||
| chmod 777 /profiler-output | ||
| ' | ||
| volumes: | ||
| - async-profiler:/usr/local | ||
| - async-profiler-output:/profiler-output | ||
|
|
||
| volumes: | ||
| async-profiler: {} | ||
| async-profiler-output: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.