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

Netgoal: Update netgoal generate flags and variables #4656

Merged
merged 24 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
51c9404
if npn hosts is not set, set it equal to number of NPNs
algobarb Oct 6, 2022
4b75143
Merge branch 'master' into algobarb/npnUpdate
algobarb Oct 11, 2022
cf872aa
make custom recipe smaller to reduce cost on testing
algobarb Oct 13, 2022
acce502
update the json on custom recipe
algobarb Oct 13, 2022
d496746
add -X flag and use old params
algobarb Oct 13, 2022
9120552
test without -X flag
algobarb Oct 13, 2022
c484ad3
make custom scenario smaller
algobarb Oct 13, 2022
df8e6ce
remove the -H flag in python for testing
algobarb Oct 13, 2022
48783f6
revert previous testing change
algobarb Oct 13, 2022
ff3f3c8
fix netgoal
algobarb Oct 14, 2022
d9d55e2
add npn variable in json and generate_network python script
algobarb Oct 17, 2022
03859ee
add npn key and fix conditional for consensus protocol
algobarb Oct 17, 2022
a275f3f
add README with netgoal generate details
algobarb Oct 17, 2022
a917262
update Makefiles
algobarb Oct 17, 2022
bc2fc9b
update variable and flag names in netgoal generate
algobarb Oct 23, 2022
87a6796
update flags used in generate_network.py
algobarb Oct 23, 2022
b39a770
update steps in custom recipe README
algobarb Oct 23, 2022
96356e7
update scenario makefiles
algobarb Oct 23, 2022
43234dc
update documentation
algobarb Oct 24, 2022
a484f16
fix variable references for wallets and stake for NPNs
algobarb Oct 24, 2022
c7fcfc3
update documentation
algobarb Oct 24, 2022
b6b7e0d
update documentation
algobarb Oct 24, 2022
58e3410
grammar
algobarb Oct 24, 2022
af0c57a
Update test/testdata/deployednettemplates/recipes/README.md
algobarb Oct 24, 2022
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
3 changes: 3 additions & 0 deletions cmd/netgoal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ template modes for -t:`,
if nodeHostsToGenerate < 0 {
nodeHostsToGenerate = nodesToGenerate
}
if (nonPartnodesToGenerate >= 0) && (nonPartnodesHostsToGenerate == 0) {
nonPartnodesHostsToGenerate = nonPartnodesToGenerate
}
if relaysToGenerate < 0 {
reportErrorf("must specify number of relays with -R")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ def build_netgoal_params(template_dict):
instances = template_dict['instances']

relay_count = 0
participating_node_count = 0
non_participating_node_count = 0
participating_instance_count = 0
non_participating_instance_count = 0

for group in template_dict['groups']:
relay_count += getInstanceCount(instances['relays'], group['percent']['relays'])
participating_node_count += getInstanceCount(instances['participatingNodes'], group['percent']['participatingNodes'])
non_participating_node_count += getInstanceCount(instances['nonParticipatingNodes'], group['percent']['nonParticipatingNodes'])
participating_instance_count += getInstanceCount(instances['participatingNodes'], group['percent']['participatingNodes'])
non_participating_instance_count += getInstanceCount(instances['nonParticipatingNodes'], group['percent']['nonParticipatingNodes'])

relay_config = instances['relays']['config']
participating_node_config = instances['participatingNodes']['config']
non_participating_node_config = instances['nonParticipatingNodes']['config']

wallets_count = template_dict['network']['wallets']
nodes_count = template_dict['network']['nodes']
npn_count = template_dict['network']['npn']

return [
'-w', str(wallets_count),
'-R', str(relay_count),
'-N', str(participating_node_count),
'-H', str(non_participating_node_count),
'-N', str(participating_instance_count),
'-H', str(non_participating_instance_count),
'-n', str(nodes_count),
'-X', str(npn_count),
'--relay-template', relay_config,
'--node-template', participating_node_config,
'--non-participating-node-template', non_participating_node_config
Expand All @@ -72,7 +74,7 @@ def build_genesis(template_path, netgoal_params, template_dict):
]
args.extend(netgoal_params)
netgoal(args, template_path)
if template_dict['network']['ConsensusProtocol']:
if 'ConsensusProtocol' in template_dict['network']:
updateProtocol(f"{template_path}/generated/genesis.json", template_dict['network']['ConsensusProtocol'])

def updateProtocol(genesis_path, consensus_protocol):
Expand Down
45 changes: 45 additions & 0 deletions test/testdata/deployednettemplates/recipes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Recipes

Most of the recipes' net.json and genesis.json use one of the following methods to call `netgoal generate`:
1. `Makefile`
2. `python3 {GO_ALGORAND_PATH}/test/testdata/deployednettemplates/generate-recipe/generate_network.py -f {PATH_TO}/network-tpl.json`

Details for netgoal generate could be found in the binary with:
```
netgoal generate -h
```

Source code for netgoal can be found in `{GO_ALGORAND_PATH}/cmd/netgoal/generate.go`

Quick reference when reading some of the Makefiles in this directory:
```
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
algobarb marked this conversation as resolved.
Show resolved Hide resolved
```
- If you specify `-n` (number of participating algod nodes), the default if you don't pass in `-N` (number of machines to host the algod nodes) is set to match `-n`, i.e. one algod node per machine. To increase the number of nodes per machine, specify both `-n` and `-N`. `-n 10 -N 5` means 10 participating algod nodes across 5 machines, so 2 algod nodes per machine.
- If you specify `-X` (number of non-participating nodes, npn), the default if you don't pass in `-H` (number of machines to host the npn) is set to the match `-X`, i.e. one npn per machine. To increase the number of nodes per machine, specify both `-X` and `-H`. `-X 10 -H 5` means 10 npns across 5 machines, so 2 npns per machine.

```
algobarb marked this conversation as resolved.
Show resolved Hide resolved
Usage:
netgoal generate [flags]

Flags:
--bal stringArray Application Count
-h, --help help for generate
--naccounts uint Account count (default 31)
--napps uint Application Count (default 7)
--nassets uint Asset count (default 5)
-N, --node-hosts int Node-hosts to generate, default=nodes (default -1)
--node-template string json for one node
-n, --nodes int Nodes to generate (default -1)
--non-participating-node-template string json for non participating node
-X, --non-participating-nodes int Non participating nodes to generate
-H, --non-participating-nodes-hosts int Non participating nodes hosts to generate
--ntxns uint Transaction count (default 17)
-o, --outputfile string Output filename
--relay-template string json for a relay node
-R, --relays int Relays to generate (default -1)
--rounds uint Number of rounds (default 13)
-t, --template string Template to generate
--wallet-name string Source wallet name
-w, --wallets int Wallets to generate (default -1)
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 20 -R 1 -N 20 -n 20 -H 1 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 20 -R 1 -N 20 -n 20 -H 1 -X 1 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: topology.json net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 20 -R 5 -N 20 -n 20 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 20 -R 5 -N 20 -n 20 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: topology.json net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
FILEPARAMS=--rounds 5000 --ntxns 1000 --naccounts 3000000 --nassets 20000 --napps 20000 --wallet-name "wallet1" --bal 100000 --bal 1000000

all: net.json genesis.json boostrappedFile.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"network": {
"wallets": 6,
"nodes": 3,
"npn": 5,
"ConsensusProtocol": "future"
},
"instances": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"network": {
"wallets": 6,
"nodes": 3,
"npn": 5,
"ConsensusProtocol": "future"
},
"instances": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"network": {
"wallets": 6,
"nodes": 3,
"wallets": 3,
"nodes": 1,
"npn": 1,
"ConsensusProtocol": "future"
},
"instances": {
"relays": {
"config": "./configs/relay.json",
"type": "m5d.4xl",
"type": "m5d.2xl",
"count": 1
},
"participatingNodes": {
"config": "./configs/node.json",
"type": "m5d.4xl",
"count": 3
"type": "m5d.2xl",
"count": 1
},
"nonParticipatingNodes": {
"config": "./configs/nonPartNode.json",
"type": "m5d.4xl",
"count": 5
"type": "m5d.2xl",
"count": 1
}
},
"groups": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"network": {
"wallets": 100,
"nodes": 50
"nodes": 50,
"npn": 10
},
"instances": {
"relays": {
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/deployednettemplates/recipes/mmnet/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 130 -R 136 -n 130 -H 16 --node-template configs/node.json --relay-template configs/relay.json --non-participating-node-template configs/nonPartNode.json
PARAMS=-w 130 -R 136 -n 130 -H 16 -X 16 --node-template configs/node.json --relay-template configs/relay.json --non-participating-node-template configs/nonPartNode.json

all: topology.json net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# scenario1s is scenario1 but smaller, (100 nodes, 100 wallets) -> (20 nodes, 20 wallets), each algod gets single tenancy on a smaller ec2 instance
PARAMS=-w 20 -R 8 -N 20 -n 20 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 20 -R 8 -N 20 -n 20 -H 10 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 400 -R 20 -N 40 -n 200 -H 15 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 400 -R 20 -N 40 -n 200 -H 15 -X 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 10000 -R 20 -N 100 -n 1000 -H 15 --node-template node.json --relay-template relay.json
PARAMS=-w 10000 -R 20 -N 100 -n 1000 -H 15 -X 15 --node-template node.json --relay-template relay.json

all: net.json genesis.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# scenario3s is scenario3 but smaller. (10000 wallets -> 500) (1000 algod participating nodes -> 100) It still keeps a global datacenter distribution.
PARAMS=-w 500 -R 20 -N 100 -n 100 -H 15 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 500 -R 20 -N 100 -n 100 -H 15 -X 15 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

SOURCES=node.json ${GOPATH}/bin/netgoal Makefile relay.json nonPartNode.json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PARAMS=-w 10 -R 4 -N 10 -n 10 -H 1 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
PARAMS=-w 10 -R 4 -N 10 -n 10 -H 1 -X 1 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json

all: net.json genesis.json

Expand Down