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 all 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
133 changes: 67 additions & 66 deletions documentation/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
# Table of contents

* [OpenHIM Platform](README.md)
* [Getting Started](<README (1).md>)
* [📜 Recipes](recipes/README.md)
* [Central Data Repository with Data Warehousing](recipes/central-data-repository-with-data-warehousing.md)
* [Central Data repository (no reporting)](recipes/central-data-repository-no-reporting.md)
* [Master Patient Index](recipes/master-patient-index.md)
* [📦 Packages](packages/README.md)
* [Interoperability Layer Openhim](packages/interoperability-layer-openhim/README.md)
* [Local Development](packages/interoperability-layer-openhim/local-development.md)
* [Environment Variables](packages/interoperability-layer-openhim/environment-variables.md)
* [Monitoring](packages/monitoring/README.md)
* [Environment Variables](packages/monitoring/environment-variables.md)
* [Kafka Mapper Consumer](packages/kafka-mapper-consumer/README.md)
* [Local Development](packages/kafka-mapper-consumer/local-development.md)
* [Environment Variables](packages/kafka-mapper-consumer/environment-variables.md)
* [Data Mapper Logstash](packages/data-mapper-logstash/README.md)
* [Local Development](packages/data-mapper-logstash/local-development.md)
* [Environment Variables](packages/data-mapper-logstash/environment-variables.md)
* [Job Scheduler Ofelia](packages/job-scheduler-ofelia/README.md)
* [Local Development](packages/job-scheduler-ofelia/local-development.md)
* [Environment Variables](packages/job-scheduler-ofelia/environment-variables.md)
* [Analytics Datastore - Clickhouse](packages/analytics-datastore-clickhouse/README.md)
* [Local Development](packages/analytics-datastore-clickhouse/local-development.md)
* [Environment Variables](packages/analytics-datastore-clickhouse/environment-variables.md)
* [Analytics Datastore - Elasticsearch](packages/analytics-datastore-elasticsearch/README.md)
* [Local Development](packages/analytics-datastore-elasticsearch/local-development.md)
* [Running in Clustered Mode](packages/analytics-datastore-elasticsearch/running-in-clustered-mode.md)
* [Environment Variables](packages/analytics-datastore-elasticsearch/environment-variables.md)
* [Client Registry - SanteMPI](packages/client-registry-santempi/README.md)
* [Environment Variables](packages/client-registry-santempi/environment-variables.md)
* [Dashboard Visualiser - Jsreport](../docs/packages/dashboard-visualiser-js-report/README.md)
* [Local Development](../docs/packages/dashboard-visualiser-js-report/local-development.md)
* [Environment Variables](../docs/packages/dashboard-visualiser-js-report/environment-variables.md)
* [Dashboard Visualiser - Kibana](../docs/packages/dashboard-visualiser-kibana/README.md)
* [Local Development](../docs/packages/dashboard-visualiser-kibana/local-development.md)
* [Environment Variables](../docs/packages/dashboard-visualiser-kibana/environment-variables.md)
* [Dashboard Visualiser - Superset](packages/dashboard-visualiser-superset/README.md)
* [Local Development](packages/dashboard-visualiser-superset/local-development.md)
* [Environment Variables](packages/dashboard-visualiser-superset/environment-variables.md)
* [Message Bus - Kafka](packages/message-bus-kafka/README.md)
* [Local Development](packages/message-bus-kafka/local-development.md)
* [Environment Variables](packages/message-bus-kafka/environment-variables.md)
* [FHIR Datastore HAPI FHIR](packages/fhir-datastore-hapi-fhir/README.md)
* [Local Development](packages/fhir-datastore-hapi-fhir/local-development.md)
* [Environment Variables](packages/fhir-datastore-hapi-fhir/environment-variables.md)
* [Kafka Unbundler Consumer](packages/kafka-unbundler-consumer/README.md)
* [Environment Variables](packages/kafka-unbundler-consumer/environment-variables.md)
* [Message Bus Helper Hapi Proxy](packages/message-bus-helper-hapi-proxy/README.md)
* [Environment Variables](packages/message-bus-helper-hapi-proxy/environment-variables.md)
* [Reverse Proxy Nginx](packages/reverse-proxy-nginx/README.md)
* [Local Development](packages/reverse-proxy-nginx/local-development.md)
* [Environment Variables](packages/reverse-proxy-nginx/environment-variables.md)
* [🗒️ Cheat sheet](cheat-sheet.md)
* [Architecture](architecture.md)
* [Guides](guides/README.md)
* [Provisioning remote servers](guides/provisioning-up-remote-servers/README.md)
* [Ansible](guides/provisioning-up-remote-servers/ansible.md)
* [Terraform](guides/provisioning-up-remote-servers/terraform.md)
* [Resource Allocations](guides/resource-allocations.md)
* [Disaster Recovery Process](guides/disaster-recovery-process/README.md)
* [Elasticsearch](guides/disaster-recovery-process/elasticsearch.md)
* [HAPI FHIR Data](guides/disaster-recovery-process/hapi-fhir-data.md)
* [OpenHIM Data](guides/disaster-recovery-process/openhim-data.md)
* [Development](guides/development/README.md)
* [Config Importing](guides/development/config-importing.md)
* [Community](community.md)
- [OpenHIM Platform](README.md)
- [Getting Started](<README (1).md>)
- [📜 Recipes](recipes/README.md)
- [Central Data Repository with Data Warehousing](recipes/central-data-repository-with-data-warehousing.md)
- [Central Data repository (no reporting)](recipes/central-data-repository-no-reporting.md)
- [Master Patient Index](recipes/master-patient-index.md)
- [📦 Packages](packages/README.md)
- [Interoperability Layer Openhim](packages/interoperability-layer-openhim/README.md)
- [Local Development](packages/interoperability-layer-openhim/local-development.md)
- [Environment Variables](packages/interoperability-layer-openhim/environment-variables.md)
- [Monitoring](packages/monitoring/README.md)
- [Environment Variables](packages/monitoring/environment-variables.md)
- [Kafka Mapper Consumer](packages/kafka-mapper-consumer/README.md)
- [Local Development](packages/kafka-mapper-consumer/local-development.md)
- [Environment Variables](packages/kafka-mapper-consumer/environment-variables.md)
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
- [Data Mapper Logstash](packages/data-mapper-logstash/README.md)
- [Local Development](packages/data-mapper-logstash/local-development.md)
- [Environment Variables](packages/data-mapper-logstash/environment-variables.md)
- [Job Scheduler Ofelia](packages/job-scheduler-ofelia/README.md)
- [Local Development](packages/job-scheduler-ofelia/local-development.md)
- [Environment Variables](packages/job-scheduler-ofelia/environment-variables.md)
- [Analytics Datastore - Clickhouse](packages/analytics-datastore-clickhouse/README.md)
- [Local Development](packages/analytics-datastore-clickhouse/local-development.md)
- [Environment Variables](packages/analytics-datastore-clickhouse/environment-variables.md)
- [Analytics Datastore - Elasticsearch](packages/analytics-datastore-elasticsearch/README.md)
- [Local Development](packages/analytics-datastore-elasticsearch/local-development.md)
- [Running in Clustered Mode](packages/analytics-datastore-elasticsearch/running-in-clustered-mode.md)
- [Environment Variables](packages/analytics-datastore-elasticsearch/environment-variables.md)
- [Client Registry - SanteMPI](packages/client-registry-santempi/README.md)
- [Environment Variables](packages/client-registry-santempi/environment-variables.md)
- [Dashboard Visualiser - Jsreport](../docs/packages/dashboard-visualiser-js-report/README.md)
- [Local Development](../docs/packages/dashboard-visualiser-js-report/local-development.md)
- [Environment Variables](../docs/packages/dashboard-visualiser-js-report/environment-variables.md)
- [Dashboard Visualiser - Kibana](../docs/packages/dashboard-visualiser-kibana/README.md)
- [Local Development](../docs/packages/dashboard-visualiser-kibana/local-development.md)
- [Environment Variables](../docs/packages/dashboard-visualiser-kibana/environment-variables.md)
drizzentic marked this conversation as resolved.
Show resolved Hide resolved
- [Dashboard Visualiser - Superset](packages/dashboard-visualiser-superset/README.md)
- [Local Development](packages/dashboard-visualiser-superset/local-development.md)
- [Environment Variables](packages/dashboard-visualiser-superset/environment-variables.md)
- [Message Bus - Kafka](packages/message-bus-kafka/README.md)
- [Local Development](packages/message-bus-kafka/local-development.md)
- [Environment Variables](packages/message-bus-kafka/environment-variables.md)
- [FHIR Datastore HAPI FHIR](packages/fhir-datastore-hapi-fhir/README.md)
- [Local Development](packages/fhir-datastore-hapi-fhir/local-development.md)
- [Environment Variables](packages/fhir-datastore-hapi-fhir/environment-variables.md)
- [Kafka Unbundler Consumer](packages/kafka-unbundler-consumer/README.md)
- [Environment Variables](packages/kafka-unbundler-consumer/environment-variables.md)
- [Message Bus Helper Hapi Proxy](packages/message-bus-helper-hapi-proxy/README.md)
- [Environment Variables](packages/message-bus-helper-hapi-proxy/environment-variables.md)
- [Reverse Proxy Nginx](packages/reverse-proxy-nginx/README.md)
- [Local Development](packages/reverse-proxy-nginx/local-development.md)
- [Environment Variables](packages/reverse-proxy-nginx/environment-variables.md)
- [🗒️ Cheat sheet](cheat-sheet.md)
- [Architecture](architecture.md)
- [Guides](guides/README.md)
- [Provisioning remote servers](guides/provisioning-up-remote-servers/README.md)
- [Ansible](guides/provisioning-up-remote-servers/ansible.md)
- [Terraform](guides/provisioning-up-remote-servers/terraform.md)
- [Resource Allocations](guides/resource-allocations.md)
- [Disaster Recovery Process](guides/disaster-recovery-process/README.md)
- [Elasticsearch](guides/disaster-recovery-process/elasticsearch.md)
- [HAPI FHIR Data](guides/disaster-recovery-process/hapi-fhir-data.md)
- [OpenHIM Data](guides/disaster-recovery-process/openhim-data.md)
- [Development](guides/development/README.md)
- [Config Importing](guides/development/config-importing.md)
- [Performance Testing](guides/performance/README.md)
- [Community](community.md)
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")

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`

## 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 |
10 changes: 10 additions & 0 deletions monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ 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:
Expand All @@ -98,6 +100,7 @@ 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:
Expand Down Expand Up @@ -154,6 +157,7 @@ services:
command: -config.file=/etc/promtail/promtail-config.yml
deploy:
mode: global

configs:
grafana.ini:
file: ./grafana/grafana.ini
Expand Down Expand Up @@ -215,6 +219,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 @@ -238,6 +247,7 @@ volumes:




networks:
keycloak:
name: keycloak_public
Expand Down
Loading
Loading