From 54ad6efd342695d0a7dad5380cc989a8d846f518 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Wed, 10 Jan 2018 15:48:25 +0100 Subject: CSIT-898: WRK improvments Change-Id: I92aafaaedce5891727a983b8cf024a0fb0db7524 Signed-off-by: Tibor Frank --- resources/libraries/python/tcp.py | 48 ++++++++++++++++++- .../robot/performance/performance_setup.robot | 7 +++ resources/libraries/robot/tcp/tcp_setup.robot | 27 +++++++---- .../templates/vat/start_http_server_params.vat | 1 + resources/tools/wrk/wrk.py | 28 ++++++++++- .../wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml | 47 ------------------- .../wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml | 47 ------------------- .../wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml | 54 ++++++++++++++++++++++ .../wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml | 54 ++++++++++++++++++++++ .../tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot | 22 ++++++--- 10 files changed, 223 insertions(+), 112 deletions(-) create mode 100644 resources/templates/vat/start_http_server_params.vat delete mode 100644 resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml delete mode 100644 resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml create mode 100644 resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml create mode 100644 resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml diff --git a/resources/libraries/python/tcp.py b/resources/libraries/python/tcp.py index 5ae1ebf929..ecd6210f69 100644 --- a/resources/libraries/python/tcp.py +++ b/resources/libraries/python/tcp.py @@ -33,4 +33,50 @@ class TCPUtils(object): """ with VatTerminal(node) as vat: - vat.vat_terminal_exec_cmd_from_template("start_http_server.vat") + vat.vat_terminal_exec_cmd_from_template( + "start_http_server.vat") + + @staticmethod + def start_http_server_params(node, prealloc_fifos, fifo_size, + private_segment_size): + """Start HTTP server on the given node. + + test http server static prealloc-fifos fifo-size + private-segment-size + + Where N is the max number of connections you expect to handle at one + time and should be small if you test for CPS and exchange few + bytes, say 4, if each connection just exchanges few packets. Or it + should be much larger, up to 1024/4096 (i.e. 1-4MB) if you have only + one connection and exchange a lot of packets, i.e., when you test for + RPS. If you need to allocate lots of FIFOs, so you test for CPS, make + private-segment-size something like 4g. + + Example: + + For CPS + test http server static prealloc-fifos 10000 fifo-size 64 + private-segment-size 4000m + + For RPS + test http server static prealloc-fifos 500000 fifo-size 4 + test http server static prealloc-fifos 500000 fifo-size 4 + private-segment-size 4000m + + :param node: Node to start HTTP server on. + :param prealloc_fifos: Max number of connections you expect to handle at + one time. + :param fifo_size: FIFO size in kB. + :param private_segment_size: Private segment size. Number + unit. + :type node: dict + :type prealloc_fifos: str + :type fifo_size: str + :type private_segment_size: str + """ + + with VatTerminal(node, json_param=False) as vat: + vat.vat_terminal_exec_cmd_from_template( + "start_http_server_params.vat", + prealloc_fifos=prealloc_fifos, + fifo_size=fifo_size, + private_segment_size=private_segment_size) diff --git a/resources/libraries/robot/performance/performance_setup.robot b/resources/libraries/robot/performance/performance_setup.robot index 0e909aa455..f1ad973bb8 100644 --- a/resources/libraries/robot/performance/performance_setup.robot +++ b/resources/libraries/robot/performance/performance_setup.robot @@ -422,6 +422,13 @@ | | ${intf_name}= | Get Linux interface name | ${tg} | | ... | ${tg['interfaces']['${tg_if1}']['pci_address']} | | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.10.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.20.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.30.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.40.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.50.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.60.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.70.1 | 24 +| | Set Linux interface IP | ${tg} | ${intf_name} | 192.168.80.1 | 24 | | Set Linux interface up | ${tg} | ${intf_name} | | Install wrk | ${tg} diff --git a/resources/libraries/robot/tcp/tcp_setup.robot b/resources/libraries/robot/tcp/tcp_setup.robot index 09f6afd592..6da7f0fb15 100644 --- a/resources/libraries/robot/tcp/tcp_setup.robot +++ b/resources/libraries/robot/tcp/tcp_setup.robot @@ -20,24 +20,35 @@ | Documentation | L2 keywords to set up VPP to test tcp. *** Keywords *** -| Set up HTTP server on the VPP node +| Set up HTTP server with paramters on the VPP node | | [Documentation] | | ... | Configure IP address on the port, set it up and start HTTP server on | | ... | the VPP. | | ... | | ... | *Arguments:* -| | ... | - ${dut1_if1_ip4} - IP address to be set on the dut1_if1 interface. +| | ... | - ${prealloc_fifos} - Max number of connections you expect to handle +| | ... | at one time. Type: string +| | ... | - ${fifo_size} - FIFO size in kB. Type: string +| | ... | - ${private_segment_size} - Private segment size. Number + unit. | | ... | Type: string -| | ... | - ${ip4_len} - Length of the netmask. Type: integer | | ... | | ... | *Example:* | | ... -| | ... | \| Set up HTTP server on the VPP node \| 192.168.10.2 \| 24 \| +| | ... | \| Set up HTTP server with paramters on the VPP node \| 400 \| 4096\ +| | ... | \| 2g \| | | ... -| | [Arguments] | ${dut1_if1_ip4} | ${ip4_len} +| | [Arguments] | ${prealloc_fifos} | ${fifo_size} | ${private_segment_size} | | ... | | Set Interface State | ${dut1} | ${dut1_if1} | up -| | Set Interface Address | ${dut1} | ${dut1_if1} | ${dut1_if1_ip4} | ${ip4_len} +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.10.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.20.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.30.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.40.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.50.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.60.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.70.2 | 24 +| | Set Interface Address | ${dut1} | ${dut1_if1} | 192.168.80.2 | 24 | | Vpp Node Interfaces Ready Wait | ${dut1} -| | Start HTTP server | ${dut1} -| | Sleep | 30 +| | Start HTTP server params | ${dut1} | ${prealloc_fifos} | ${fifo_size} +| | ... | ${private_segment_size} +| | Sleep | 30 \ No newline at end of file diff --git a/resources/templates/vat/start_http_server_params.vat b/resources/templates/vat/start_http_server_params.vat new file mode 100644 index 0000000000..28c4403079 --- /dev/null +++ b/resources/templates/vat/start_http_server_params.vat @@ -0,0 +1 @@ +exec test http server static prealloc-fifos {prealloc_fifos} fifo-size {fifo_size} private-segment-size {private_segment_size} \ No newline at end of file diff --git a/resources/tools/wrk/wrk.py b/resources/tools/wrk/wrk.py index 33cfd08174..a891fd6ae9 100644 --- a/resources/tools/wrk/wrk.py +++ b/resources/tools/wrk/wrk.py @@ -16,6 +16,9 @@ import re +from copy import deepcopy +from time import sleep + from robot.api import logger from resources.libraries.python.ssh import SSH @@ -100,17 +103,19 @@ def destroy_wrk(tg_node): raise RuntimeError('Removal of wrk from the TG node failed.') -def run_wrk(tg_node, profile_name, tg_numa, test_type): +def run_wrk(tg_node, profile_name, tg_numa, test_type, warm_up=False): """Send the traffic as defined in the profile. :param tg_node: Traffic generator node. :param profile_name: The name of wrk traffic profile. :param tg_numa: Numa node on which wrk will run. :param test_type: The type of the tests: cps, rps, bw + :param warm_up: If True, warm-up traffic is generated before test traffic. :type profile_name: str :type tg_node: dict :type tg_numa: int :type test_type: str + :type warm_up: bool :returns: Message with measured data. :rtype: str :raises: RuntimeError if node type is not a TG. @@ -140,6 +145,9 @@ def run_wrk(tg_node, profile_name, tg_numa, test_type): str(profile["latency"]), "'{0}'".format(" ".join(profile["urls"])) ] + if warm_up: + warm_up_params = deepcopy(params) + warm_up_params[4] = "10s" elif len(profile["urls"]) == profile["cpus"]: params = [ "traffic_n_urls_n_cores", @@ -153,6 +161,9 @@ def run_wrk(tg_node, profile_name, tg_numa, test_type): str(profile["latency"]), "'{0}'".format(" ".join(profile["urls"])) ] + if warm_up: + warm_up_params = deepcopy(params) + warm_up_params[4] = "10s" else: params = [ "traffic_n_urls_m_cores", @@ -167,11 +178,24 @@ def run_wrk(tg_node, profile_name, tg_numa, test_type): str(profile["latency"]), "'{0}'".format(" ".join(profile["urls"])) ] + if warm_up: + warm_up_params = deepcopy(params) + warm_up_params[5] = "10s" + args = " ".join(params) ssh = SSH() ssh.connect(tg_node) + if warm_up: + warm_up_args = " ".join(warm_up_params) + ret, _, _ = ssh.exec_command( + "{0}/resources/tools/wrk/wrk_utils.sh {1}". + format(Constants.REMOTE_FW_DIR, warm_up_args), timeout=1800) + if int(ret) != 0: + raise RuntimeError('wrk runtime error.') + sleep(60) + ret, stdout, _ = ssh.exec_command( "{0}/resources/tools/wrk/wrk_utils.sh {1}". format(Constants.REMOTE_FW_DIR, args), timeout=1800) @@ -190,7 +214,7 @@ def run_wrk(tg_node, profile_name, tg_numa, test_type): log_msg += "Requests/sec: Avg / Stdev / Max / +/- Stdev\n" for item in stats["rps-stats-lst"]: log_msg += "{0} / {1} / {2} / {3}\n".format(*item) - log_msg += "Total rps: {0}cps\n".format(stats["rps-sum"]) + log_msg += "Total rps: {0}rps\n".format(stats["rps-sum"]) elif test_type == "bw": log_msg += "Transfer/sec: {0}Bps".format(stats["bw-sum"]) diff --git a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml deleted file mode 100644 index cf120e7e1d..0000000000 --- a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml +++ /dev/null @@ -1,47 +0,0 @@ -# This is an example wrk traffic profile. - -# List of urls for requests. Each url is requested in a separate instance of -# wrk. -# Type: list -urls: - # There must be an empty file (0B) requested but vpp does not support it. - - "http://192.168.10.2" - -# Index of the first CPU on the numa used to run wrk. -# Type: integer -first-cpu: 1 - -# The number of cpus used for wrk. The number of cpus must be a -# multiplication of the number of urls. -# Type: integer -cpus: 1 - -# Duration of the test in seconds. -# Type: integer -duration: 30 - -# Total number of threads to use. -# Type: integer -nr-of-threads: 1 - -# Total number of HTTP connections to keep open with each thread handling -# N = connections/threads. -# Type: integer -nr-of-connections: 1 - -# Path to LuaJIT script. -# Type: string -# script: "" - -# HTTP header to add to request, e.g. "Connection: close". -# Type: string (taken as it is) or dictionary -header: - Connection: "close" - -# Print detailed latency statistics. -# Type: boolean -latency: False - -# Record a timeout if a response is not received within this amount of time. -# Type: integer -timeout: 5 diff --git a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml deleted file mode 100644 index 939703638b..0000000000 --- a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml +++ /dev/null @@ -1,47 +0,0 @@ -# This is an example wrk traffic profile. - -# List of urls for requests. Each url is requested in a separate instance of -# wrk. -# Type: list -urls: - # There must be a file (1kB - 1MB) requested but vpp does not support it. - - "http://192.168.10.2" - -# Index of the first CPU on the numa used to run wrk. -# Type: integer -first-cpu: 1 - -# The number of cpus used for wrk. The number of cpus must be a -# multiplication of the number of urls. -# Type: integer -cpus: 1 - -# Duration of the test in seconds. -# Type: integer -duration: 30 - -# Total number of threads to use. -# Type: integer -nr-of-threads: 1 - -# Total number of HTTP connections to keep open with each thread handling -# N = connections/threads. -# Type: integer -nr-of-connections: 50 - -# Path to LuaJIT script. -# Type: string -# script: "" - -# HTTP header to add to request, e.g. "Connection: close". -# Type: string (taken as it is) or dictionary -# header: -# Connection: "close" - -# Print detailed latency statistics. -# Type: boolean -latency: False - -# Record a timeout if a response is not received within this amount of time. -# Type: integer -timeout: 5 diff --git a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml new file mode 100644 index 0000000000..706cda01b5 --- /dev/null +++ b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml @@ -0,0 +1,54 @@ +# This is an example wrk traffic profile. + +# List of urls for requests. Each url is requested in a separate instance of +# wrk. +# Type: list +urls: + # There must be an empty file (0B) requested but vpp does not support it. + - "http://192.168.10.2" + - "http://192.168.20.2" + - "http://192.168.30.2" + - "http://192.168.40.2" + - "http://192.168.50.2" + - "http://192.168.60.2" + - "http://192.168.70.2" + - "http://192.168.80.2" + +# Index of the first CPU on the numa used to run wrk. +# Type: integer +first-cpu: 1 + +# The number of cpus used for wrk. The number of cpus must be a +# multiplication of the number of urls. +# Type: integer +cpus: 8 + +# Duration of the test in seconds. +# Type: integer +duration: 30 + +# Total number of threads to use. +# Type: integer +nr-of-threads: 1 + +# Total number of HTTP connections to keep open with each thread handling +# N = connections/threads. +# Type: integer +nr-of-connections: 50 + +# Path to LuaJIT script. +# Type: string +# script: "" + +# HTTP header to add to request, e.g. "Connection: close". +# Type: string (taken as it is) or dictionary +header: + Connection: "close" + +# Print detailed latency statistics. +# Type: boolean +latency: False + +# Record a timeout if a response is not received within this amount of time. +# Type: integer +timeout: 5 diff --git a/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml new file mode 100644 index 0000000000..c1ad9e4217 --- /dev/null +++ b/resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml @@ -0,0 +1,54 @@ +# This is an example wrk traffic profile. + +# List of urls for requests. Each url is requested in a separate instance of +# wrk. +# Type: list +urls: + # There must be a file (1kB - 1MB) requested but vpp does not support it. + - "http://192.168.10.2" + - "http://192.168.20.2" + - "http://192.168.30.2" + - "http://192.168.40.2" + - "http://192.168.50.2" + - "http://192.168.60.2" + - "http://192.168.70.2" + - "http://192.168.80.2" + +# Index of the first CPU on the numa used to run wrk. +# Type: integer +first-cpu: 1 + +# The number of cpus used for wrk. The number of cpus must be a +# multiplication of the number of urls. +# Type: integer +cpus: 8 + +# Duration of the test in seconds. +# Type: integer +duration: 30 + +# Total number of threads to use. +# Type: integer +nr-of-threads: 1 + +# Total number of HTTP connections to keep open with each thread handling +# N = connections/threads. +# Type: integer +nr-of-connections: 50 + +# Path to LuaJIT script. +# Type: string +# script: "" + +# HTTP header to add to request, e.g. "Connection: close". +# Type: string (taken as it is) or dictionary +# header: +# Connection: "close" + +# Print detailed latency statistics. +# Type: boolean +latency: False + +# Record a timeout if a response is not received within this amount of time. +# Type: integer +timeout: 5 diff --git a/tests/vpp/perf/tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot b/tests/vpp/perf/tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot index 867c3177d5..5dcbb9b623 100644 --- a/tests/vpp/perf/tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot +++ b/tests/vpp/perf/tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot @@ -57,12 +57,20 @@ | | | Run keyword | ${dut}.Add session local endpoints table buckets | 2500000 | | | Run keyword | ${dut}.Add session local endpoints table memory | 3g | | Apply startup configuration on all VPP DUTs -| | Set up HTTP server on the VPP node | 192.168.10.2 | 24 | | Run Keyword If | '${test_type}' == 'bw' +| | ... | Run keywords +| | ... | Set up HTTP server with paramters on the VPP node +| | ... | 500000 | 4 | 4000m | AND | | ... | Measure throughput | ${traffic_profile} | | ... | ELSE IF | '${test_type}' == 'rps' +| | ... | Run keywords +| | ... | Set up HTTP server with paramters on the VPP node +| | ... | 500000 | 4 | 4000m | AND | | ... | Measure requests per second | ${traffic_profile} | | ... | ELSE IF | '${test_type}' == 'cps' +| | ... | Run keywords +| | ... | Set up HTTP server with paramters on the VPP node +| | ... | 10000 | 64 | 4000m | AND | | ... | Measure connections per second | ${traffic_profile} *** Test Cases *** @@ -73,7 +81,7 @@ | | [Tags] | 1T1C | TCP_CPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c1con-cps | wt=1 | rxq=1 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-cps | wt=1 | rxq=1 | | ... | test_type=cps | tc02-2t2c-ethip4tcphttp-httpserver-cps @@ -83,7 +91,7 @@ | | [Tags] | 2T2C | TCP_CPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c1con-cps | wt=2 | rxq=1 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-cps | wt=2 | rxq=2 | | ... | test_type=cps | tc03-4t4c-ethip4tcphttp-httpserver-cps @@ -93,7 +101,7 @@ | | [Tags] | 4T4C | TCP_CPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c1con-cps | wt=4 | rxq=2 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-cps | wt=4 | rxq=4 | | ... | test_type=cps | tc04-1t1c-ethip4tcphttp-httpserver-rps @@ -103,7 +111,7 @@ | | [Tags] | 1T1C | TCP_RPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c50con-rps | wt=1 | rxq=1 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-rps | wt=1 | rxq=1 | | ... | test_type=rps | tc05-2t2c-ethip4tcphttp-httpserver-rps @@ -113,7 +121,7 @@ | | [Tags] | 2T2C | TCP_RPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c50con-rps | wt=2 | rxq=1 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-rps | wt=2 | rxq=2 | | ... | test_type=rps | tc06-4t4c-ethip4tcphttp-httpserver-rps @@ -123,5 +131,5 @@ | | [Tags] | 4T4C | TCP_RPS | | ... | | [Template] | Measure throughput or rps or cps -| | traffic_profile=wrk-sf-2n-ethip4tcphttp-1u1c50con-rps | wt=4 | rxq=2 +| | traffic_profile=wrk-sf-2n-ethip4tcphttp-8u8c50con-rps | wt=4 | rxq=4 | | ... | test_type=rps -- cgit 1.2.3-korg