Repository navigation
Expand file tree
/
Copy pathcp_bench
More file actions
executable file
·648 lines (628 loc) · 26.6 KB
/
Copy pathcp_bench
File metadata and controls
executable file
·648 lines (628 loc) · 26.6 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
#!/usr/bin/python3
# Copyright (c) 2020-2026 Homa Developers
# SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0+
# This cperf benchmark measures Homa slowdown while varying one or more
# aspects of Homa's configuration (such as duty cycle).
# Type "cp_bench --help" for documentation.
from cperf import *
from switch import *
load_info = [["w2", 3.2, 5], ["w3", 14, 10], ["w4", 20, 20], ["w5", 20, 30]]
parser = get_parser(description=
'Run one of several different benchmarks and collect performance data.',
usage='%(prog)s [options]')
parser.add_argument('-B', '--benchmark', dest='config', default='homa',
choices=['balance', 'both', 'both_balance', 'both_pacer', 'both_qdisc',
'buffers', 'busy_usecs', 'client_threads', 'dctcp',
'dctcp_buffers', 'defer_min_bytes', 'fifo', 'gbps',
'gen2', 'gen3', 'grant_policy', 'gro_busy_usecs',
'homa', 'homa_vs_tcp', 'load',
'max_gro', 'max_gso', 'max_incoming', 'mtu', 'nic_backlog',
'nic_queue', 'nodes', 'pacer', 'poll', 'ports', 'prios',
'receivers', 'repeat', 'tcp', 'tcp_buffers', 'tcp_nodes',
'tcp_qdisc', 'time', 'unsched_bytes', 'window'],
help='Benchmark to run (default: homa)')
options = parser.parse_args()
init(options)
if options.workload != "":
load_info = [[options.workload, options.gbps, options.seconds]]
# If set to a non-None value by a benchmark then both Homa and TCP are run
# simultaneously; the value will determine the fraction of the total load
# generated by Homa; the remainder of the load will be generated by TCP.
both_homa_frac = None
# Maximum y-coordinate: modified by some benchmarks below.
plot_max_y = 1000
# Set by benchmarks below to describe experiments to run.
specs = []
# One entry for each distinct plot file that should be generated. Entries
# have one of the following forms:
# rtt file curves
# slowdown file curves
# short_cdf file curves
#
# In each case "file" is the name of the output file. For "rtt and "slowdown",
# curves is a list of [exp, label, color, pctl]:
# exp: name of the experiment to plot
# label: label for the curve in the key
# color: color to use for the curve (None means choose default)
# pctl: "p50", "p99", or "p999" describing which percentile to plot
# For "short_cdf" curves is a list of [exp, label, color], with the same
# meanings as above.
#
# If a benchmark doesn't fill this in explicitly, a default set of plots
# will be produced.
plots = []
workload = options.workload
bw = options.gbps
seconds = options.seconds
if options.config == 'balance':
# Vary the load balancing policy
specs.append({'exp_name': 'gen2default',
'label': 'Gen2 Default',
'lb': 'xl170_default'
})
specs.append({'exp_name': 'gen2',
'label': 'Gen2',
'lb': 'gen2'
})
specs.append({'exp_name': 'gen3',
'label': 'Gen3',
'lb': 'gen3'
})
specs.append({'exp_name': 'gen3_alt',
'label': 'Gen3 Alt',
'lb': 'gen3_alt'
})
elif options.config == 'both':
# Generate graphs showing the impact of running TCP and Homa alone and
# together, with the pacer and with homa_qdisc.
specs.append({'exp_name': 'homa_pacer',
'no_qdisc': True
})
specs.append({'exp_name': 'tcp_pacer',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
specs.append({'exp_name': 'both_pacer',
'both_homa_frac': 0.5,
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
specs.append({'exp_name': 'homa_qdisc'})
specs.append({'exp_name': 'tcp_qdisc',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic']
})
specs.append({'exp_name': 'both_qdisc',
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'both_homa_frac': 0.5
})
curves = [
["tcp_pacer_%s" % workload, "TCP P99 alone", tcp_color, "p99"],
["both_pacer_%s_tcp" % workload, "TCP P99 conc", tcp_color2, "p99"],
["homa_pacer_%s" % workload, "Homa P99 alone", homa_color, "p99"],
["both_pacer_%s_homa" % workload, "Homa P99 conc", homa_color2, "p99"]
]
plots.append(["rtt", "%s/reports/pacer_%s_rtt.pdf" %
(options.log_dir, workload), curves])
curves = [
["tcp_pacer_%s" % workload, "TCP P99 alone", tcp_color, "p99"],
["both_qdisc_%s_tcp" % workload, "TCP P99 conc", tcp_color2, "p99"],
["homa_qdisc_%s" % workload, "Homa P99 alone", homa_color, "p99"],
["both_qdisc_%s_homa" % workload, "Homa P99 conc", homa_color2, "p99"]
]
plots.append(["rtt", "%s/reports/qdisc_%s_rtt.pdf" %
(options.log_dir, workload), curves])
curves = [
["tcp_pacer_%s" % workload, "TCP P99", tcp_color, "p99"],
["tcp_qdisc_%s" % workload, "TCP P99 qdisc", homa_color, "p99"],
["tcp_pacer_%s" % workload, "TCP P50", tcp_color2, "p50"],
["tcp_qdisc_%s" % workload, "TCP P50 qdisc", homa_color2, "p50"]
]
plots.append(["rtt", "%s/reports/tcp_%s_rtt.pdf" %
(options.log_dir, workload), curves])
elif options.config == 'both_balance':
# Vary the distribution of workload between Homa and TCP when both
# protocols run together.
curves = []
for id in [8, 6, 4, 2]:
homa_frac = id/10
specs.append({'exp_name': 'both%d' % (id),
'both_homa_frac': homa_frac,
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic']
})
curves.append(["both%d_%s_tcp" % (id, workload),
"TCP P99 (Homa frac %3.1f)" % (homa_frac), None, "p99"])
for id in [2, 4, 6, 8]:
homa_frac = id/10
curves.append(["both%d_%s_homa" % (id, workload),
"Homa P99 (Homa frac %3.1f)" % (homa_frac), None, "p99"])
plots.append(["rtt", "%s/reports/both_%s_rtt.pdf" %
(options.log_dir, workload), curves])
elif options.config == 'both_pacer':
specs.append({'exp_name': 'both_pacer',
'both_homa_frac': 0.5,
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
curves = [
["both_pacer_%s_tcp" % workload, "TCP P99", tcp_color, "p99"],
["both_pacer_%s_tcp" % workload, "TCP P50", tcp_color2, "p50"],
["both_pacer_%s_homa" % workload, "Homa P99", homa_color, "p99"],
["both_pacer_%s_homa" % workload, "Homa P50", homa_color2, "p50"]
]
plots.append(["rtt", "%s/reports/both_pacer_%s_rtt.pdf" %
(options.log_dir, workload), curves])
elif options.config == 'both_qdisc':
# Run Homa and TCP simultaneously under the control of homa_qdisc.
specs.append({'exp_name': 'both_qdisc',
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'both_homa_frac': 0.5
})
curves = [
["both_qdisc_%s_tcp" % workload, "TCP P99", tcp_color, "p99"],
["both_qdisc_%s_tcp" % workload, "TCP P50", tcp_color2, "p50"],
["both_qdisc_%s_homa" % workload, "Homa P99", homa_color, "p99"],
["both_qdisc_%s_homa" % workload, "Homa P50", homa_color2, "p50"]
]
plots.append(["rtt", "%s/reports/both_qdisc_%s_rtt.pdf" %
(options.log_dir, workload), curves])
elif options.config == 'buffers':
# Vary the amount of buffer space in the switch
if not options.workload:
load_info = [["w3", 14, 10], ["w4", 20, 20], ["w5", 20, 60]]
# Specs will be filled in below (they are workload dependent).
for mb in [10, 2.5, 2]:
specs.append({'exp_name': 'bufs_%.1fM' % (mb),
'label': '%.1f MB' % (mb),
'switch_buffer': mb})
elif options.config == 'busy_usecs':
# Vary the time threshold for considering a core busy and trying
# to schedule work elsewhere
for usecs in [0, 10, 20, 50, 100, 200]:
specs.append({'exp_name': 'busy_%d' % (usecs),
'label': 'busy_usecs %d' % (usecs),
'sysctl': ['.net.homa.busy_usecs', usecs]
})
elif options.config == 'client_threads':
# Vary the client thread configuration
for ports, receivers in [[3, 2], [3, 3], [3, 4], [2, 3], [2, 4], [1, 5]]:
name = "%d ports %d rcvrs" % (ports, receivers)
specs.append({'exp_name': "p%dr%d" % (ports, receivers),
'label': "%d ports %d rcvrs" % (ports, receivers),
'options': ['client_ports', ports,
'port_receivers', receivers]
})
elif options.config == 'dctcp':
# Basic test of TCP latency
specs.append({'exp_name': 'dctcp',
'label': 'DCTCP',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'dctcp'],
'no_qdisc': True
})
elif options.config == 'dctcp_buffers':
# Use DCTCP, vary the amount of buffer space in the switch
if not options.workload:
load_info = [["w3", 14, 10], ["w4", 20, 20], ["w5", 20, 60]]
plot_max_y = 10000
for mb in [10, 1.2, 0.7]:
specs.append({'exp_name': 'bufs_%.1fM' % (mb),
'label': '%.1f MB' % (mb),
'options': ['protocol', 'dctcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'dctcp'],
'switch_buffer': mb})
elif options.config == 'defer_min_bytes':
# Vary the fraction of bandwidth reserved for the oldest message
for value in [1000, 3000, 10000]:
specs.append({'exp_name': 'defer_%d' % (value),
'label': 'defer_min_bytes %d' % (value),
'sysctl': ['.net.homa.defer_min_bytes', value]})
elif options.config == 'fifo':
# Vary the fraction of bandwidth reserved for the oldest message
for fifo in [0, 5, 10, 20]:
specs.append({'exp_name': 'fifo_%d' % (fifo),
'label': '%d%% FIFO' % (fifo),
'sysctl': ['.net.homa.grant_fifo_fraction', fifo*10,
'.net.homa.pacer_fifo_fraction', fifo*10]})
elif options.config == 'gbps':
# Vary the assumed link speed to increase headroom for the pacer
# to avoid overcommitting the uplink.
for gbps in [26, 25, 24, 23]:
specs.append({'exp_name': 'gpbs_%d' % (gbps),
'label': '%d Gbps' % (gbps),
'sysctl': ['.net.homa.link_mbps', gbps*1000]
})
elif options.config == 'gen2':
# Try multiple variants of the Gen2 load balancing policy
specs.append({'exp_name': 'gen2default',
'label': 'Gen2 Default',
'sysctl': ['.net.homa.gro_policy', 82],
'rss': 'xl170_default'
})
specs.append({'exp_name': 'gen2',
'label': 'Gen2',
'sysctl': ['.net.homa.gro_policy', 16],
'rss': 'gen2'
})
specs.append({'exp_name': 'gen2bypass',
'label': 'Gen2+Bypass',
'sysctl': ['.net.homa.gro_policy', 82],
'rss': 'gen2'
})
elif options.config == 'gen3':
# Try multiple variants of the Gen3 load balancing policy
specs.append({'exp_name': 'gen3',
'label': 'Gen3',
'sysctl': ['.net.homa.gro_policy', 128+66],
'rss': 'gen3'
})
specs.append({'exp_name': 'gen3nobypass',
'label': 'Gen3-Bypass',
'sysctl': ['.net.homa.gro_policy', 128+66],
'rss': 'gen3'
})
specs.append({'exp_name': 'gen3noshortbypass',
'label': 'Gen3-ShortBypass',
'sysctl': ['.net.homa.gro_policy', 128+64],
'rss': 'gen3'
})
specs.append({'exp_name': 'gen3_alt',
'label': 'Gen3 Alt',
'sysctl': ['.net.homa.gro_policy', 128+66],
'rss': 'gen3_alt'
})
elif options.config == 'grant_policy':
# Try different ways of computing grant sizes (window and max_incoming)
specs.append({'exp_name': 'default',
'label': 'default'})
for max_incoming in [500]:
specs.append({'exp_name': 'max_%d' % (max_incoming),
'label': 'max_incoming %dK' % (max_incoming),
'sysctl': ['.net.homa.window', 0,
'.net.homa.max_incoming', max_incoming*1000]})
elif options.config == 'gro':
# Vary the GRO policy
specs.append({'exp_name': 'gen2default',
'label': 'Gen2 Default',
'sysctl': ['.net.homa.gro_policy', 82],
'rss': 'xl170_default'
})
elif options.config == 'homa':
# Basic test of Homa latency
specs.append({'exp_name': 'homa',
'label': 'Homa'})
elif options.config == 'homa_vs_tcp':
specs.append({'exp_name': 'homa'})
specs.append({'exp_name': 'tcp',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
curves = [
["tcp_%s" % workload, "TCP P99", tcp_color, "p99"],
["tcp_%s" % workload, "TCP P50", tcp_color2, "p50"],
["homa_%s" % workload, "Homa P99", homa_color, "p99"],
["homa_%s" % workload, "Homa P50", homa_color2, "p50"],
]
plots.append(["rtt", "%s/reports/%s_%s_rtt.pdf" %
(options.log_dir, options.config, workload), curves])
plots.append(["slowdown", "%s/reports/%s_%s_slow.pdf" %
(options.log_dir, options.config, workload), curves])
cdf_curves = [
["tcp_%s" % workload, "TCP", tcp_color],
["homa_%s" % workload, "Homa", homa_color]
]
plots.append(["short_cdf", "%s/reports/%s_%s_cdf.pdf" %
(options.log_dir, options.config, workload), cdf_curves])
elif options.config == 'load':
# Vary the network utilization.
for gbps in [30, 40, 50, 60, 70]:
name = "gbps%d" % (gbps)
specs.append({'exp_name': name,
'label': '%d Gbps' % (gbps),
'options': ['gbps', gbps/2]
})
elif options.config == 'max_gro':
# Vary the number of skbs processed at once by GRO before forwarding
# to SoftIRQ
for count in [5, 10, 20, 100]:
specs.append({'exp_name': 'max_gro_%d' % (count),
'label': 'max_gro_skbs %d' % (count),
'sysctl': ['.net.homa.max_gro_skbs', count]
})
elif options.config == 'max_gso':
# Vary the max_gso_size configuration parameter
for count in [5000, 10000, 20000, 50000, 100000]:
specs.append({'exp_name': 'max_gso_%d' % (count),
'label': 'max_gso_size %d' % (count),
'sysctl': ['.net.homa.max_gso_size', count]
})
elif options.config == 'max_incoming':
# Vary the max_incoming configuration parameter
for count in [200000, 400000, 800000, 1600000]:
specs.append({'exp_name': 'max_gso_%d' % (count/1000),
'label': 'max_incoming %d KB' % (count/1000),
'sysctl': ['.net.homa.max_incoming', count]
})
elif options.config == 'mtu':
# Vary the maximum packet size
for length in [1500, 3000, 5000, 7000, 9000]:
specs.append({'exp_name': 'mtu_%d' % (length),
'label': 'MTU %d' % (length),
'mtu': length
})
elif options.config == 'nic_backlog':
# Vary the limit on estimated NIC queue length
for micros in [5, 10, 20, 100, 10000]:
specs.append({'exp_name': 'nic_%d' % (micros),
'label': 'est. nic queue %d us' % (micros),
'sysctl': ['.net.homa.max_nic_est_backlog_usecs', micros]
})
elif options.config == 'nic_queue':
# Vary the limit on actual bytes pending with NIC
for micros in [10, 20, 40, 80, 200]:
specs.append({'exp_name': 'nicq_%d' % (micros),
'label': 'nic pending %d us' % (micros),
'sysctl': ['.net.homa.max_nic_queue_usecs', micros]
})
elif options.config == 'nodes':
# Vary the numbers of nodes in the experiment
for nodes in [10, 20, 30, 40, 50]:
specs.append({'exp_name': 'nodes%d' % (nodes),
'label': '%d nodes' % (nodes),
'options': ['num_nodes', nodes]
})
elif options.config == 'pacer':
# Run Homa with the old pacer instead of homa_qdisc
specs.append({'exp_name': 'homa',
'label': 'Homa',
'no_qdisc': True})
elif options.config == 'poll':
# Vary the polling interval
for poll in [0, 20, 30, 40, 50]:
specs.append({'exp_name': 'poll_%d' % (poll),
'label': 'poll %d us' % (poll),
'sysctl': ['.net.homa.poll_usecs', poll]
})
elif options.config == 'ports':
# Vary the numbers of server and client ports
for client, server in [[2, 2], [2, 3], [2, 4], [3, 3], [3, 2], [4, 2]]:
name = "s%dc%d" % (server, client)
specs.append({'exp_name': name,
'label': name,
'options': ['server_ports', server,
'client_ports', client]
})
elif options.config == 'prios':
# Vary the number of available priority levels
for priority in [1, 2, 3, 8]:
specs.append({'exp_name': 'prios_%d' % (priority),
'label': '%d prios' % (priority),
'sysctl': ['.net.homa.num_priorities', priority]})
elif options.config == 'receivers':
# Vary the numbers of receiving threads per port on both client and server
for threads in [2, 3, 4, 5]:
specs.append({'exp_name': 'rcvrs_%d' % (threads),
'label': '%d rcv threads' % (threads),
'options': ['port_receivers', threads,
'port_threads', threads]
})
elif options.config == 'repeat':
# Runs the same test multiple times to test repeatability; must setup
# the configuration by hand before running experiment.
for i in range(1,6):
specs.append({'exp_name': 'run%d' % (i),
'label': 'Run %d' % (i)
})
elif options.config == 'tcp':
# Basic test of TCP latency
specs.append({'exp_name': 'tcp',
'label': 'TCP',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
elif options.config == 'tcp_buffers':
# Use TCP, vary the amount of buffer space in the switch
if not options.workload:
load_info = [["w3", 14, 10], ["w4", 20, 20], ["w5", 20, 60]]
plot_max_y = 10000
for mb in [13.2, 8, 3]:
specs.append({'exp_name': 'bufs_%.1fM' % (mb),
'label': '%.1f MB' % (mb),
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'switch_buffer': mb})
elif options.config == 'tcp_nodes':
# Measure TCP with varying numbers of nodes.
for nodes in [50, 40, 30, 20, 10]:
specs.append({'exp_name': 'tcp%dnodes' % (nodes),
'label': '%d nodes' % (nodes),
'options': ['protocol', 'tcp',
'num_nodes', nodes],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic'],
'no_qdisc': True
})
elif options.config == 'tcp_qdisc':
# Basic test of TCP latency but don't do anything to change the qdisc
# (presumably this will leave homa_qdisc in place).
specs.append({'exp_name': 'tcp_qdisc',
'label': 'TCP',
'options': ['protocol', 'tcp'],
'sysctl': ['.net.ipv4.tcp_congestion_control', 'cubic']
})
elif options.config == 'time':
# Vary the experiment running time
for seconds in [10, 20, 30, 50, 100]:
specs.append({'exp_name': "secs%d" % (seconds),
'label': "%d seconds" % (seconds),
'options': ['seconds', seconds]
})
elif options.config == 'unsched_bytes':
# Vary unsched_bytes
for unsched in [40, 60, 80, 100, 120]:
specs.append({'exp_name': 'unsched_%dk' % (unsched),
'label': 'unsched_bytes %dk' % (unsched),
'sysctl': ['.net.homa.unsched_bytes', unsched*1000]
})
elif options.config == 'window':
# Vary the size of the grant window
for value in [0, 200]:
specs.append({'exp_name': "win%d" % (value),
'label': "window %d" % (value),
'sysctl': ['.net.homa.window', value*1000]
})
# Keys are parameter names, values are old values to restore.
old_values = {}
switch = None
if not options.plot_only:
# Run the requested experiments.
if options.config == 'buffers':
if workload == "w5":
mbs = [10, 2.5, 2]
else:
mbs = [10, 2.0, 1]
specs = []
for mb in mbs:
specs.append({'exp_name': 'bufs_%.1fM' % (mb),
'label': '%.1f MB' % (mb),
'switch_buffer': mb})
for spec in specs:
o = copy.deepcopy(options)
o.workload = workload
o.gbps = bw/2.0
o.seconds = seconds
exp_name = "%s_%s" % (spec['exp_name'], workload)
if 'sysctl' in spec:
for i in range(0, len(spec['sysctl']), 2):
name = spec['sysctl'][i]
value = spec['sysctl'][i+1]
if name in old_values:
old_value = old_values[name]
else:
old_value = get_sysctl_parameter(name, options.nodes[0])
if value != old_value:
old_values[name] = old_value
log("Setting %s = %s" % (name, value))
set_sysctl_parameter(name, value, options.nodes)
if 'options' in spec:
for i in range(0, len(spec['options']), 2):
name = spec['options'][i]
value = spec['options'][i+1]
setattr(o, name, value)
if 'switch_buffer' in spec:
if not switch:
switch = Switch()
mb = spec['switch_buffer']
log("Setting buffer limit to %.1f MB" % (mb))
switch.set_buffer_limit(mb)
if 'mtu' in spec:
log("Setting mtu to %d" % spec['mtu'])
do_ssh(["config", "mtu", str(spec['mtu'])], options.nodes)
if 'lb' in spec:
do_ssh(["config", "lb", spec['lb']], options.nodes)
if 'no_qdisc' in spec:
log("Disabling homa_qdisc")
do_ssh(["config", "reset_qdisc"], options.nodes)
# Choose nodes again, in case options related to node choice were
# changed.
choose_nodes(o)
try:
if not "both_homa_frac" in spec:
o.name = exp_name
run_experiments(o)
else:
homa_frac = spec["both_homa_frac"]
homa_options = copy.deepcopy(o)
homa_options.name = exp_name + "_homa"
homa_options.protocol = "homa"
homa_options.gbps = o.gbps * homa_frac
tcp_options = copy.deepcopy(o)
tcp_options.name = exp_name + "_tcp"
tcp_options.protocol = "tcp"
tcp_options.gbps = o.gbps * (1 - homa_frac)
run_experiments(homa_options, tcp_options)
except Exception as e:
log(traceback.format_exc())
while old_values:
name, value = old_values.popitem()
print("Restoring %s to %s" % (name, value))
set_sysctl_parameter(name, value, options.nodes)
if 'no_qdisc' in spec:
log("Re-enabling homa_qdisc")
do_ssh(["config", "qdisc"], options.nodes)
log("Stopping nodes")
stop_nodes()
scan_logs()
if switch:
log("Resetting buffer limit to 13.2 MB")
switch.set_buffer_limit(13.2)
switch.close
switch = None
# Generate plots and reports
if not plots:
# Generate default plots from info in specs
curves = []
for spec in specs:
curves.append(["%s_%s" % (spec['exp_name'], workload),
spec['label'] + ' P99',
spec['colors'][1] if 'colors' in spec else None,
"p99"])
for spec in specs:
curves.append(["%s_%s" % (spec['exp_name'], workload),
spec['label'] + ' P50',
spec['colors'][0] if 'colors' in spec else None,
"p50"])
plots.append(["slowdown", "%s/reports/%s_%s_slow.pdf" %
(options.log_dir, options.config, workload), curves])
plots.append(["rtt", "%s/reports/%s_%s_rtt.pdf" %
(options.log_dir, options.config, workload), curves])
curves = []
for spec in specs:
curves.append(["%s_%s" % (spec['exp_name'], workload),
spec['label'],
spec['colors'][1] if 'colors' in spec else None])
plots.append(["short_cdf", "%s/reports/%s_%s_cdfs.pdf" %
(options.log_dir, options.config, workload), curves])
for plot in plots:
type = plot[0]
if type == 'rtt':
log("Generating rtt latency plot for %s" % (workload))
file, curves = plot[1:3]
title = "%s, %d %s nodes, %.1f Gbps" % (workload.capitalize(),
options.num_nodes, get_node_type(), bw)
ax = start_plot_vs_msg_length(title, [10, 10000], curves[0][0],
y_label=r'RTT (µsec)')
for exp, label, color, p in curves:
plot_histogram(ax, exp, p, label, color=color)
ax.legend(loc="upper left", prop={'size': 9})
plt.tight_layout()
plt.savefig(file)
elif type == 'slowdown':
log("Generating slowdown plot for %s" % (workload))
file, curves = plot[1:3]
title = "%s, %d %s nodes, %.1f Gbps" % (workload.capitalize(),
options.num_nodes, get_node_type(), bw)
ax = start_plot_vs_msg_length(title, plot_max_y, curves[0][0],
y_label=" Slowdown")
for exp, label, color, p in curves:
plot_slowdown(ax, exp, p, label, color=color)
if workload == "w5":
ax.legend(loc="upper right", prop={'size': 9})
else:
ax.legend(loc="upper left", prop={'size': 9})
plt.tight_layout()
plt.savefig(file)
elif type == 'short_cdf':
log("Generating short message CDFs for %s" % (workload))
file, curves = plot[1:3]
title = "%s, %d %s nodes" % (workload.capitalize(), options.num_nodes,
get_node_type())
start_cdf_plot(title, 10, 0.99e05, 1e-05, "RTT (usecs)",
"Cumulative Fraction of Short Messages")
for exp, label, color in curves:
x, y = get_short_cdf(exp)
plt.plot(x, y, label=label, color=color)
plt.legend(loc="upper right", prop={'size': 9})
plt.savefig(file)