Skip to content

Commit

Permalink
adds examples with discovery (v2)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-hanna committed Oct 18, 2019
1 parent 58edbdb commit 56e38fb
Show file tree
Hide file tree
Showing 7 changed files with 569 additions and 1 deletion.
198 changes: 198 additions & 0 deletions examples/benchmark-tests-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Benchmark Tests v2

These tests are the same as v1, except they were performed **WITH** routind, discovery and relays.

This example benchmark test was carried out on 17 Oct. 2019 on an Amazon AWS EC2 t2.xlarge instance running Red Hat Enterprise Linux.

The benchmark consisted of roughly two and one half hours of publishing messages of 1kb between fifty nodes. Nodes were started sequentiall, and were randomly peered with previously started nodes. Nodes in the subnet were then randomly selected every 100ms and told to publish a message on their pubsub channel.

Three libp2p pubsub protocols tested were: gossip, flood and random.

These tests were performed **WITH** any routing, peer discovery or relays.

Compiled versions of `orchestra` and `analysis` were used.

The shell script used in these tests were the same in all three tests:

```sh
#!/bin/sh
for i in {1..100}
do
echo $i;
./orchestra -c orchestra.config.json --log log-$i.txt
./analysis log-$i.txt -o=analysis-$i.json
rm log-$i.txt
done
```

## Usage

### Dependancies

```
$ python3 -m venv ./.venv
$ . ./.venv/bin/activate
$ pip3 install -r requirements.txt
```

### Data

The data files need to be un-tarred and un-gzipped. Navigate into each data directory and find the `.tar.gz` and run the following command `$ tar -zxvf <filename>.tar.gz -C analyses --strip-components 2`

## Results

### Gossip

The [config](./data/gossip/orchestra.config.json) file used in this test is:

```
{
"orchestra": {
"omitSubnet": false,
"hostRPCAddressesIfOmitSubnet": [],
"messageNanoSecondInterval": 100000000,
"clientTimeoutSeconds": 20,
"messageLocation": "client.message.json",
"messageByteSize": 1000,
"testDurationSeconds": 90,
"testWarmupSeconds": 10,
"testCooldownSeconds": 10
},
"subnet": {
"numHosts": 50,
"pubsubCIDR": "127.0.0.1/8",
"pubsubPortRange": [3000, 4000],
"rpcCIDR": "127.0.0.1/8",
"rpcPortRange": [8080, 9080],
"peerTopology": "whiteblocks"
},
"host": {
"transports": ["tcp", "ws"],
"muxers": [["yamux", "/yamux/1.0.0"], ["mplex", "/mplex/6.7.0"]],
"security": "secio",
"pubsubAlgorithm": "gossip",
"omitRelay": false,
"omitConnectionManager": false,
"omitNATPortMap": false,
"omitRPCServer": false,
"omitDiscoveryService": false,
"omitRouting": false
},
"general": {
"loggerLocation": ""
}
}
```

The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 8191669.008444444, median: 7424747.5, std: 4402639.37232589
Last Delivery Hop - mean: 3.9183, median: 4.0, std: 0.5033251643928716
Relative Message Redundancy - mean: 0.020408154000000008, median: 0.020408154, std: 6.938893903907228e-18
```

### Flood

The [config](./data/flood/orchestra.config.json) file used in this test is:

```
{
"orchestra": {
"omitSubnet": false,
"hostRPCAddressesIfOmitSubnet": [],
"messageNanoSecondInterval": 100000000,
"clientTimeoutSeconds": 20,
"messageLocation": "client.message.json",
"messageByteSize": 1000,
"testDurationSeconds": 90,
"testWarmupSeconds": 10,
"testCooldownSeconds": 10
},
"subnet": {
"numHosts": 50,
"pubsubCIDR": "127.0.0.1/8",
"pubsubPortRange": [3000, 4000],
"rpcCIDR": "127.0.0.1/8",
"rpcPortRange": [8080, 9080],
"peerTopology": "whiteblocks"
},
"host": {
"transports": ["tcp", "ws"],
"muxers": [["yamux", "/yamux/1.0.0"], ["mplex", "/mplex/6.7.0"]],
"security": "secio",
"pubsubAlgorithm": "flood",
"omitRelay": false,
"omitConnectionManager": false,
"omitNATPortMap": false,
"omitRPCServer": false,
"omitDiscoveryService": false,
"omitRouting": false
},
"general": {
"loggerLocation": ""
}
}
```

The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 22066784.235055555, median: 19746521.5, std: 8976580.811157353
Last Delivery Hop - mean: 1.815688888888889, median: 2.0, std: 0.5298914699035484
Relative Message Redundancy - mean: 0.020408154000000008, median: 0.020408154, std: 6.938893903907228e-18
```

### Random

The [config](./data/random/orchestra.config.json) file used in this test is:

```
{
"orchestra": {
"omitSubnet": false,
"hostRPCAddressesIfOmitSubnet": [],
"messageNanoSecondInterval": 100000000,
"clientTimeoutSeconds": 20,
"messageLocation": "client.message.json",
"messageByteSize": 1000,
"testDurationSeconds": 90,
"testWarmupSeconds": 10,
"testCooldownSeconds": 10
},
"subnet": {
"numHosts": 50,
"pubsubCIDR": "127.0.0.1/8",
"pubsubPortRange": [3000, 4000],
"rpcCIDR": "127.0.0.1/8",
"rpcPortRange": [8080, 9080],
"peerTopology": "whiteblocks"
},
"host": {
"transports": ["tcp", "ws"],
"muxers": [["yamux", "/yamux/1.0.0"], ["mplex", "/mplex/6.7.0"]],
"security": "secio",
"pubsubAlgorithm": "random",
"omitRelay": false,
"omitConnectionManager": false,
"omitNATPortMap": false,
"omitRPCServer": false,
"omitDiscoveryService": false,
"omitRouting": false
},
"general": {
"loggerLocation": ""
}
}
```

The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 8510964.002966667, median: 7818402.0, std: 4103939.5076013603
Last Delivery Hop - mean: 4.311455555555556, median: 4.0, std: 0.5017811532954073
Relative Message Redundancy - mean: 0.02043496377342223, median: 0.020408154, std: 0.00010740186739806513
```
36 changes: 36 additions & 0 deletions examples/benchmark-tests-2/data/random/orchestra.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"orchestra": {
"omitSubnet": false,
"hostRPCAddressesIfOmitSubnet": [],
"messageNanoSecondInterval": 100000000,
"clientTimeoutSeconds": 20,
"messageLocation": "client.message.json",
"messageByteSize": 1000,
"testDurationSeconds": 90,
"testWarmupSeconds": 10,
"testCooldownSeconds": 10
},
"subnet": {
"numHosts": 50,
"pubsubCIDR": "127.0.0.1/8",
"pubsubPortRange": [3000, 4000],
"rpcCIDR": "127.0.0.1/8",
"rpcPortRange": [8080, 9080],
"peerTopology": "whiteblocks"
},
"host": {
"transports": ["tcp", "ws"],
"muxers": [["yamux", "/yamux/1.0.0"], ["mplex", "/mplex/6.7.0"]],
"security": "secio",
"pubsubAlgorithm": "random",
"omitRelay": false,
"omitConnectionManager": false,
"omitNATPortMap": false,
"omitRPCServer": false,
"omitDiscoveryService": false,
"omitRouting": false
},
"general": {
"loggerLocation": ""
}
}
Binary file not shown.
8 changes: 8 additions & 0 deletions examples/benchmark-tests-2/data/random/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
for i in {1..100}
do
echo $i;
./orchestra -c orchestra.config.json --log log-$i.txt
./analysis log-$i.txt -o=analysis-$i.json
rm log-$i.txt
done
316 changes: 316 additions & 0 deletions examples/benchmark-tests-2/jupyter/Analyses.ipynb

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions examples/benchmark-tests-2/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cycler==0.10.0
kiwisolver==1.1.0
matplotlib==3.1.1
numpy==1.17.3
pyparsing==2.4.2
python-dateutil==2.8.0
six==1.12.0
5 changes: 4 additions & 1 deletion examples/benchmark-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ done
### Dependancies

```
$ python3 venv ./.venv
$ python3 -m venv ./.venv
$ . ./.venv/bin/activate
$ pip3 install -r requirements.txt
```
Expand Down Expand Up @@ -85,6 +85,7 @@ The [config](./data/gossip/orchestra.config.json) file used in this test is:
The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 26263571.375944443, median: 5174269.0, std: 224268172.2281729
Last Delivery Hop - mean: 9.067222222222222, median: 9.0, std: 1.788448444743704
Relative Message Redundancy - mean: 0.020408154000000008, median: 0.020408154, std: 6.938893903907228e-18
Expand Down Expand Up @@ -136,6 +137,7 @@ The [config](./data/flood/orchestra.config.json) file used in this test is:
The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 5401697.526744445, median: 5063028.5, std: 1606625.824702993
Last Delivery Hop - mean: 9.058477777777778, median: 9.0, std: 1.7084015643465469
Relative Message Redundancy - mean: 0.020408154000000008, median: 0.020408154, std: 6.938893903907228e-18
Expand Down Expand Up @@ -187,6 +189,7 @@ The [config](./data/random/orchestra.config.json) file used in this test is:
The results of these tests are:

```
Messages published: 90000
Total Nano Times - mean: 5345632.971422222, median: 5041622.5, std: 1618816.94873532
Last Delivery Hop - mean: 9.105344444444444, median: 9.0, std: 1.745120910558674
Relative Message Redundancy - mean: 0.021059074959888895, median: 0.020408154, std: 0.0044073976014634845
Expand Down

0 comments on commit 56e38fb

Please sign in to comment.