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
69 changes: 69 additions & 0 deletions documentation/guides/performance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Performance Testing

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.

## Steps

1. Make sure you have the necessary dependencies installed, more importantly, the `k6` binary. Refer to this documentation [`Building a k6 binary`]("https://github.com/jembi/platform/blob/86bzwerm7/test/performance/README.md")

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`
drizzentic marked this conversation as resolved.
Show resolved Hide resolved

## Sample load test result

The test results were obtained from running on Ubuntu 22.04 OS, 64GB RAM and 12 Cores.
✓ status code is 200
| Metric | Value |
|--------------------------------|-------------|
| checks | 100.00% ✓ 188 ✗ 0 |
| data_received | 2.3 MB 39 kB/s |
| data_sent | 3.9 MB 65 kB/s |
| dropped_iterations | 1613 26.656141/s |
| http_req_blocked | avg=8.32µs min=3.54µs med=5.21µs max=259.88µs p(90)=6.87µs p(95)=8.18µs |
| http_req_connecting | avg=1.61µs min=0s med=0s max=153.25µs p(90)=0s p(95)=0s |
| http_req_duration | avg=619.01ms min=421.78ms med=621.54ms max=812.9ms p(90)=692.07ms p(95)=711.18ms |
| http_req_failed | 0.00% ✓ 0 ✗ 188 |
| http_req_receiving | avg=115.87µs min=60.86µs med=110.01µs max=508.35µs p(90)=152.09µs p(95)=158.61µs |
| http_req_sending | avg=125.31µs min=63.72µs med=114.43µs max=825.81µs p(90)=150.33µs p(95)=191.61µs |
| http_req_tls_handshaking | avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| http_req_waiting | avg=618.77ms min=421.58ms med=621.32ms max=812.7ms p(90)=691.81ms p(95)=710.93ms |
| http_reqs | 188 3.106853/s |
| iteration_duration | avg=625.32ms min=427.15ms med=628.41ms max=818.77ms p(90)=698.25ms p(95)=717.76ms |
| iterations | 188 3.106853/s |
| vus | 2 min=1 max=2 |
| vus_max | 2 min=2 max=2 |

## Sample volume test results

| Metric | Value |
| ------------------------ | ------------------------------------------------------------------------------- |
| checks | 100.00% ✓ 954 ✗ 0 |
| data_received | 12 MB 40 kB/s |
| data_sent | 20 MB 66 kB/s |
| dropped_iterations | 23345 77.340364/s |
| http_req_blocked | avg=7.44µs min=2.89µs med=5.34µs max=235.67µs p(90)=7.39µs p(95)=8.49µs |
| http_req_connecting | avg=1.14µs min=0s med=0s max=180.71µs p(90)=0s p(95)=0s |
| http_req_duration | avg=2.49s min=478.77ms med=2.5s max=3.22s p(90)=2.7s p(95)=2.79s |
| http_req_failed | 0.00% ✓ 0 ✗ 954 |
| http_req_receiving | avg=105.4µs min=51.79µs med=103.68µs max=473.23µs p(90)=129.93µs p(95)=140.63µs |
| http_req_sending | avg=130.4µs min=60.02µs med=110.82µs max=2.72ms p(90)=152.04µs p(95)=225.79µs |
| http_req_tls_handshaking | avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s |
| http_req_waiting | avg=2.49s min=478.52ms med=2.5s max=3.22s p(90)=2.7s p(95)=2.79s |
| http_reqs | 954 3.160536/s |
| iteration_duration | avg=2.5s min=483.16ms med=2.5s max=3.23s p(90)=2.7s p(95)=2.79s |
| iterations | 954 3.160536/s |
| vus | 4 min=4 max=8 |
| vus_max | 8 min=7 max=8 |
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