Skip to content
Snippets Groups Projects
Unverified Commit 6b60d47d authored by Jonas Theis's avatar Jonas Theis Committed by GitHub
Browse files

Speed up Docker network through little caching trick (#423)

parent 6cbcef10
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -162,8 +162,7 @@ class Datastructure {
}
getStatusText() {
// avg = this.connections.size*2 / (this.nodesOnline-1) : -1 == entry node (always disconnected)
return "nodes online: " + this.nodes.size + " - edges: " + this.connections.size + " - avg: " + (this.connections.size*2 / (this.nodes.size-1)).toFixed(2);
return "nodes online: " + this.nodes.size + " - edges: " + this.connections.size + " - avg: " + (this.connections.size*2 / this.nodes.size).toFixed(2);
}
addNode(idA) {
......
......@@ -150,7 +150,7 @@ func monitorForDesynchronization() {
timer.Reset(desyncedIfNoMessageInSec)
case <-timer.C:
log.Infof("no message received in %d seconds, marking node as desynced", desyncedIfNoMessageInSec)
log.Infof("no message received in %d seconds, marking node as desynced", int(desyncedIfNoMessageInSec.Seconds()))
markDesynced()
return
......
......@@ -2,7 +2,7 @@
![Docker network](../../images/docker-network.png)
Running `docker-compose` spins up a GoShimmer network within Docker as schematically shown in the figure above.
Running `./run.sh` spins up a GoShimmer network within Docker as schematically shown in the figure above.
`N` defines the number of `peer_replicas` and can be specified when running the network.
The peers can communicate freely within the Docker network
while the autopeering network visualizer, `master_peer's` dashboard and web API are reachable from the host system on the respective ports.
......@@ -23,14 +23,8 @@ Reachable from the host system
- `master_peer's` web API: http: http://localhost:8080
It is therefore possible to send messages to the local network via the `master_peer` and observe log messages either
via `docker logs --follow CONTAINER` or by starting the Docker network without the `-d` option, as follows.
via `docker logs --follow CONTAINER` or all of them combined when running via:
```
docker-compose up --scale peer_replica=5
# remove containers and network
docker-compose down
```
Sometimes when changing files Docker does not detect the changes on a rebuild.
Then the option `--build` needs to be used with `docker-compose`.
\ No newline at end of file
./run.sh 5
```
\ No newline at end of file
version: "3.5"
services:
builder:
container_name: builder
image: golang:1.14
working_dir: /tmp/goshimmer/
entrypoint: go install main.go
volumes:
- ../../..:/tmp/goshimmer:ro
- goshimmer-cache:/go
volumes:
goshimmer-cache:
name: goshimmer-cache
\ No newline at end of file
......@@ -15,8 +15,7 @@
"entryNodes": [
"X2cmCzYnZDjmsvdAH90Q7oKmhNeTdwJdj2FX84adLzo=@entry_node:14626"
],
"port": 14626,
"version": 1
"port": 14626
},
"dashboard": {
"bindAddress": "0.0.0.0:8081",
......@@ -30,6 +29,12 @@
"database": {
"directory": "mainnetdb"
},
"drng": {
"instanceId": 1,
"threshold": 3,
"distributedPubKey": "",
"committeeMembers": []
},
"gossip": {
"port": 14666
},
......@@ -39,8 +44,7 @@
"disableStacktrace": false,
"encoding": "console",
"outputPaths": [
"stdout",
"goshimmer.log"
"stdout"
],
"disableEvents": true,
"remotelog": {
......@@ -63,4 +67,4 @@
},
"bindAddress": "0.0.0.0:8080"
}
}
\ No newline at end of file
}
......@@ -2,56 +2,57 @@ version: "3.5"
services:
entry_node:
container_name: entry_node
image: golang:1.14
entrypoint: /go/bin/main
command: >
--config-dir=/tmp
--database.directory=/tmp/mainnetdb
--autopeering.seed=uuDCzsjyLNQ17/7fWKPNMYmr4IWuaVRf7qKqRL0v/6c=
--autopeering.entryNodes=
--analysis.server.bindAddress=0.0.0.0:1888
--node.enablePlugins=analysis-server,analysis-webinterface
--node.disablePlugins=portcheck,dashboard,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint
container_name: entry_node
image: iotaledger/goshimmer
build:
context: ../..
--node.disablePlugins=portcheck,dashboard,analysis-client,gossip,drng,issuer,sync,metrics,messagelayer,webapi,webapibroadcastdataendpoint,webapifindtransactionhashesendpoint,webapigetneighborsendpoint,webapigettransactionobjectsbyhashendpoint,webapigettransactiontrytesbyhashendpoint
volumes:
- ./config.docker.json:/config.json:ro
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
ports:
- "127.0.0.1:9000:9000/tcp" # autopeering visualizer
expose:
- "1888/tcp" # analysis server (within Docker network)
networks:
- integration-test
peer_master:
command: --node.enablePlugins=bootstrap
container_name: peer_master
image: iotaledger/goshimmer
build:
context: ../..
image: golang:1.14
entrypoint: /go/bin/main
command: >
--config-dir=/tmp
--database.directory=/tmp/mainnetdb
--node.enablePlugins=bootstrap
volumes:
- ./config.docker.json:/config.json:ro
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
ports:
- "127.0.0.1:8080:8080/tcp" # web API
- "127.0.0.1:8081:8081/tcp" # dashboard
depends_on:
- entry_node
networks:
- integration-test
peer_replica:
command: --node.disablePlugins=dashboard,portcheck
image: iotaledger/goshimmer
build:
context: ../..
image: golang:1.14
entrypoint: /go/bin/main
command: >
--config-dir=/tmp
--database.directory=/tmp/mainnetdb
--node.disablePlugins=dashboard,portcheck
volumes:
- ./config.docker.json:/config.json:ro
- ./config.docker.json:/tmp/config.json:ro
- goshimmer-cache:/go
expose:
- "8080/tcp" # web API (within Docker network)
depends_on:
- entry_node
networks:
- integration-test
networks:
integration-test:
driver: bridge
name: integration-test
volumes:
goshimmer-cache:
name: goshimmer-cache
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo 'Call with ./run replicas'
exit 0
fi
REPLICAS=$1
echo "Build GoShimmer"
docker-compose -f builder/docker-compose.builder.yml up
echo "Run GoShimmer network"
docker-compose up --scale peer_replica=$REPLICAS
echo "Clean up docker network"
docker-compose down
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment