scripts/perf: Add bandwidth measurement to nvmf test

Bandwidth measurement is realized by bwm-ng tool.
Using this measure tool will help us to check network saturation.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I7b95b9b4ac3ca3b1847ec72ab7ea333807befe89
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3190
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Maciej Wawryk 2020-07-03 10:01:23 +02:00 committed by Tomasz Zawadzki
parent 72eedc578d
commit 3c8451e69a
2 changed files with 33 additions and 6 deletions

View File

@ -131,7 +131,7 @@ as a runtime environment parameter.
When the test completes, you will find a csv file (nvmf_results.csv) containing the results in the target node When the test completes, you will find a csv file (nvmf_results.csv) containing the results in the target node
directory /tmp/results. directory /tmp/results.
#Processor Counter Monitor (PCM) # Processor Counter Monitor (PCM)
PCM Tools provides a number of command-line utilities for real-time monitoring. PCM Tools provides a number of command-line utilities for real-time monitoring.
Before using PCM Tools in nvmf perf scripts it needs to be installed on Target machine. Before using PCM Tools in nvmf perf scripts it needs to be installed on Target machine.
PCM source and instructions are available on https://github.com/opcm/pcm. PCM source and instructions are available on https://github.com/opcm/pcm.
@ -145,3 +145,15 @@ example:
``` ```
Example above will run PCM measure for cpu and memory, with start delay 10s, sample every 1 second, Example above will run PCM measure for cpu and memory, with start delay 10s, sample every 1 second,
and 30 samples for cpu measure. PCM memory do not support sample count. and 30 samples for cpu measure. PCM memory do not support sample count.
# Bandwidth monitor (bwm-ng)
PCM Tools provides a number of command-line utilities for real-time monitoring.
Before using bwm-ng in nvmf perf scripts it needs to be installed on Target machine.
To enable bandwidth monitor in perf test you need to add Target setting in config.json file:
```
"bandwidth_settings": [bool, sample_count]
```
example:
```
"bandwidth_settings": [true, 30]
```

View File

@ -37,13 +37,15 @@ class Server:
class Target(Server): class Target(Server):
def __init__(self, name, username, password, mode, nic_ips, transport="rdma", def __init__(self, name, username, password, mode, nic_ips, transport="rdma",
use_null_block=False, sar_settings=None, pcm_settings=None): use_null_block=False, sar_settings=None, pcm_settings=None,
bandwidth_settings=None):
super(Target, self).__init__(name, username, password, mode, nic_ips, transport) super(Target, self).__init__(name, username, password, mode, nic_ips, transport)
self.null_block = bool(use_null_block) self.null_block = bool(use_null_block)
self.enable_sar = False self.enable_sar = False
self.enable_pcm_memory = False self.enable_pcm_memory = False
self.enable_pcm = False self.enable_pcm = False
self.enable_bandwidth = False
if sar_settings: if sar_settings:
self.enable_sar, self.sar_delay, self.sar_interval, self.sar_count = sar_settings self.enable_sar, self.sar_delay, self.sar_interval, self.sar_count = sar_settings
@ -51,6 +53,9 @@ class Target(Server):
if pcm_settings: if pcm_settings:
self.pcm_dir, self.enable_pcm, self.enable_pcm_memory, self.pcm_delay, self.pcm_interval, self.pcm_count = pcm_settings self.pcm_dir, self.enable_pcm, self.enable_pcm_memory, self.pcm_delay, self.pcm_interval, self.pcm_count = pcm_settings
if bandwidth_settings:
self.enable_bandwidth, self.bandwidth_count = bandwidth_settings
self.script_dir = os.path.dirname(os.path.abspath(sys.argv[0])) self.script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
self.spdk_dir = os.path.abspath(os.path.join(self.script_dir, "../../../")) self.spdk_dir = os.path.abspath(os.path.join(self.script_dir, "../../../"))
@ -250,6 +255,10 @@ class Target(Server):
skt_pcm_file_name = "_".join(["skt", pcm_file_name]) skt_pcm_file_name = "_".join(["skt", pcm_file_name])
skt.to_csv(os.path.join(results_dir, skt_pcm_file_name), index=False) skt.to_csv(os.path.join(results_dir, skt_pcm_file_name), index=False)
def measure_bandwidth(self, results_dir, bandwidth_file_name):
bwm = subprocess.run("bwm-ng -o csv -F %s/%s -a 1 -t 1000 -c %s" % (results_dir, bandwidth_file_name,
self.bandwidth_count), shell=True, check=True)
class Initiator(Server): class Initiator(Server):
def __init__(self, name, username, password, mode, nic_ips, ip, transport="rdma", cpu_frequency=None, def __init__(self, name, username, password, mode, nic_ips, ip, transport="rdma", cpu_frequency=None,
@ -452,10 +461,10 @@ runtime={run_time}
class KernelTarget(Target): class KernelTarget(Target):
def __init__(self, name, username, password, mode, nic_ips, transport="rdma", def __init__(self, name, username, password, mode, nic_ips, transport="rdma",
use_null_block=False, sar_settings=None, pcm_settings=None, use_null_block=False, sar_settings=None, pcm_settings=None,
nvmet_bin="nvmetcli", **kwargs): bandwidth_settings=None, nvmet_bin="nvmetcli", **kwargs):
super(KernelTarget, self).__init__(name, username, password, mode, nic_ips, transport, super(KernelTarget, self).__init__(name, username, password, mode, nic_ips, transport,
use_null_block, sar_settings, pcm_settings) use_null_block, sar_settings, pcm_settings, bandwidth_settings)
self.nvmet_bin = nvmet_bin self.nvmet_bin = nvmet_bin
def __del__(self): def __del__(self):
@ -581,10 +590,10 @@ class SPDKTarget(Target):
def __init__(self, name, username, password, mode, nic_ips, transport="rdma", def __init__(self, name, username, password, mode, nic_ips, transport="rdma",
use_null_block=False, sar_settings=None, pcm_settings=None, use_null_block=False, sar_settings=None, pcm_settings=None,
num_shared_buffers=4096, num_cores=1, **kwargs): bandwidth_settings=None, num_shared_buffers=4096, num_cores=1, **kwargs):
super(SPDKTarget, self).__init__(name, username, password, mode, nic_ips, transport, super(SPDKTarget, self).__init__(name, username, password, mode, nic_ips, transport,
use_null_block, sar_settings, pcm_settings) use_null_block, sar_settings, pcm_settings, bandwidth_settings)
self.num_cores = num_cores self.num_cores = num_cores
self.num_shared_buffers = num_shared_buffers self.num_shared_buffers = num_shared_buffers
@ -907,6 +916,12 @@ if __name__ == "__main__":
t = threading.Thread(target=target_obj.measure_pcm_memory, args=(target_results_dir, pcm_file_name,)) t = threading.Thread(target=target_obj.measure_pcm_memory, args=(target_results_dir, pcm_file_name,))
threads.append(t) threads.append(t)
if target_obj.enable_bandwidth:
bandwidth_file_name = "_".join(["bandwidth", str(block_size), str(rw), str(io_depth)])
bandwidth_file_name = ".".join([bandwidth_file_name, "csv"])
t = threading.Thread(target=target_obj.measure_bandwidth, args=(target_results_dir, bandwidth_file_name,))
threads.append(t)
for t in threads: for t in threads:
t.start() t.start()
for t in threads: for t in threads: