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

Merged
merged 15 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

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