CSIT-898: WRK improvments 55/10055/38
authorTibor Frank <tifrank@cisco.com>
Wed, 10 Jan 2018 14:48:25 +0000 (15:48 +0100)
committerJan Gelety <jgelety@cisco.com>
Tue, 16 Jan 2018 09:06:34 +0000 (09:06 +0000)
Change-Id: I92aafaaedce5891727a983b8cf024a0fb0db7524
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/libraries/python/tcp.py
resources/libraries/robot/performance/performance_setup.robot
resources/libraries/robot/tcp/tcp_setup.robot
resources/templates/vat/start_http_server_params.vat [new file with mode: 0644]
resources/tools/wrk/wrk.py
resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-cps.yaml [moved from resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c1con-cps.yaml with 83% similarity]
resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-8u8c50con-rps.yaml [moved from resources/traffic_profiles/wrk/wrk-sf-2n-ethip4tcphttp-1u1c50con-rps.yaml with 85% similarity]
tests/vpp/perf/tcp/10ge2p1x520-ethip4tcphttp-httpserver.robot

index 5ae1ebf..ecd6210 100644 (file)
@@ -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 <N> fifo-size <size in kB>
+        private-segment-size <seg_size expressed as number + unit, e.g. 100m>
+
+        Where N is the max number of connections you expect to handle at one
+        time and <size> 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)
index 0e909aa..f1ad973 100644 (file)
 | | ${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}
 
index 09f6afd..6da7f0f 100644 (file)
 | 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 (file)
index 0000000..28c4403
--- /dev/null
@@ -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
index 33cfd08..a891fd6 100644 (file)
@@ -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"])
 
@@ -6,6 +6,13 @@
 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
@@ -14,7 +21,7 @@ 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
+cpus: 8
 
 # Duration of the test in seconds.
 # Type: integer
@@ -27,7 +34,7 @@ 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
+nr-of-connections: 50
 
 # Path to LuaJIT script.
 # Type: string
@@ -6,6 +6,13 @@
 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
@@ -14,7 +21,7 @@ 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
+cpus: 8
 
 # Duration of the test in seconds.
 # Type: integer
index 867c317..5dcbb9b 100644 (file)
 | | | 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
 | | [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
 | | [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
 | | [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
 | | [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