diff --git a/rln-delay-simulations/analyze.py b/rln-delay-simulations/analyze.py index fc74c14..6f240fb 100644 --- a/rln-delay-simulations/analyze.py +++ b/rln-delay-simulations/analyze.py @@ -9,6 +9,11 @@ latencies = [] with open(file, "r") as file: for line in file.readlines(): if field in line: + seq = int(line.strip().split("seq=")[1].split(" ")[0]) + # first message bias the latency due to tcp flow control + if seq in [0]: + continue + seq = line.strip().split("seq=")[1].split(" ")[0] x = line.strip().split(field)[1].split(" ")[0] latencies.append(int(x)) diff --git a/rln-delay-simulations/plot.py b/rln-delay-simulations/plot.py new file mode 100644 index 0000000..0ddfcb8 --- /dev/null +++ b/rln-delay-simulations/plot.py @@ -0,0 +1,55 @@ +import matplotlib.pyplot as plt +import scienceplots +import numpy as np +import math +import random + +def load(file): + field = "arrival_diff=" + latencies = [] + with open(file, "r") as file: + for line in file.readlines(): + if field in line: + x = line.strip().split(field)[1].split(" ")[0] + latencies.append(int(x)) + return np.array(latencies) + +latencies = [load("latency_10kb.txt"), load("latency_100kb.txt"), load("latency_500kb.txt")] + +with plt.style.context(['science', 'ieee']): + fig, ax = plt.subplots() + + labels = [] + + bp = ax.boxplot(latencies,notch=True, vert=True, patch_artist=True, + showfliers=True, whis=100000000000) + + for patch, color in zip(bp['boxes'], ['red', 'blue', 'green']): + patch.set_facecolor(color) + + ax.set(title="Message rate (msg/s)", xlabel='Scenario', ylabel='Message propagation time (ms)') + + ax.grid(linestyle='-') + my_legend = [] + for msg_size in [10, 100, 500]: + my_legend.append("Message size: " + str(msg_size) + " kB") + ax.legend([bp["boxes"][i] for i in range(len(my_legend))], my_legend, loc='upper left', fontsize=5) + + ax.autoscale(tight=False) + +#means = [i.mean(axis=0) for i in q] +#stds =[i.std(axis=0) for i in q] +#per_95 = [np.percentile(i, 95) for i in q] +#for i, line in enumerate(bp['medians']): +# x, y = line.get_xydata()[1] +# text = r' $ \mu =$ ' + '{:.2f}\n'.format(means[i]) + r' $ p_{95} = $ ' + '{:.2f}'.format(per_95[i]) +# ax.annotate(text, xy=(x+0.1, y), fontsize=6) +# +# + +for i, line in enumerate(bp['medians']): + x, y = line.get_xydata()[1] + text = r' $ \mu =$ ' + '{:.0f} ms\n'.format(latencies[i].mean(axis=0)) + r' $ p_{95} = $ ' + '{:.0f} ms'.format(np.percentile(latencies[i], 95)) + ax.annotate(text, xy=(x + 0.1, y), fontsize=6) + +fig.savefig('plot.jpg', dpi=600) \ No newline at end of file diff --git a/rln-delay-simulations/shadow.yaml b/rln-delay-simulations/shadow.yaml index 154d58c..fc22e37 100644 --- a/rln-delay-simulations/shadow.yaml +++ b/rln-delay-simulations/shadow.yaml @@ -1,7 +1,7 @@ general: bootstrap_end_time: 30s heartbeat_interval: 12s - stop_time: 4m + stop_time: 10m progress: true experimental: @@ -40,7 +40,7 @@ hosts: --rln-relay-membership-index=0 --nat=extip:0.0.0.0 start_time: 5s - environment: {"PEERS": "1000", "CONNECTTO": "50", "NUMPUBLISHERS": "5", "MSGSIZEKBYTES": "1"} + environment: {"PEERS": "1000", "CONNECTTO": "50", "NUMPUBLISHERS": "1", "MSGSIZEKBYTES": "10"} peer2: *client_host peer3: *client_host peer4: *client_host