Skip to content

Commit 07441b9

Browse files
dPhanekhambvliu
andcommitted
Add netperf UDP stream test (#2075)
* add UDP_STREAM and send size flags * add flags and UDP_STREAM and pep fixes * remove debug statements * add flag to container_netperf * added UDP STREAM results to tests * add -M flag * remove unnecessary line * add comment justifying default size * change to not in * add upper and lower bounds to UDP send size * revised comment * remove -R 1 flag for TCP_STREAM, it is implicit * remove line Co-authored-by: Brandon Liu <[email protected]>
1 parent a0c9c82 commit 07441b9

File tree

5 files changed

+55
-12
lines changed

5 files changed

+55
-12
lines changed

CHANGES.next.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@
159159
- Added AWS DAX provider.
160160
- Added Google Cloud Firestore ycsb benchmarks.
161161
- Added support for un-managed data processing yarn cluster benchmarking.
162+
- Added support for UDP_STREAM tests to netperf_benchmark
163+
- Added flags to select stream size to netperf_benchmark
162164
- Added placement group flag support for Azure. "cluster" will create proximity placement group.
163165
"spread" will create an availability set.
164166
- Added a tcpdump collector with --tcpdump flag.

perfkitbenchmarker/linux_benchmarks/container_netperf_benchmark.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727

2828
FLAGS = flags.FLAGS
2929

30+
# We set the default to 128KB (131072 bytes) to override the Linux default
31+
# of 16K so that we can achieve the "link rate".
32+
flags.DEFINE_integer('container_netperf_tcp_stream_send_size_in_bytes', 131072,
33+
'Send size to use for TCP_STREAM tests (netperf -m flag)')
34+
3035
BENCHMARK_NAME = 'container_netperf'
3136
BENCHMARK_CONFIG = """
3237
container_netperf:
@@ -87,6 +92,7 @@ def Run(benchmark_spec):
8792
'-H', container_0.ip_address,
8893
'-l', '100',
8994
'--',
95+
'-m', FLAGS.container_netperf_tcp_stream_send_size_in_bytes,
9096
'-o', netperf_benchmark.OUTPUT_SELECTOR]
9197
cluster.DeployContainer('netperf', benchmark_spec.container_specs['netperf'])
9298
container_1 = cluster.containers['netperf'][1]

perfkitbenchmarker/linux_benchmarks/netperf_benchmark.py

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,15 @@
6565
flags.DEFINE_integer('netperf_thinktime_run_length', 0,
6666
'The number of contiguous numbers to sum at a time in the '
6767
'thinktime array.')
68-
69-
ALL_BENCHMARKS = ['TCP_RR', 'TCP_CRR', 'TCP_STREAM', 'UDP_RR']
68+
flags.DEFINE_integer('netperf_udp_stream_send_size_in_bytes', 1024,
69+
'Send size to use for UDP_STREAM tests (netperf -m flag)',
70+
lower_bound=1, upper_bound=65507)
71+
# We set the default to 128KB (131072 bytes) to override the Linux default
72+
# of 16K so that we can achieve the "link rate".
73+
flags.DEFINE_integer('netperf_tcp_stream_send_size_in_bytes', 131072,
74+
'Send size to use for TCP_STREAM tests (netperf -m flag)')
75+
76+
ALL_BENCHMARKS = ['TCP_RR', 'TCP_CRR', 'TCP_STREAM', 'UDP_RR', 'UDP_STREAM']
7077
flags.DEFINE_list('netperf_benchmarks', ALL_BENCHMARKS,
7178
'The netperf benchmark(s) to run.')
7279
flags.register_validator(
@@ -78,7 +85,7 @@
7885
BENCHMARK_NAME = 'netperf'
7986
BENCHMARK_CONFIG = """
8087
netperf:
81-
description: Run TCP_RR, TCP_CRR, UDP_RR and TCP_STREAM
88+
description: Run TCP_RR, TCP_CRR, UDP_RR, TCP_STREAM and UDP_STREAM
8289
vm_groups:
8390
vm_1:
8491
vm_spec: *default_single_core
@@ -355,8 +362,8 @@ def RunNetperf(vm, benchmark_name, server_ip, num_streams):
355362
"""
356363
enable_latency_histograms = FLAGS.netperf_enable_histograms or num_streams > 1
357364
# Throughput benchmarks don't have latency histograms
358-
enable_latency_histograms = enable_latency_histograms and \
359-
benchmark_name != 'TCP_STREAM'
365+
enable_latency_histograms = (enable_latency_histograms and
366+
(benchmark_name not in ['TCP_STREAM', 'UDP_STREAM']))
360367
# Flags:
361368
# -o specifies keys to include in CSV output.
362369
# -j keeps additional latency numbers
@@ -367,6 +374,14 @@ def RunNetperf(vm, benchmark_name, server_ip, num_streams):
367374
confidence = ('-I 99,5 -i {0},3'.format(FLAGS.netperf_max_iter)
368375
if FLAGS.netperf_max_iter else '')
369376
verbosity = '-v2 ' if enable_latency_histograms else ''
377+
378+
remote_cmd_timeout = (
379+
FLAGS.netperf_test_length * (FLAGS.netperf_max_iter or 1) + 300)
380+
381+
metadata = {'netperf_test_length': FLAGS.netperf_test_length,
382+
'sending_thread_count': num_streams,
383+
'max_iter': FLAGS.netperf_max_iter or 1}
384+
370385
netperf_cmd = ('{netperf_path} -p {{command_port}} -j {verbosity} '
371386
'-t {benchmark_name} -H {server_ip} -l {length} {confidence}'
372387
' -- '
@@ -377,7 +392,19 @@ def RunNetperf(vm, benchmark_name, server_ip, num_streams):
377392
server_ip=server_ip,
378393
length=FLAGS.netperf_test_length,
379394
output_selector=OUTPUT_SELECTOR,
380-
confidence=confidence, verbosity=verbosity)
395+
confidence=confidence,
396+
verbosity=verbosity)
397+
398+
if benchmark_name.upper() == 'UDP_STREAM':
399+
netperf_cmd += (' -R 1 -m {send_size} -M {send_size} '.format(
400+
send_size=FLAGS.netperf_udp_stream_send_size_in_bytes))
401+
metadata['netperf_send_size_in_bytes'] = FLAGS.netperf_udp_stream_send_size_in_bytes
402+
403+
elif benchmark_name.upper() == 'TCP_STREAM':
404+
netperf_cmd += (' -m {send_size} -M {send_size} '.format(
405+
send_size=FLAGS.netperf_tcp_stream_send_size_in_bytes))
406+
metadata['netperf_send_size_in_bytes'] = FLAGS.netperf_tcp_stream_send_size_in_bytes
407+
381408
if FLAGS.netperf_thinktime != 0:
382409
netperf_cmd += (' -X {thinktime},{thinktime_array_size},'
383410
'{thinktime_run_length} ').format(
@@ -402,11 +429,6 @@ def RunNetperf(vm, benchmark_name, server_ip, num_streams):
402429
json_out = json.loads(remote_stdout)
403430
stdouts = json_out[0]
404431

405-
# Metadata to attach to samples
406-
metadata = {'netperf_test_length': FLAGS.netperf_test_length,
407-
'max_iter': FLAGS.netperf_max_iter or 1,
408-
'sending_thread_count': num_streams}
409-
410432
parsed_output = [ParseNetperfOutput(stdout, metadata, benchmark_name,
411433
enable_latency_histograms)
412434
for stdout in stdouts]

tests/data/netperf_results.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,15 @@
3838
"MIGRATED UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 20001 AF_INET to 10.240.31.117 () port 20001 AF_INET : +/-2.500% @ 99% conf. : first burst 0",
3939
"Throughput,Throughput Units,Throughput Confidence Width (%),Confidence Iterations Run,Stddev Latency Microseconds,50th Percentile Latency Microseconds,90th Percentile Latency Microseconds,99th Percentile Latency Microseconds,Minimum Latency Microseconds,Maximum Latency Microseconds,Local Transport Retransmissions,Remote Transport Retransmissions",
4040
"3313.49,Trans/s,7.546,20,214.64,295,330,406,200,500,0,0"
41+
],
42+
[
43+
"MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 104.198.67.251 () port 20001 AF_INET : +/-2.500% @ 99% conf.",
44+
"Throughput,Throughput Units,50th Percentile Latency Microseconds,90th Percentile Latency Microseconds,99th Percentile Latency Microseconds,Stddev Latency Microseconds,Minimum Latency Microseconds,Maximum Latency Microseconds,Confidence Iterations Run,Throughput Confidence Width (%),Local Transport Retransmissions,Remote Transport Retransmissions",
45+
"1102.42,10^6bits/s,3,3,11,46.14,1,15144,1,-1.000,-1,-1"
46+
],
47+
[
48+
"MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 104.198.67.251 () port 20001 AF_INET : +/-2.500% @ 99% conf.",
49+
"Throughput,Throughput Units,50th Percentile Latency Microseconds,90th Percentile Latency Microseconds,99th Percentile Latency Microseconds,Stddev Latency Microseconds,Minimum Latency Microseconds,Maximum Latency Microseconds,Confidence Iterations Run,Throughput Confidence Width (%),Local Transport Retransmissions,Remote Transport Retransmissions",
50+
"1802.72,10^6bits/s,3,3,11,46.14,1,15144,1,-1.000,-1,-1"
4151
]
4252
]

tests/linux_benchmarks/netperf_benchmark_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def testExternalAndInternal(self):
129129
('UDP_RR_Latency_p99', 406.0, 'us'),
130130
('UDP_RR_Latency_min', 200.0, 'us'),
131131
('UDP_RR_Latency_max', 500.0, 'us'),
132-
('UDP_RR_Latency_stddev', 214.64, 'us')],
132+
('UDP_RR_Latency_stddev', 214.64, 'us'),
133+
('UDP_STREAM_Throughput', 1102.42, mbps),
134+
('UDP_STREAM_Throughput', 1802.72, 'Mbits/sec'),
135+
],
133136
[i[:3] for i in result])
134137

135138
external_meta = {'ip_type': 'external'}

0 commit comments

Comments
 (0)