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

Gennet + Starlark: specifying inter-subnetwork QoS requirements #128

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6b61796
add inter-param sanity checks
0xFugue Jun 7, 2023
cbf5764
subnets placeholder
0xFugue Jun 8, 2023
8153f3e
config.json v0
0xFugue Jun 8, 2023
37d5421
config.json - v1
0xFugue Jun 8, 2023
5cdce39
QoS distribution and sanity checks
0xFugue Jun 8, 2023
8af198e
config.json
0xFugue Jun 8, 2023
7757420
QoS distribution done
0xFugue Jun 8, 2023
12edf5f
sorted subnets, more flexible traits
0xFugue Jun 8, 2023
2d2665d
flexible QoS
0xFugue Jun 8, 2023
544f12a
optimisations
0xFugue Jun 8, 2023
612d66c
config.json, comments
0xFugue Jun 8, 2023
ef0fc12
Merge branch 'master' into 0xFugue-gennet-QoS
0xFugue Jun 8, 2023
cdc9e7d
run.sh: ln -s -> cp
0xFugue Jun 8, 2023
6c4bfe4
comments/logs
0xFugue Jun 8, 2023
03604d8
node_type/qos distribution optimisations
0xFugue Jun 8, 2023
3c5c861
config.json
0xFugue Jun 8, 2023
ffa8e8b
config.json
0xFugue Jun 8, 2023
cc6dd79
ruleout trivial subnet + non-trivial QoS distribution
0xFugue Jun 8, 2023
205705e
comment
0xFugue Jun 8, 2023
f80d43f
config:json non-trivial subnet, non-trivial distribution
0xFugue Jun 8, 2023
fdbbffb
perform_sanity_checks
0xFugue Jun 8, 2023
843cf2b
comments
0xFugue Jun 8, 2023
376ec57
tweak subnet generation and handling: all O(n)
0xFugue Jun 9, 2023
6fe76b0
common topic format 4 nwaku and gowaku
0xFugue Jun 9, 2023
cf6c195
common topic format 4 nwaku and gowaku
0xFugue Jun 9, 2023
5c7eb76
back to old topic format; not supported in nwaku:trace2
0xFugue Jun 9, 2023
ef69a16
config.json
0xFugue Jun 9, 2023
3d5627c
30sec delay b4 stopping measurement
0xFugue Jun 9, 2023
89000e0
delete signal fifo; 45sec delay b4 log collection
0xFugue Jun 9, 2023
32c6d61
Added Normal Distribution specs
0xFugue Jul 5, 2023
4b3007e
added QoS dispatcher
0xFugue Jul 5, 2023
a8325d4
config for Normal distribution
0xFugue Jul 5, 2023
fd303f8
added sys vars
0xFugue Jul 5, 2023
560c445
add --with-subnetworks
0xFugue Jul 5, 2023
3e0b685
fully working wakurtosis QoS - v0
0xFugue Jul 5, 2023
aa20e11
remove prints
0xFugue Jul 5, 2023
9557fd2
redact
0xFugue Jul 5, 2023
ea5c447
run.sh
0xFugue Jul 5, 2023
d914b75
redact
0xFugue Jul 5, 2023
7b4679f
updated QoS spec format
0xFugue Jul 6, 2023
ec6ad60
updated QoS spec parsing
0xFugue Jul 6, 2023
60bb31f
updated QoS spec handling
0xFugue Jul 6, 2023
56dfd41
updated QoS spec
0xFugue Jul 6, 2023
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
10 changes: 8 additions & 2 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@
"fanout": 13,
"num_topics": 1,
"num_partitions": 1,
"num_subnets": 1,
"num_subnets": 7,
"container_size": "1",
"node_type_distribution": {
"nwaku:relay:rpc:metrics": 100,
"gowaku:rln:dnsdisc:dns": 0
},
"network_type": "newmanwattsstrogatz",
"output_dir": "network_data",
"benchmark": "False"
"benchmark": "False",
"inter_subnet_qos_distribution": {
"None": 60,
"Block": 10,
"80:Uniform:10": 10,
"2.0:Normal:5000:30:10": 20
}
},
"wls": {
"debug_level": "DEBUG",
Expand Down
206 changes: 171 additions & 35 deletions gennet-module/gennet.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion monitoring/dstats/dstats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ docker exec $wait_cid touch /wls/start.signal

echo "dstats: waiting for WLS to finish : dstats $dstats_pid is running"
docker container wait $wait_cid
sleep 10 # make sure you collect the stats until last messages settle down
sleep 30 # collect as much stats possible as the simulation is winding down

echo "dstats: WLS finished: stopping the docker monitor $dstats_pid"
kill -15 $dstats_pid
2 changes: 1 addition & 1 deletion monitoring/host-proc/host-proc-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ procfs_pid=$!

echo "host-proc: waiting for WLS to finish: procfs $procfs_pid running"
docker container wait $WAIT_CID # now wait for the wakurtosis to finish
sleep 60 # make sure you collect the stats until last messages settle down
sleep 30 # collect as much stats possible as the simulation is winding down

echo "host-proc: stopping the helper $procfs_pid"
kill -15 $procfs_pid # procfs-stats is a su process
Expand Down
14 changes: 8 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ kurtosis_inspect="kurtosis_inspect.log"
usr=`id -u`
grp=`id -g`
stats_dir=stats
signal_fifo=/tmp/hostproc-signal.fifo # do not create fifo under ./stats, or inside the repo
signal_fifo=/tmp/host-proc-signal.fifo # do not create fifo under ./stats, or inside the repo
##################### MONITORING MODULE PROLOGUES
if [ "$metrics_infra" = "cadvisor" ]; then #CADVISOR
# prepare the enclave
Expand Down Expand Up @@ -89,7 +89,8 @@ fi
jobs=$(cat config/${wakurtosis_config_file} | jq -r ".kurtosis.jobs")
echo -e "\nSetting up the enclave: $enclave_name"

kurtosis_cmd="kurtosis --cli-log-level \"$loglevel\" run --full-uuids --enclave ${enclave_name} . '{\"wakurtosis_config_file\" : \"config/${wakurtosis_config_file}\"}' --parallelism ${jobs} > $kurtosis_run 2>&1"
#kurtosis_cmd="kurtosis --cli-log-level \"$loglevel\" run --full-uuids --enclave ${enclave_name} . '{\"wakurtosis_config_file\" : \"config/${wakurtosis_config_file}\"}' --parallelism ${jobs} > $kurtosis_run 2>&1"
kurtosis_cmd="kurtosis --cli-log-level \"$loglevel\" run --full-uuids --enclave ${enclave_name} . '{\"wakurtosis_config_file\" : \"config/${wakurtosis_config_file}\"}' --with-subnetworks --parallelism ${jobs} > $kurtosis_run 2>&1"

START=$(date +%s)
eval $kurtosis_cmd
Expand Down Expand Up @@ -165,8 +166,8 @@ echo "Simulation took $DIFF1 + $DIFF2 = $(( $END2 - $START)) secs"


##################### GATHER CONFIG, LOGS & METRICS
# give time for the messages to settle down before we collect the logs
sleep 60
# give time for the logs and metrics collection to settle down
sleep 45 # 30 + 15

# dump logs
echo "Dumping Kurtosis logs"
Expand All @@ -182,6 +183,7 @@ if [ "$metrics_infra" = "dstats" ]; then
echo "dstats: copying the dstats data"
cp -r ./monitoring/dstats/stats ${enclave_name}_logs/dstats-data
elif [ "$metrics_infra" = "host-proc" ]; then
rm -f $signal_fifo
echo "Copying the host-proc data"
cp -r ./monitoring/host-proc/stats ${enclave_name}_logs/host-proc-data
elif [ "$metrics_infra" = "container-proc" ]; then
Expand All @@ -206,13 +208,13 @@ if jq -e ."plotting" >/dev/null 2>&1 "./config/${wakurtosis_config_file}"; then
docker run --name "dstats" --network "host" -v "$(pwd)/wakurtosis_logs:/simulation_data/" --add-host=host.docker.internal:host-gateway analysis src/hproc.py dstats /simulation_data/ --config-file /simulation_data/config/config.json >/dev/null 2>&1
docker cp dstats:/analysis/plots/ wakurtosis_logs/dstats-plots
cd wakurtosis_logs
ln -s dstats-plots/output-dstats-compare.pdf analysis.pdf
cp dstats-plots/output-dstats-compare.pdf analysis.pdf
cd ..
elif [ "$metrics_infra" = "host-proc" ]; then
docker run --name "host-proc" --network "host" -v "$(pwd)/wakurtosis_logs:/simulation_data/" --add-host=host.docker.internal:host-gateway analysis src/hproc.py host-proc /simulation_data/ --config-file /simulation_data/config/config.json >/dev/null 2>&1
docker cp host-proc:/analysis/plots/ wakurtosis_logs/host-proc-plots
cd wakurtosis_logs
ln -s host-proc-plots/output-host-proc-compare.pdf analysis.pdf
cp host-proc-plots/output-host-proc-compare.pdf analysis.pdf
cd ..
elif [ "$metrics_infra" = "container-proc" ]; then
docker run --network "host" -v "$(pwd)/wakurtosis_logs:/simulation_data/" --add-host=host.docker.internal:host-gateway analysis src/main.py -i container-proc >/dev/null 2>&1
Expand Down
7 changes: 6 additions & 1 deletion src/node_builders/dispatchers.star
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ ports_dispatcher = {
vars.GENNET_GOWAKU_IMAGE_VALUE: waku_builder.add_waku_ports_info_to_topology,
vars.GENNET_NWAKU_IMAGE_VALUE: waku_builder.add_waku_ports_info_to_topology,
vars.GENNET_NOMOS_IMAGE_VALUE: nomos_builder.add_nomos_ports_info_to_topology
}
}

#QoS_distribution_dispatcher = {
# vars.GENNET_SUBNETS_QOS_UNIFORM: UniformPacketDelayDistribution,
# vars.GENNET_SUBNETS_QOS_NORMAL: NormalPacketDelayDistribution
#}
44 changes: 43 additions & 1 deletion src/node_builders/node_builders.star
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def instantiate_services(plan, network_topology, testing):
configs=all_services_configuration
)

# Deploy the subnetworks
if network_topology[vars.GENNET_SUBNETS_KEY]:
plan.print("Greetings")
for src in network_topology[vars.GENNET_SUBNETS_KEY].keys():
for dst in network_topology[vars.GENNET_SUBNETS_KEY][src].keys():
QoS = network_topology[vars.GENNET_SUBNETS_KEY][dst][src]
connection_config = get_connection_config(QoS, plan)
plan.print(src + "-" + dst + " = " + str(connection_config))
plan.set_connection(subnetworks = (src, dst), config = connection_config)
_add_service_info_to_topology(plan, all_services_information, network_topology)


Expand Down Expand Up @@ -94,4 +103,37 @@ def _add_service_info_to_topology(plan, all_services_information, network_topolo
ip = network_topology[vars.GENNET_NODES_KEY][nodes[0]][vars.IP_KEY]
network_topology[vars.GENNET_ALL_CONTAINERS_KEY][container_id] = {}
network_topology[vars.GENNET_ALL_CONTAINERS_KEY][container_id][vars.GENNET_NODES_KEY] = nodes
network_topology[vars.GENNET_ALL_CONTAINERS_KEY][container_id][vars.KURTOSIS_IP_KEY] = ip
network_topology[vars.GENNET_ALL_CONTAINERS_KEY][container_id][vars.KURTOSIS_IP_KEY] = ip


def get_connection_config(QoS, plan):
QoS_lst = QoS.split(":")
n = len(QoS_lst)
if n == 1:
if QoS_lst[0] == "None":
return kurtosis.connection.ALLOWED
elif QoS_lst[0] == "Block":
return kurtosis.connection.BLOCKED
else:
plan.print("Invalid QoS atom \"" + QoS_lst[0] + "\"")
plan.exit()
elif n == 3:
packet_loss_perc, dist, delay = float(QoS_lst[0]), QoS_lst[1], int(QoS_lst[2])
if dist == "Uniform":
return ConnectionConfig(packet_loss_perc, UniformPacketDelayDistribution(ms=delay))
else:
plan.print("Invalid QoS atom \"" + dist + "\"")
plan.exit()
elif n == 5:
packet_loss_perc, dist, mean = float(QoS_lst[0]), QoS_lst[1], int(QoS_lst[2])
jitter, corr = int(QoS_lst[3]), float(QoS_lst[4])
if dist == "Normal":
distri = NormalPacketDelayDistribution(
mean_ms=mean, std_dev_ms=jitter, correlation=corr)
return ConnectionConfig(packet_loss_perc, distri)
else:
plan.print("Invalid QoS atom \"" + dist + "\"")
plan.exit()
else:
plan.print("Invalid QoS spec \"" + QoS + "\"")
plan.exit()
2 changes: 1 addition & 1 deletion src/node_builders/types/waku_builder.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def _add_waku_port(network_topology, all_services_information, node_id, node_inf
(all_services_information[node_info[vars.GENNET_NODE_CONTAINER_KEY]].ports[
port_id].number,
all_services_information[node_info[vars.GENNET_NODE_CONTAINER_KEY]].ports[
port_id].transport_protocol)
port_id].transport_protocol)
4 changes: 4 additions & 0 deletions src/system_variables.star
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ GENNET_STATIC_NODES_KEY = "static_nodes"
GENNET_GOWAKU_IMAGE_VALUE = "go-waku"
GENNET_NWAKU_IMAGE_VALUE = "nim-waku"
GENNET_NOMOS_IMAGE_VALUE = "nomos"
GENNET_SUBNETS_KEY = "subnetworks"

GENNET_SUBNETS_QOS_UNIFORM = "Uniform"
GENNET_SUBNETS_QOS_NORMAL = "Normal"

PEER_ID_KEY = "peer_id"
IP_KEY = "ip_address"
Expand Down