Skip to content
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

OpenHIM Platform performance testing #321

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
22 changes: 22 additions & 0 deletions documentation/packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,25 @@ description: >-
# 📦 Packages

Package can be stood up individually using the `instant package init -n <package_name>` command, or they can be included in your own recipes. This can be accomplished by [creating a profile](https://app.gitbook.com/s/TwrbQZir3ZdvejunAFia/getting-started/config#launching-a-profile) that includes the necessary packages and any custom configuration packages.

## Performance Testing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might better fit under guides rather.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition I'd like you to include the results of a run to give an indication of the current capabilities of platform. This should include the system tested on and the results achieved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a guides section? Also should we provide only sample results for a specific performance test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need both. A guide on how to reproduce and the an example run using specific hardware to give people an idea of the current performance. So both.

The guides section is here: https://github.com/jembi/platform/tree/main/documentation/guides

Login to the gitbook app to get a better idea of how the docs are structured.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made re-arrangements and added the test results in the guide. @rcrichton


The performance scripts are located in the [test](https://github.com/jembi/platform/tree/main/test) folder. To run this script against a local or remote server, you can follow these steps:

1. Make sure you have the necessary dependencies installed.More importantly the `k6` binary.
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

2. Set the [`BASE_URL`] variable to the URL of your server. By default, it is set to `"http://localhost:5001"`, but you can change it to the appropriate URL.

3. If there are any additional dependencies or configurations required by the [`generateBundle`] function or any other imported modules, make sure those are set up correctly.

4. Open your terminal or command prompt and navigate to the directory where the scripts are located e.g [`load.js`]("/media/platform/test/performance/scripts/load.js")
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

5. Run the script using the `k6 run` command followed by the filename. In this case, you would run [`k6 run load.js`]

6. The script will start executing and sending HTTP POST requests to the specified server. The requests will be sent at a constant arrival rate defined in the [`options`] object

7. The script includes some thresholds defined in the [`options`] object. These thresholds define the performance criteria for the script. If any of the thresholds are exceeded, the script will report a failure.

8. Monitor the output in the terminal to see the results of the script execution. It will display information such as the number of virtual users (VUs), request statistics, and any failures that occurred.

9. To visualize the output in grafana run the `k6` scripts with the following environment variables and flag set `K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write && ./k6 run -o experimental-prometheus-rw script.js`
14 changes: 13 additions & 1 deletion monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ services:
source: logging-universal-dashboard_rev1.json
- target: /etc/grafana/provisioning/dashboards/security/auditlogs.json
source: auditlogs.json
- target: /etc/grafana/provisioning/dashboards/performance/k6.json
source: k6.json
networks:
keycloak:
reverse-proxy:
traefik:
default:


prometheus:
image: prom/prometheus:v2.38.0
user: root
Expand All @@ -88,10 +91,12 @@ services:
- "--web.console.templates=/etc/prometheus/consoles"
- "--web.enable-lifecycle"
- "--storage.tsdb.retention.time=${MO_RETENTION_TIME}"
- "--web.enable-remote-write-receiver"
networks:
public:
default:


cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.45.0
command: -docker_only
Expand Down Expand Up @@ -152,7 +157,7 @@ services:
MINIO_BROWSER_REDIRECT_URL: ${MINIO_BROWSER_REDIRECT_URL}
MINIO_SERVER_URL: http://localhost:9000
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
interval: 30s
timeout: 20s
retries: 3
Expand All @@ -174,6 +179,7 @@ services:
traefik:
default:


configs:
grafana.ini:
file: ./grafana/grafana.ini
Expand Down Expand Up @@ -235,6 +241,11 @@ configs:
name: auditlogs.json-${auditlogs_json_DIGEST:?err}
labels:
name: grafana
k6.json:
file: ./grafana/dashboards/performance/k6.json
name: k6.json-${k6_json_DIGEST:?err}
labels:
name: grafana
prometheus.yml:
file: ./prometheus/prometheus.yml
name: prometheus.yml-${prometheus_yml_DIGEST:?err}
Expand All @@ -258,6 +269,7 @@ volumes:
minio-01-data1:
minio-01-data2:


networks:
keycloak:
name: keycloak_public
Expand Down
Loading
Loading