Adding bash script to stress inserts operation
This commit is contained in:
parent
d86d0d6cd7
commit
fe7061a21e
26
README.md
26
README.md
|
@ -1,3 +1,23 @@
|
|||
```
|
||||
make
|
||||
```
|
||||
|
||||
## Summary
|
||||
This repo contains tools for analysing performance around the Store protocol
|
||||
|
||||
### Golang tool
|
||||
|
||||
The Golang project is aimed to setup `go-waku` clients that publish messages
|
||||
and later make requests trough the _Store_ protocol to retrieve the stored
|
||||
messages
|
||||
|
||||
To run the tests, go to the `go` folder and run the `make` command.
|
||||
Notice that the `go` tool expects a running `nwaku` node(s) to be running with
|
||||
_Store_ protocol mounted, and a running postgres database.
|
||||
|
||||
### Bash tool
|
||||
|
||||
Simple script that allows to publish messages from different clients.
|
||||
|
||||
`BASH`(n clients) --json-rpc--> `nwaku_A` <--relay--> `nwaku_B` <---> `database`
|
||||
|
||||
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`.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
version: "3.8"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:9.6-alpine
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_PASSWORD: test123
|
||||
ports:
|
||||
- "5432:5432"
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
### Summary
|
||||
|
||||
This simple script stress the _Store_ protocol from a different approach.
|
||||
|
||||
The setup needs to have two [`nwaku`](https://github.com/waku-org/nwaku)
|
||||
running, A & B.
|
||||
|
||||
Content of "cfg_node_a.txt" file:
|
||||
```code
|
||||
ports-shift = 1
|
||||
pubsub-topic = [ "/waku/2/default-waku/proto" "/waku/2/testing-store" "/waku/2/dev-waku/proto" ]
|
||||
staticnode = [ "/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmVFXtAfSj4EiR7mL2KvL4EE2wztuQgUSBoj2Jx2KeXFLN" ]
|
||||
storenode = "/ip4/127.0.0.1/tcp/60000/p2p/16Uiu2HAmVFXtAfSj4EiR7mL2KvL4EE2wztuQgUSBoj2Jx2KeXFLN"
|
||||
log-level = "DEBUG"
|
||||
nodekey = "364d111d729a6eb6d2e6113e163f017b5ef03a6f94c9b5b7bb1bb36fa5cb07a9"
|
||||
rest = true
|
||||
lightpush = true
|
||||
discv5-discovery = true
|
||||
discv5-udp-port = 9000
|
||||
discv5-enr-auto-update = false
|
||||
rpc-admin = true
|
||||
metrics-server = true
|
||||
```
|
||||
|
||||
Content of "cfg_node_b.txt" file:
|
||||
```code
|
||||
ports-shift = 0
|
||||
pubsub-topic = [ "/waku/2/default-waku/proto" "/waku/2/testing-store" ]
|
||||
staticnode = [ "/ip4/0.0.0.0/tcp/60001/p2p/16Uiu2HAm2eqzqp6xn32fzgGi8K4BuF88W4Xy6yxsmDcW8h1gj6ie" ]
|
||||
log-level = "DEBUG"
|
||||
nodekey = "0d714a1fada214dead6dc9c7274585eca0ff292451866e7d6d677dc818e8ccd2"
|
||||
lightpush = true
|
||||
store = true
|
||||
store-message-db-url = "postgres://postgres:test123@localhost:5432/postgres"
|
||||
#store-message-db-url = "sqlite://sqlite_folder/store.sqlite3"
|
||||
store-message-retention-policy = "time:6000"
|
||||
rpc-admin=true
|
||||
metrics-server = true
|
||||
```
|
||||
|
||||
### Setup
|
||||
|
||||
#### Start a Postgres database
|
||||
`docker compose -f postgres-docker-compose.yml up -d`
|
||||
|
||||
#### Run node A
|
||||
1. Open one terminal and go to the root folder of the [`nwaku`](https://github.com/waku-org/nwaku) repo.
|
||||
2. Run `./build/wakunode2 --config-file=cfg_node_a.txt`
|
||||
|
||||
#### Run node B
|
||||
1. Open one terminal and go to the root folder of the [`nwaku`](https://github.com/waku-org/nwaku) repo.
|
||||
2. Run `./build/wakunode2 --config-file=cfg_node_b.txt`
|
||||
|
||||
( notice that node B is connected to a database )
|
||||
|
||||
#### Send messages to node A
|
||||
|
||||
The next example will start 25 processes that each will send 300 messages.
|
||||
|
||||
`bash sh/publish_multiple_clients.sh 25 300`
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
## This script allows to publish multiple messages from multiple processes.
|
||||
|
||||
## Params
|
||||
## $1 - The first parameter passed represents the number of clients.
|
||||
## $2 - The second parameter has the # of messages each client will publish.
|
||||
|
||||
for i in $(seq $1); do
|
||||
bash sh/publish_one_client.sh $2 &
|
||||
pids[${i}]=$!
|
||||
done
|
||||
|
||||
# wait for all pids
|
||||
for pid in ${pids[*]}; do
|
||||
echo Waiting for ${pid}
|
||||
wait $pid
|
||||
done
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script just sends rpc 'post_waku_v2_relay_v1_message' requests to
|
||||
# http://localhost:8546
|
||||
|
||||
# Therefore, there should be an `nwaku` node listening to rpc requests.
|
||||
|
||||
# The number of messages is specified by the first parameter.
|
||||
|
||||
target='http://localhost:8546'
|
||||
|
||||
for i in $( seq $1 )
|
||||
do
|
||||
echo $i
|
||||
curl -d "{\"jsonrpc\":\"2.0\",\"id\":"$(date +%s%N)",\"method\":\"post_waku_v2_relay_v1_message\", \"params\":[\"/waku/2/default-waku/proto\", {\"timestamp\":"$(date +%s%N)", \"payload\":\"aGhvbGFzYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY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