Author SHA1 Message Date
ufarooqstatus 212933a4af GossipSub shadow simulation scripts 2023-09-28 01:10:36 +05:00
4 changed files with 13 additions and 52 deletions
+8 -7
View File
@@ -8,13 +8,14 @@
```sh ```sh
nimble install -dy nimble install -dy
cd shadow cd shadow
./run.sh x n # the default shadow.yml will start 5k nodes, you might want to change that by removing
# The run.sh file runs the simulation "x" number of times and every simulation run uses "n" number of nodes # lines and setting PEERS to the number of instances
# The number of nodes is maintained in the shadow.yaml file, and automatically updated by run.sh. ./run.sh <runs> <nodes>
# The output files latencies(x), stats(x) and shadowlog(x) carries the outputs for each simulation run. # the first parameter <runs> tells the number of simulation runs, and second parameter <nodes> tells the
# The summary_dontwant.awk, summary_latency.awk, and summary_shadowlog.awk parse the output files. # number of nodes in simulation, for example ./run.sh 2 3000
# The run.sh script automatically calls these files to display the output # the output for each run creates latencies(X) and shadowlogX files. where X is the simulation number.
# a temperary data.shadow folder is created for each simulation and removed by the run.sh after the simulation is over
# the run script (run.sh) uses awk to summarize latencies(X) and shadowlogX files
# you can use the plotter tool to extract useful metrics & generate a graph # you can use the plotter tool to extract useful metrics & generate a graph
cd ../tools cd ../tools
+3 -10
View File
@@ -1,6 +1,6 @@
import stew/endians2, stew/byteutils, tables, strutils, os import stew/endians2, stew/byteutils, tables, strutils, os
import ../../nim-libp2p/libp2p, ../../nim-libp2p/libp2p/protocols/pubsub/rpc/messages import libp2p, libp2p/protocols/pubsub/rpc/messages
import ../../nim-libp2p/libp2p/muxers/mplex/lpchannel, ../../nim-libp2p/libp2p/protocols/ping import libp2p/muxers/mplex/lpchannel, libp2p/protocols/ping
import chronos import chronos
import sequtils, hashes, math, metrics import sequtils, hashes, math, metrics
from times import getTime, toUnix, fromUnix, `-`, initTime, `$`, inMilliseconds from times import getTime, toUnix, fromUnix, `-`, initTime, `$`, inMilliseconds
@@ -156,12 +156,5 @@ proc main {.async.} =
#echo "BW: ", libp2p_protocols_bytes.value(labelValues=["/meshsub/1.1.0", "in"]) + libp2p_protocols_bytes.value(labelValues=["/meshsub/1.1.0", "out"]) #echo "BW: ", libp2p_protocols_bytes.value(labelValues=["/meshsub/1.1.0", "in"]) + libp2p_protocols_bytes.value(labelValues=["/meshsub/1.1.0", "out"])
#echo "DUPS: ", libp2p_gossipsub_duplicate.value(), " / ", libp2p_gossipsub_received.value() #echo "DUPS: ", libp2p_gossipsub_duplicate.value(), " / ", libp2p_gossipsub_received.value()
#requires exporting counters from GossipSub.nim
echo "statcounters: dup_during_validation ", libp2p_gossipsub_duplicate_during_validation.value(),
"\tidontwant_saves ", libp2p_gossipsub_idontwant_saved_messages.value(),
#"gossip optimization saves ", libp2p_gossipsub_saved_bytes.value(),
"\tdup_received ", libp2p_gossipsub_duplicate.value(),
"\tUnique_msg_received ", libp2p_gossipsub_received.value(),
"\tStaggered_Saves ", libp2p_gossipsub_staggerSave.value(),
"\tDontWant_IN_Stagger ", libp2p_gossipsub_staggerDontWantSave.value()
waitFor(main()) waitFor(main())
+2 -5
View File
@@ -17,14 +17,12 @@ while [ $counter -le $nodes ]; do
counter=$((counter + 1)) counter=$((counter + 1))
done done
rm -f shadowlog* latencies* stats* main && rm -rf shadow.data/ rm -f shadowlog* latencies* main && rm -rf shadow.data/
nim c -d:chronicles_colors=None --threads:on -d:metrics -d:libp2p_network_protocols_metrics -d:release main nim c -d:chronicles_colors=None --threads:on -d:metrics -d:libp2p_network_protocols_metrics -d:release main
for i in $(seq $runs); do for i in $(seq $runs); do
echo "Running for turn "$i echo "Running for turn "$i
shadow shadow.yaml > shadowlog$i && shadow shadow.yaml > shadowlog$i && grep -rne 'milliseconds\|BW' shadow.data/ > latencies$i
grep -rne 'milliseconds\|BW' shadow.data/ > latencies$i &&
grep -rne 'statcounters:' shadow.data/ > stats$i
rm -rf shadow.data/ rm -rf shadow.data/
done done
@@ -32,5 +30,4 @@ for i in $(seq $runs); do
echo "Summary for turn "$i echo "Summary for turn "$i
awk -f summary_latency.awk latencies$i awk -f summary_latency.awk latencies$i
awk -f summary_shadowlog.awk shadowlog$i awk -f summary_shadowlog.awk shadowlog$i
awk -f summary_dontwant.awk stats$i
done done
-30
View File
@@ -1,30 +0,0 @@
BEGIN {
FS = " "; #default column separator
idontwant_saves = min_idontwant = max_idontwant = 0;
dup_received = min_dup = max_dup = 0;
unique_msg_received = 0;
stagger_saves = 0;
stagger_DontWantSaves = 0;
}
{
#print $5, $7, $9
idontwant_saves += $5
if ($5 < min_idontwant || min_idontwant == 0) min_idontwant = $5
if ($5 > max_idontwant) max_idontwant = $5
dup_received += $7
if ($7 < min_dup || min_dup == 0) min_dup = $7
if ($7 > max_dup) max_dup = $7
unique_msg_received += $9
stagger_saves += $11
stagger_DontWantSaves += $13
}
END {
print "idontwant_saves min, max, avg, total : ", min_idontwant, "\t", max_idontwant, "\t", idontwant_saves/NR, "\t", idontwant_saves
print "dup_received min, max, avg, total : ", min_dup, "\t", max_dup, "\t", dup_received/NR, "\t", dup_received
print "Unique_msg_received: ", unique_msg_received, "\tStagger Saves : ", stagger_saves, "\tStaggerDontWantSaves", stagger_DontWantSaves
}