diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2022-03-22 12:49:39 +0000 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2023-01-24 06:27:30 +0000 |
commit | 752538617f43672a0a9eeb93432929032cca05d3 (patch) | |
tree | 050312af95eecb468e1e65f9d396dd627f34001b /resources | |
parent | bf635b8d7cd582f38e1d0faefa246672b71b2567 (diff) |
Tune host stack performance tests
* remove evt_qs_memfd_seg and evt_qs_seg_size as they are obsolete
* use app socket api instead of vpp's api
* apply rx and tx descriptors constraints
* increase event queue size for nginx tests
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Ie7ac12b8f587e0b1962884127e8eb68a4e588aee
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'resources')
-rw-r--r-- | resources/libraries/python/HoststackUtil.py | 86 | ||||
-rw-r--r-- | resources/libraries/python/VppConfigGenerator.py | 5 | ||||
-rw-r--r-- | resources/libraries/robot/hoststack/hoststack.robot | 78 | ||||
-rw-r--r-- | resources/templates/vcl/vcl_iperf3.conf | 9 | ||||
-rw-r--r-- | resources/templates/vcl/vcl_nginx.conf | 12 |
5 files changed, 151 insertions, 39 deletions
diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py index 073d3ec831..2c9c080b69 100644 --- a/resources/libraries/python/HoststackUtil.py +++ b/resources/libraries/python/HoststackUtil.py @@ -59,6 +59,8 @@ class HoststackUtil(): vpp_echo_cmd[u"args"] += u" rx-results-diff" if vpp_echo_attributes[u"tx_results_diff"]: vpp_echo_cmd[u"args"] += u" tx-results-diff" + if vpp_echo_attributes[u"use_app_socket_api"]: + vpp_echo_cmd[u"args"] += u" use-app-socket-api" return vpp_echo_cmd @staticmethod @@ -154,15 +156,14 @@ class HoststackUtil(): raise @staticmethod - def get_hoststack_test_program_logs(node, program): + def _get_hoststack_test_program_logs(node, program_name): """Get HostStack test program stdout log. :param node: DUT node. - :param program: test program. + :param program_name: test program. :type node: dict - :type program: dict + :type program_name: str """ - program_name = program[u"name"] cmd = f"sh -c \'cat /tmp/{program_name}_stdout.log\'" stdout_log, _ = exec_cmd_no_error(node, cmd, sudo=True, \ message=f"Get {program_name} stdout log failed!") @@ -170,9 +171,30 @@ class HoststackUtil(): cmd = f"sh -c \'cat /tmp/{program_name}_stderr.log\'" stderr_log, _ = exec_cmd_no_error(node, cmd, sudo=True, \ message=f"Get {program_name} stderr log failed!") + return stdout_log, stderr_log @staticmethod + def get_hoststack_test_program_logs(node, program): + """Get HostStack test program stdout log. + + :param node: DUT node. + :param program: test program. + :type node: dict + :type program: dict + """ + program_name = program[u"name"] + program_stdout_log, program_stderr_log = \ + HoststackUtil._get_hoststack_test_program_logs(node, + program_name) + if len(program_stdout_log) == 0 and len(program_stderr_log) == 0: + logger.trace(f"Retrying {program_name} log retrieval") + program_stdout_log, program_stderr_log = \ + HoststackUtil._get_hoststack_test_program_logs(node, + program_name) + return program_stdout_log, program_stderr_log + + @staticmethod def get_nginx_command(nginx_attributes, nginx_version, nginx_ins_dir): """Construct the NGINX command using the specified attributes. @@ -276,20 +298,68 @@ class HoststackUtil(): exec_cmd_no_error(node, cmd, message=errmsg, sudo=True) @staticmethod - def hoststack_test_program_finished(node, program_pid): + def hoststack_test_program_finished(node, program_pid, program, + other_node, other_program): """Wait for the specified HostStack test program process to complete. :param node: DUT node. :param program_pid: test program pid. + :param program: test program + :param other_node: DUT node of other hoststack program + :param other_program: other test program :type node: dict :type program_pid: str + :type program: dict + :type other_node: dict + :type other_program: dict :raises RuntimeError: If node subtype is not a DUT. """ if node[u"type"] != u"DUT": raise RuntimeError(u"Node type is not a DUT!") + if other_node[u"type"] != u"DUT": + raise RuntimeError(u"Other node type is not a DUT!") cmd = f"sh -c 'strace -qqe trace=none -p {program_pid}'" - exec_cmd(node, cmd, sudo=True) + try: + exec_cmd(node, cmd, sudo=True) + except: + sleep(180) + if u"client" in program[u"args"]: + role = u"client" + else: + role = u"server" + program_stdout, program_stderr = \ + HoststackUtil.get_hoststack_test_program_logs(node, program) + if len(program_stdout) > 0: + logger.debug(f"{program[u'name']} {role} stdout log:\n" + f"{program_stdout}") + else: + logger.debug(f"Empty {program[u'name']} {role} stdout log :(") + if len(program_stderr) > 0: + logger.debug(f"{program[u'name']} stderr log:\n" + f"{program_stderr}") + else: + logger.debug(f"Empty {program[u'name']} stderr log :(") + if u"client" in other_program[u"args"]: + role = u"client" + else: + role = u"server" + program_stdout, program_stderr = \ + HoststackUtil.get_hoststack_test_program_logs(other_node, + other_program) + if len(program_stdout) > 0: + logger.debug(f"{other_program[u'name']} {role} stdout log:\n" + f"{program_stdout}") + else: + logger.debug(f"Empty {other_program[u'name']} " + f"{role} stdout log :(") + if len(program_stderr) > 0: + logger.debug(f"{other_program[u'name']} {role} stderr log:\n" + f"{program_stderr}") + else: + logger.debug(f"Empty {other_program[u'name']} " + f"{role} stderr log :(") + raise # Wait a bit for stdout/stderr to be flushed to log files sleep(1) @@ -324,10 +394,6 @@ class HoststackUtil(): program_name = program[u"name"] program_stdout, program_stderr = \ HoststackUtil.get_hoststack_test_program_logs(node, program) - if len(program_stdout) == 0 and len(program_stderr) == 0: - logger.trace(f"Retrying {program_name} log retrieval") - program_stdout, program_stderr = \ - HoststackUtil.get_hoststack_test_program_logs(node, program) env_vars = f"{program[u'env_vars']} " if u"env_vars" in program else u"" program_cmd = f"{env_vars}{program_name} {program[u'args']}" diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index 4fd28ffb8a..926b5c767a 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -564,6 +564,11 @@ class VppConfigGenerator: path = [u"session", u"enable"] self.add_config_item(self._nodeconfig, u"", path) + def add_session_app_socket_api(self): + """Use session app socket api.""" + path = [u"session", u"use-app-socket-api"] + self.add_config_item(self._nodeconfig, u"", path) + def add_session_event_queues_memfd_segment(self): """Add session event queue memfd segment.""" path = [u"session", u"evt_qs_memfd_seg"] diff --git a/resources/libraries/robot/hoststack/hoststack.robot b/resources/libraries/robot/hoststack/hoststack.robot index 9c81855af4..8dd1355ff1 100644 --- a/resources/libraries/robot/hoststack/hoststack.robot +++ b/resources/libraries/robot/hoststack/hoststack.robot @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -34,10 +34,8 @@ | ... | txd=${256} | ... | phy_cores=${1} | ... | vpp_api_socket=${SOCKSVR_PATH} -| ... | api_seg_global_size=2G -| ... | api_seg_api_size=1G +| ... | app_api_socket=/run/vpp/app_ns_sockets/default | ... | tcp_cc_algo=cubic -| ... | sess_evt_q_seg_size=64M | ... | sess_evt_q_length=16384 | ... | sess_prealloc_sess=1024 | ... | sess_v4_tbl_buckets=20000 @@ -51,7 +49,7 @@ | ... | cpu_cnt=${1} | ... | cfg_vpp_feature=${None} | ... | namespace=default -| ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket] +| ... | app_api_socket=${vpp_hoststack_attr}[app_api_socket] | ... | json_output=json | ... | uri_protocol=quic | ... | uri_ip4_addr=${EMPTY} @@ -66,12 +64,13 @@ | ... | tx_bytes=0 | ... | rx_results_diff=${False} | ... | tx_results_diff=${False} +| ... | use_app_socket_api=${True} | &{vpp_echo_client_attr}= | ... | role=client | ... | cpu_cnt=${1} | ... | cfg_vpp_feature=${None} | ... | namespace=default -| ... | vpp_api_socket=${vpp_hoststack_attr}[vpp_api_socket] +| ... | app_api_socket=${vpp_hoststack_attr}[app_api_socket] | ... | json_output=json | ... | uri_protocol=quic | ... | uri_ip4_addr=${EMPTY} @@ -86,6 +85,7 @@ | ... | tx_bytes=0 | ... | rx_results_diff=${False} | ... | tx_results_diff=${False} +| ... | use_app_socket_api=${True} | &{iperf3_server_attr}= | ... | role=server | ... | cpu_cnt=${1} @@ -117,7 +117,7 @@ | ... | cpu_cnt=${1} | ... | cfg_vpp_feature=${Empty} | ... | namespace=default -| ... | vcl_config=vcl_iperf3.conf +| ... | vcl_config=vcl_nginx.conf | ... | ld_preload=${True} | ... | transparent_tls=${False} | ... | json=${True} @@ -134,10 +134,7 @@ | | ... | - ${txd} - Number of Tx Descriptors Type: int | | ... | - ${phy_cores} - Number of cores for workers Type: int | | ... | - ${vpp_api_socket} - Path to VPP api socket file Type: string -| | ... | - ${api_seg_global_size} - Global API segment size Type: string -| | ... | - ${api_seg_api_size} - API segment API fifo size Type: string | | ... | - ${tcp_cc_algo} - TCP congestion control algorithm Type: string -| | ... | - ${sess_evt_q_seg_size} - Session event queue segment size | | ... | Type: string | | ... | - ${sess_evt_q_length} - Session event queue length Type: string | | ... | - ${sess_prealloc_sess} - Number of sessions to preallocate @@ -165,10 +162,7 @@ | | ... | ${txd}=${vpp_hoststack_attr}[txd] | | ... | ${phy_cores}=${vpp_hoststack_attr}[phy_cores] | | ... | ${vpp_api_socket}=${vpp_hoststack_attr}[vpp_api_socket] -| | ... | ${api_seg_global_size}=${vpp_hoststack_attr}[api_seg_global_size] -| | ... | ${api_seg_api_size}=${vpp_hoststack_attr}[api_seg_api_size] | | ... | ${tcp_cc_algo}=${vpp_hoststack_attr}[tcp_cc_algo] -| | ... | ${sess_evt_q_seg_size}=${vpp_hoststack_attr}[sess_evt_q_seg_size] | | ... | ${sess_evt_q_length}=${vpp_hoststack_attr}[sess_evt_q_length] | | ... | ${sess_prealloc_sess}=${vpp_hoststack_attr}[sess_prealloc_sess] | | ... | ${sess_v4_tbl_buckets}=${vpp_hoststack_attr}[sess_v4_tbl_buckets] @@ -185,14 +179,8 @@ | | Set To Dictionary | ${vpp_hoststack_attr} | | ... | vpp_api_socket | ${vpp_api_socket} | | Set To Dictionary | ${vpp_hoststack_attr} -| | ... | api_seg_global_size | ${api_seg_global_size} -| | Set To Dictionary | ${vpp_hoststack_attr} -| | ... | api_seg_api_size | ${api_seg_api_size} -| | Set To Dictionary | ${vpp_hoststack_attr} | | ... | tcp_cc_algo | ${tcp_cc_algo} | | Set To Dictionary | ${vpp_hoststack_attr} -| | ... | sess_evt_q_seg_size | ${sess_evt_q_seg_size} -| | Set To Dictionary | ${vpp_hoststack_attr} | | ... | sess_evt_q_length | ${sess_evt_q_length} | | Set To Dictionary | ${vpp_hoststack_attr} | | ... | sess_prealloc_sess | ${sess_prealloc_sess} @@ -227,6 +215,7 @@ | | ... | - ${tx_bytes} - Number of Bytes to send Type: string | | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean | | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean +| | ... | - ${use_app_socket_api} - Use app socket API instead of VPP API | | | | ... | *Example:* | | @@ -246,6 +235,7 @@ | | ... | ${tx_bytes}=${vpp_echo_server_attr}[tx_bytes] | | ... | ${rx_results_diff}=${vpp_echo_server_attr}[rx_results_diff] | | ... | ${tx_results_diff}=${vpp_echo_server_attr}[tx_results_diff] +| | ... | ${use_app_socket_api}=${vpp_echo_server_attr}[use_app_socket_api] | | | | Set To Dictionary | ${vpp_echo_server_attr} | cfg_vpp_feature | | ... | ${cfg_vpp_feature} @@ -262,6 +252,8 @@ | | ... | ${vpp_echo_server_attr} | rx_results_diff | ${rx_results_diff} | | Set To Dictionary | | ... | ${vpp_echo_server_attr} | tx_results_diff | ${tx_results_diff} +| | Set To Dictionary +| | ... | ${vpp_echo_server_attr} | use_app_socket_api | ${use_app_socket_api} | Set VPP Echo Client Attributes | | [Documentation] @@ -281,6 +273,7 @@ | | ... | - ${tx_bytes} - Number of Bytes to send Type: string | | ... | - ${rx_results_diff} - Rx Results are different to pass Type: boolean | | ... | - ${tx_results_diff} - Tx Results are different to pass Type: boolean +| | ... | - ${use_app_socket_api} - Use app socket API instead of VPP API | | | | ... | *Example:* | | @@ -300,6 +293,7 @@ | | ... | ${tx_bytes}=${vpp_echo_client_attr}[tx_bytes] | | ... | ${rx_results_diff}=${vpp_echo_client_attr}[rx_results_diff] | | ... | ${tx_results_diff}=${vpp_echo_client_attr}[tx_results_diff] +| | ... | ${use_app_socket_api}=${vpp_echo_client_attr}[use_app_socket_api] | | | | Set To Dictionary | ${vpp_echo_client_attr} | cfg_vpp_feature | | ... | ${cfg_vpp_feature} @@ -316,6 +310,8 @@ | | ... | ${vpp_echo_client_attr} | rx_results_diff | ${rx_results_diff} | | Set To Dictionary | | ... | ${vpp_echo_client_attr} | tx_results_diff | ${tx_results_diff} +| | Set To Dictionary +| | ... | ${vpp_echo_client_attr} | use_app_socket_api | ${use_app_socket_api} | Set Iperf3 Server Attributes | | [Documentation] @@ -440,7 +436,7 @@ | | Set hoststack quic fifo size | ${node} | ${quic_fifo_size} | | Set hoststack quic crypto engine | ${node} | ${quic_crypto_engine} -| Configure VPP hoststack attributes on all DUTs +| Configure VPP Hoststack Attributes on all DUTs | | [Documentation] | | ... | Configure VPP HostStack attributes on all DUTs. | | @@ -453,10 +449,6 @@ | | | Import Library | resources.libraries.python.VppConfigGenerator | | | ... | WITH NAME | ${dut} | | | Run keyword | ${dut}.Add socksvr | ${vpp_hoststack_attr}[vpp_api_socket] -| | | Run keyword | ${dut}.Add api segment global size -| | | ... | ${vpp_hoststack_attr}[api_seg_global_size] -| | | Run keyword | ${dut}.Add api segment api size -| | | ... | ${vpp_hoststack_attr}[api_seg_api_size] | | | Run Keyword If | | | ... | '${dut}' == 'DUT1' and ${vpp_nsim_attr}[output_nsim_enable] | | | ... | ${dut}.Add Nsim poll main thread @@ -464,9 +456,7 @@ | | | Run keyword | ${dut}.Add tcp congestion control algorithm | | | ... | ${vpp_hoststack_attr}[tcp_cc_algo] | | | Run keyword | ${dut}.Add session enable -| | | Run keyword | ${dut}.Add session event queues memfd segment -| | | Run keyword | ${dut}.Add session event queues segment size -| | | ... | ${vpp_hoststack_attr}[sess_evt_q_seg_size] +| | | Run keyword | ${dut}.Add session app socket api | | | Run keyword | ${dut}.Add session event queue length | | | ... | ${vpp_hoststack_attr}[sess_evt_q_length] | | | Run keyword | ${dut}.Add session preallocated sessions @@ -518,11 +508,13 @@ | | ... | ${vpp_echo_client_attr}[namespace] | ${core_list} | | ... | ${vpp_echo_client_attr}[cfg_vpp_feature] | ${vpp_echo_client} | | When Hoststack Test Program Finished | ${dut1} | ${client_pid} +| | ... | ${vpp_echo_client} | ${dut2} | ${vpp_echo_server} | | ${client_defer_fail} | ${client_output}= | | ... | Analyze hoststack test program output | ${dut1} | Client | | ... | ${vpp_nsim_attr} | ${vpp_echo_client} | | Then Set test message | ${client_output} | | And Hoststack Test Program Finished | ${dut2} | ${server_pid} +| | ... | ${vpp_echo_server} | ${dut1} | ${vpp_echo_client} | | ${server_defer_fail} | ${server_output}= | | ... | Analyze hoststack test program output | ${dut2} | Server | | ... | ${vpp_nsim_attr} | ${vpp_echo_server} @@ -560,6 +552,7 @@ | | ... | ${iperf3_client_attr}[namespace] | ${core_list} | | ... | ${iperf3_client_attr}[cfg_vpp_feature] | ${iperf3_client} | | When Hoststack Test Program Finished | ${dut1} | ${client_pid} +| | ... | ${iperf3_client} | ${dut2} | ${iperf3_server} | | ${client_defer_fail} | ${client_output}= | | ... | Analyze hoststack test program output | ${dut1} | Client | | ... | ${vpp_nsim_attr} | ${iperf3_client} @@ -634,3 +627,34 @@ | | ... | ${listen_port} | | Set test message | ${output} | | Log VPP Hoststack data | ${dut1} + +| Configure VPP startup configuration for NGINX +| | [Documentation] +| | ... | COnfigure VPP startup configuration for NGINX related tests +| | +| | [Arguments] | ${sess_prealloc_sess} | ${sess_evt_q_length} +| | ... | ${v4_sess_tbl_buckets} | ${v4_sess_tbl_mem} | ${local_endpts_tbl_buckets} +| | ... | ${local_endpts_tbl_mem} | ${tcp_prealloc_conns} | ${tcp_prealloc_ho_conns} +| | +| | FOR | ${dut} | IN | @{duts} +| | | Import Library | resources.libraries.python.VppConfigGenerator +| | | ... | WITH NAME | ${dut} +| | | Run keyword | ${dut}.Add session enable +| | | Run keyword | ${dut}.Add session app socket api +| | | Run keyword | ${dut}.Add session preallocated sessions +| | | ... | ${sess_prealloc_sess} +| | | Run keyword | ${dut}.Add session event queue length +| | | ... | ${sess_evt_q_length} +| | | Run keyword | ${dut}.Add session v4 session table buckets +| | | ... | ${v4_sess_tbl_buckets} +| | | Run keyword | ${dut}.Add session v4 session table memory +| | | ... | ${v4_sess_tbl_mem} +| | | Run keyword | ${dut}.Add session local endpoints table buckets +| | | ... | ${local_endpts_tbl_buckets} +| | | Run keyword | ${dut}.Add session local endpoints table memory +| | | ... | ${local_endpts_tbl_mem} +| | | Run keyword | ${dut}.Add tcp preallocated connections +| | | ... | ${tcp_prealloc_conns} +| | | Run keyword | ${dut}.Add tcp preallocated half open connections +| | | ... | ${tcp_prealloc_ho_conns} +| | END
\ No newline at end of file diff --git a/resources/templates/vcl/vcl_iperf3.conf b/resources/templates/vcl/vcl_iperf3.conf index 9e4b0571dd..adf6c181bc 100644 --- a/resources/templates/vcl/vcl_iperf3.conf +++ b/resources/templates/vcl/vcl_iperf3.conf @@ -1,7 +1,12 @@ vcl { + segment-size 4000000000 + add-segment-size 4000000000 rx-fifo-size 4000000 tx-fifo-size 4000000 app-scope-local app-scope-global - api-socket-name /run/vpp/api.sock -}
\ No newline at end of file + + # This must be kept in sync with vpp_hoststack_attr{app_api_socket} + # in .../resources/libraries/robot/hoststack/hoststack.robot + app-socket-api /run/vpp/app_ns_sockets/default +} diff --git a/resources/templates/vcl/vcl_nginx.conf b/resources/templates/vcl/vcl_nginx.conf new file mode 100644 index 0000000000..80cf0c6808 --- /dev/null +++ b/resources/templates/vcl/vcl_nginx.conf @@ -0,0 +1,12 @@ +vcl { + segment-size 4000000000 + add-segment-size 4000000000 + rx-fifo-size 4000000 + tx-fifo-size 4000000 + use-mq-eventfd + event-queue-size 500000 + + # This must be kept in sync with vpp_hoststack_attr{app_api_socket} + # in .../resources/libraries/robot/hoststack/hoststack.robot + app-socket-api /run/vpp/app_ns_sockets/default +}
\ No newline at end of file |