diff --git a/README.md b/README.md index 518696d..d467436 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,14 @@ Simple script that allows to publish messages from different clients. Notice that the bash script expects two `nwaku` nodes that communicate through the _Relay_ protocol and the `nwaku_B` has the _Store_ protocol mounted and is connected to the `postgres_DB`. + +### Docker + +Contains a docker compose file with: +- Two `nwaku` nodes configured with _Postgres_ and _SQLite_. +- Grafana container to compare performance of both nodes. +- Container with simple shell script that sends publish requests through rpc. +- Two `nwaku` nodes configured as _Store_-clients and listening to REST requests. + +Inside the _docker_ folder, we have a _jmeter_ test plan which is aimed for +performing concurrent _Store_ REST requests to the _Store_-clients. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 4efbd43..07e13f1 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -40,13 +40,30 @@ services: - *logging - *pg_env volumes: - - ./run_node_postgres.sh:/opt/run_node_postgres.sh:Z + - ./run_nwaku_store_postgres.sh:/opt/run_nwaku_store_postgres.sh:Z entrypoint: sh command: - - /opt/run_node_postgres.sh + - /opt/run_nwaku_store_postgres.sh depends_on: - postgres + nwaku_client_postgres: + ## Waku node that acts as a Store client to the `nwaku_postgres` and listens + ## to REST-Store requests + image: statusteam/nim-waku:v0.19.0 + restart: on-failure + ports: + - 0.0.0.0:8645:8645/tcp + <<: + - *logging + volumes: + - ./run_nwaku_store_client_postgres.sh:/opt/run_nwaku_store_client_postgres.sh:Z + entrypoint: sh + command: + - /opt/run_nwaku_store_client_postgres.sh + depends_on: + - nwaku_postgres + nwaku_sqlite: ## Waku node with Store mounted & SQLite image: statusteam/nim-waku:v0.19.0 @@ -59,10 +76,27 @@ services: - *logging volumes: - ./data/sqlite:/data - - ./run_node_sqlite.sh:/opt/run_node_sqlite.sh:Z + - ./run_nwaku_store_sqlite.sh:/opt/run_nwaku_store_sqlite.sh:Z entrypoint: sh command: - - /opt/run_node_sqlite.sh + - /opt/run_nwaku_store_sqlite.sh + + nwaku_client_sqlite: + ## Waku node that acts as a Store client to the `nwaku_sqlite` and listens + ## to REST-Store requests + image: statusteam/nim-waku:v0.19.0 + restart: on-failure + ports: + - 0.0.0.0:8646:8646/tcp + <<: + - *logging + volumes: + - ./run_nwaku_store_client_sqlite.sh:/opt/run_nwaku_store_client_sqlite.sh:Z + entrypoint: sh + command: + - /opt/run_nwaku_store_client_sqlite.sh + depends_on: + - nwaku_sqlite msg_publisher: ## Sends json-rpc 'post_waku_v2_relay_v1_message' messages infinitely @@ -79,21 +113,6 @@ services: - nwaku_postgres - nwaku_sqlite - store_query_producer: - ## Sends json-rpc 'get_waku_v2_store_v1_messages' messages infinitely - image: alpine:3.16 - restart: on-failure - logging: - driver: "none" - volumes: - - ./store_query_producer.sh:/opt/store_query_producer.sh:Z - entrypoint: sh - command: - - /opt/store_query_producer.sh - depends_on: - - nwaku_postgres - - nwaku_sqlite - prometheus: image: docker.io/prom/prometheus:latest volumes: diff --git a/docker/jmeter/README.md b/docker/jmeter/README.md new file mode 100644 index 0000000..88d034d --- /dev/null +++ b/docker/jmeter/README.md @@ -0,0 +1,22 @@ + +## Summary + +The [jmeter](https://jmeter.apache.org/) is used to force concurrent Store +requests. + +_jmeter_ launches concurrent users that perform http requests to two _Store_ +node clients. And the _Test Plan_ is defined in _http_store_requests.jmx_. + +_jmeter_ is thought to be used in combination of the `docker compose up`. + +## jmeter + +### Prerequisite +- `docker compose up` to be running. +- Java should be installed (e.g. "1.8.0_382") + +### How to use jmeter +- From CLI and Linux, go to `apache-jmeter-5.6.2/bin` and run `bash jmeter.sh`. +- Load the _http_store_requests.jmx_ test plan file. +- Hit the "play" button and check the "Summary Report", for example. + diff --git a/docker/jmeter/http_store_requests.jmx b/docker/jmeter/http_store_requests.jmx new file mode 100644 index 0000000..66c565e --- /dev/null +++ b/docker/jmeter/http_store_requests.jmx @@ -0,0 +1,359 @@ + + + + + false + true + false + + + + + + + + + path + /store/v1/messages + = + + + contentType + application/json + = + + + method + GET + = + + + body + + = + + + pubsubtopic + /waku/2/default-waku/proto + = + + + num_users + 10 + = + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + continue + + -1 + false + + ${num_users} + 1 + false + + + true + false + Sends GET requests to the node which has a postgres-store-node + + + + false + + + + false + = + true + pubsubtopic + ${pubsubtopic} + + + + 127.0.0.1 + 8645 + ${contentType} + ${path} + ${method} + true + false + true + false + false + false + false + 6 + false + 0 + Sends Store GET http requests to the nwaku Store node client. In turn, that store-node client is connected to an Store nwaku node with Postgres + + + + + + User-Agent + ApacheJMeter + + + Content-Type + ${contentType} + + + + + + + + continue + + -1 + false + + ${num_users} + 1 + false + + + true + false + Sends GET requests to the node which has a sqlite-store-node + + + + false + + + + false + = + true + pubsubtopic + ${pubsubtopic} + + + + 127.0.0.1 + 8646 + ${contentType} + ${path} + ${method} + true + false + true + false + false + false + false + 6 + false + 0 + Sends Store GET http requests to the nwaku Store node client. In turn, that store-node client is connected to an Store nwaku node with SQLite + + + + + + User-Agent + ApacheJMeter + + + Content-Type + ${contentType} + + + + + + + + + diff --git a/docker/monitoring/configuration/dashboards/waku-analysis.json b/docker/monitoring/configuration/dashboards/waku-analysis.json index 0ecd69b..9e665f2 100644 --- a/docker/monitoring/configuration/dashboards/waku-analysis.json +++ b/docker/monitoring/configuration/dashboards/waku-analysis.json @@ -2703,20 +2703,6 @@ "legendFormat": "{{type}}", "range": true, "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum by (type)(increase(waku_store_errors{instance=~\"nwaku_postgres:8003\"}[1m]))", - "hide": false, - "interval": "", - "legendFormat": "{{type}}", - "range": true, - "refId": "B" } ], "title": "Waku Archive Errors (Postgres) (1m rate)", @@ -2805,26 +2791,12 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum by (type)(increase(waku_archive_errors{instance=~\"nwaku_:8004\"}[1m]))", + "expr": "sum by (type)(increase(waku_archive_errors{instance=~\"nwaku_sqlite:8004\"}[1m]))", "hide": false, "interval": "", "legendFormat": "{{type}}", "range": true, "refId": "A" - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "editorMode": "code", - "exemplar": true, - "expr": "sum by (type)(increase(waku_store_errors{instance=~\"nwaku_sqlite:8004\"}[1m]))", - "hide": false, - "interval": "", - "legendFormat": "{{type}}", - "range": true, - "refId": "B" } ], "title": "Waku Archive Errors (SQLite) (1m rate)", diff --git a/docker/run_nwaku_store_client_postgres.sh b/docker/run_nwaku_store_client_postgres.sh new file mode 100644 index 0000000..055e9df --- /dev/null +++ b/docker/run_nwaku_store_client_postgres.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +## Install the `dig` command +apk add --update bind-tools + +peer_IP=$(dig +short nwaku_postgres) + +exec /usr/bin/wakunode\ + --nodekey=7d714a1fada214dead6dc9c7274585eca0ff292451866e7d6d677dc818e8ccd2\ + --storenode=/ip4/${peer_IP}/tcp/30303/p2p/16Uiu2HAmJyLCRhiErTRFcW5GKPrpoMjGbbWdFMx4GCUnnhmxeYhd\ + --log-level=ERROR\ + --rest=true\ + --rest-port=8645\ + --rest-address=0.0.0.0 diff --git a/docker/run_nwaku_store_client_sqlite.sh b/docker/run_nwaku_store_client_sqlite.sh new file mode 100644 index 0000000..ad7cb1e --- /dev/null +++ b/docker/run_nwaku_store_client_sqlite.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +## Install the `dig` command +apk add --update bind-tools + +peer_IP=$(dig +short nwaku_sqlite) + +exec /usr/bin/wakunode\ + --nodekey=5d714a1fada214dead6dc9c7274585eca0ff292451866e7d6d677dc818e8ccd2\ + --storenode=/ip4/${peer_IP}/tcp/30304/p2p/16Uiu2HAkxj3WzLiqBximSaHc8wV9Co87GyRGRYLVGsHZrzi3TL5W\ + --log-level=ERROR\ + --rest=true\ + --rest-port=8646\ + --rest-address=0.0.0.0 diff --git a/docker/run_node_postgres.sh b/docker/run_nwaku_store_postgres.sh similarity index 78% rename from docker/run_node_postgres.sh rename to docker/run_nwaku_store_postgres.sh index 21ee5b3..2a85725 100644 --- a/docker/run_node_postgres.sh +++ b/docker/run_nwaku_store_postgres.sh @@ -8,17 +8,12 @@ peer_IP=$(dig +short nwaku_sqlite) exec /usr/bin/wakunode\ --nodekey=1d714a1fada214dead6dc9c7274585eca0ff292451866e7d6d677dc818e8ccd2\ --staticnode=/ip4/${peer_IP}/tcp/30304/p2p/16Uiu2HAkxj3WzLiqBximSaHc8wV9Co87GyRGRYLVGsHZrzi3TL5W\ - --storenode=/ip4/${peer_IP}/tcp/30304/p2p/16Uiu2HAkxj3WzLiqBximSaHc8wV9Co87GyRGRYLVGsHZrzi3TL5W\ --relay=true\ --topic=/waku/2/default-waku/proto\ --topic=/waku/2/dev-waku/proto\ - --filter=true\ - --lightpush=true\ --rpc-admin=true\ --keep-alive=true\ - --max-connections=150\ - --log-level=DEBUG\ - --dns-discovery=true\ + --log-level=ERROR\ --rpc-port=8545\ --rpc-address=0.0.0.0\ --tcp-port=30303\ diff --git a/docker/run_node_sqlite.sh b/docker/run_nwaku_store_sqlite.sh similarity index 77% rename from docker/run_node_sqlite.sh rename to docker/run_nwaku_store_sqlite.sh index 2d77f9b..0908052 100644 --- a/docker/run_node_sqlite.sh +++ b/docker/run_nwaku_store_sqlite.sh @@ -8,17 +8,12 @@ peer_IP=$(dig +short nwaku_postgres) exec /usr/bin/wakunode\ --nodekey=2d714a1fada214dead6dc9c7274585eca0ff292451866e7d6d677dc818e8ccd2\ --staticnode=/ip4/${peer_IP}/tcp/30303/p2p/16Uiu2HAmJyLCRhiErTRFcW5GKPrpoMjGbbWdFMx4GCUnnhmxeYhd\ - --storenode=/ip4/${peer_IP}/tcp/30303/p2p/16Uiu2HAmJyLCRhiErTRFcW5GKPrpoMjGbbWdFMx4GCUnnhmxeYhd\ --relay=true\ --topic=/waku/2/default-waku/proto\ --topic=/waku/2/dev-waku/proto\ - --filter=true\ - --lightpush=true\ --rpc-admin=true\ --keep-alive=true\ - --max-connections=150\ - --log-level=DEBUG\ - --dns-discovery=true\ + --log-level=ERROR\ --rpc-port=8546\ --rpc-address=0.0.0.0\ --tcp-port=30304\ diff --git a/docker/store_query_producer.sh b/docker/store_query_producer.sh deleted file mode 100644 index 325ad98..0000000 --- a/docker/store_query_producer.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -## Install the `dig` command -apk --no-cache add bind-tools - -apk --no-cache add curl - -## Install coreutils so that the `date` command behaves as the GNU one -apk --no-cache add coreutils - -## The port numbers and host names are defined in the 'docker-compose.yml' file -nwaku_postgres_IP=$(dig +short nwaku_postgres) -nwaku_sqlite_IP=$(dig +short nwaku_sqlite) -target_postgres="http://${nwaku_postgres_IP}:8545" -target_sqlite="http://${nwaku_sqlite_IP}:8546" - -echo "This is publisher: ${target_postgres}; ${target_sqlite}" - -## Wait a few seconds until the `nwaku` nodes started their rpc services -sleep 20 - -while true -do - ## Send a 'get_waku_v2_store_v1_messages' req to the ""postgres"" node - curl -d '{"jsonrpc":"2.0","id":"id","method":"get_waku_v2_store_v1_messages"}' --header "Content-Type: application/json" ${target_postgres} - - ## Send a 'get_waku_v2_store_v1_messages' req to the ""sqlite"" node - curl -d '{"jsonrpc":"2.0","id":"id","method":"get_waku_v2_store_v1_messages"}' --header "Content-Type: application/json" ${target_sqlite} - - sleep 5 -done