Repository navigation
Expand file tree
/
Copy pathcp_both
More file actions
executable file
·91 lines (80 loc) · 3.58 KB
/
Copy pathcp_both
File metadata and controls
executable file
·91 lines (80 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/python3
# Copyright (c) 2024 Homa Developers
# SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0+
# This cperf benchmark runs both TCP and Homa on each client and server
# node in order to measure interference between the protocols.
# Type "cp_both --help" for documentation.
from cperf import *
parser = get_parser(description=
'Measures slowdown when TCP and Homa are competing for resources '
'on the same nodes.',
usage='%(prog)s [options]', defaults={'homa_gbps': 0})
parser.add_argument('--homa-gbps', type=float, dest='homa_gbps',
metavar='B', default=None,
help='Configure Homa to generate B Gbps of total outgoing bandwidth '
'on each node (clients and servers combined); the remainder of '
'--gbps will be generated by TCP (default: split --gbps between '
'Homa and TCP)')
options = parser.parse_args()
init(options)
# First, run the experiment
if not options.plot_only:
homa_options = copy.deepcopy(options)
homa_options.name = "homa_" + options.workload
homa_options.protocol = "homa"
tcp_options = copy.deepcopy(options)
tcp_options.name = "tcp_" + options.workload
tcp_options.protocol = "tcp"
if options.homa_gbps == None:
options.homa_gbps = options.gbps/2.0
tcp_options.gbps = (options.gbps - options.homa_gbps)/2
if tcp_options.gbps < 0:
tcp_options.gbps = 0
homa_options.gbps = options.gbps/2 - tcp_options.gbps
try:
run_experiments(homa_options, tcp_options)
except Exception as e:
log(traceback.format_exc())
log("Stopping nodes")
stop_nodes()
scan_logs()
# Generate plots and reports
homa_exp = "homa_" + options.workload
scan_metrics(homa_exp)
tcp_exp = "tcp_" + options.workload
scan_metrics(tcp_exp)
# Generate slowdown plot.
log("Generating slowdown plot for %s" % (options.workload))
title = "TCP (%.1f Gbps) and Homa (%.1f Gbps) together, %s, %d %s nodes" % (
options.gbps - options.homa_gbps, options.homa_gbps,
options.workload.capitalize(), options.num_nodes, get_node_type())
ax = start_plot_vs_msg_length(title, 1000, homa_exp)
plot_slowdown(ax, tcp_exp, "p99", "TCP P99", color=tcp_color)
plot_slowdown(ax, tcp_exp, "p50", "TCP P50", color=tcp_color2)
plot_slowdown(ax, homa_exp, "p99", "Homa P99", color=homa_color)
plot_slowdown(ax, homa_exp, "p50", "Homa P50", color=homa_color2)
ax.legend(loc="upper right", prop={'size': 9})
plt.tight_layout()
plt.savefig("%s/reports/both_%s.pdf" % (options.log_dir, options.workload))
# Generate latency plot.
log("Generating RTT latency plot for %s" % (options.workload))
ax = start_plot_vs_msg_length(title, [10, 10000], homa_exp,
y_label=r'RTT (µsec)')
plot_histogram(ax, tcp_exp, "p99", "TCP P99", color=tcp_color)
plot_histogram(ax, tcp_exp, "p50", "TCP P50", color=tcp_color2)
plot_histogram(ax, homa_exp, "p99", "Homa P99", color=homa_color)
plot_histogram(ax, homa_exp, "p50", "Homa P50", color=homa_color2)
ax.legend(loc="upper left", prop={'size': 9})
plt.tight_layout()
plt.savefig("%s/reports/rtt_%s.pdf" % (options.log_dir, options.workload))
# Generate CDF of small-message RTTs.
log("Generating short message CDF for %s" % (options.workload))
homa_x, homa_y = get_short_cdf(homa_exp)
tcp_x, tcp_y = get_short_cdf(tcp_exp)
start_cdf_plot(title, 10, 0.99e05, 1e-05, "RTT (usecs)",
"Cumulative Fraction Short Messages")
plt.plot(tcp_x, tcp_y, label="TCP", color=tcp_color)
plt.plot(homa_x, homa_y, label="Homa", color=homa_color)
plt.legend(loc="upper right", prop={'size': 9})
plt.savefig("%s/reports/short_cdf_%s.pdf" % (options.log_dir,
options.workload))