Application performance measurement method and apparatus, and device, system and storage medium

By obtaining the timestamp of the TCP packet on the transmission path of the network protocol stack, accurately measuring the performance indicators of the application below the TCP/IP layer, solving the problem of inaccurate measurement in the prior art.

WO2025066530A1PCT designated stage expired Publication Date: 2025-04-03HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/108983
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-28
Filing Date
2024-07-31
Publication Date
2025-04-03

AI Technical Summary

Technical Problem

The prior art is difficult to accurately measure the performance indicators of applications below the TCP/IP layer, resulting in inaccurate performance measurement.

Method used

By obtaining at least two timestamps of the transmission control protocol TCP message on the transmission path of the network protocol stack, including the timestamp of the NIC layer receiving the TCP request message and the timestamp of the TCP response message sent by the socket layer to determine the performance indicators of the tested application.

Benefits of technology

The accuracy of the performance measurement of the application below the TCP/IP layer is achieved, and the problem of inaccurate measurement of performance indicators is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024108983_03042025_PF_FP_ABST
    Figure CN2024108983_03042025_PF_FP_ABST
Patent Text Reader

Abstract

The present application belongs to the field of communications. Disclosed are an application performance measurement method and apparatus, and a device, a system and a storage medium. In the present application, the method comprises: a server acquiring at least two timestamps of a TCP message on a transmission path of a network protocol stack, wherein the TCP message comprises at least one of a TCP request message sent by a client of a measured application and a first TCP response message corresponding to the TCP request message, and the at least two timestamps comprise a first timestamp when a socket layer in the network protocol stack sends the first TCP response message and a second timestamp when an NIC layer in the network protocol stack receives the TCP request message; and on the basis of the at least two timestamps, determining a performance index of the measured application. The performance index of the measured application on a layer below a TCP / IP layer can be measured; the performance index of the message in a sending direction is calculated by using the first timestamp of the first TCP response message, and the performance index of the measured application is accurately measured.
Need to check novelty before this filing date? Find Prior Art

Description

Application performance measurement method, device, equipment, system and storage medium

[0001] This application claims priority to Chinese patent application number 202311287548.4, filed on September 28, 2023, entitled “Application Performance Measurement Method, Device, Equipment, System and Storage Medium,” the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of the present application relate to the field of communications, and in particular to a method, apparatus, device, system, and storage medium for measuring the performance of an application. Background Art

[0003] In the field of information technology and system management, application performance management (APM) is the monitoring and management of application performance. It is dedicated to detecting and diagnosing application performance issues and continuously providing a series of application performance indicators.

[0004] In related technologies, an extended Berkeley Packet Filter (eBPF) program is embedded in functions related to Transmission Control Protocol (TCP) transmission and reception. These functions are functions of the TCP / Internet Protocol (IP) layer of the network protocol stack deployed on the server. When a TCP packet sent by a client reaches the TCP / IP layer, the TCP transmission and reception functions are called, triggering the eBPF program to measure application performance.

[0005] In the above-mentioned related technologies, since the eBPF program is mounted in the TCP / IP layer, the eBPF program can only measure the performance indicators of the application at the TCP / IP layer and above in the network protocol stack, so the accuracy of the measured performance indicators is not high.

[0006] Summary of the Invention

[0007] The present application proposes a performance measurement method, apparatus, device, system and storage medium for measuring the performance of an application below the TCP / IP layer, and improving the accuracy of the performance measurement of the application.

[0008] In a first aspect, the present application provides a performance measurement method for an application, which is applied to a server, and the method includes: obtaining at least two timestamps of a Transmission Control Protocol TCP message on a transmission path of a network protocol stack, the TCP message including at least one of a TCP request message sent by a client of the application under test or a first TCP response message corresponding to the TCP request message, and the at least two timestamps including a first timestamp when a socket layer in the network protocol stack sends the first TCP response message or a second timestamp when a network interface card (NIC) layer in the network protocol stack receives the TCP request message; based on the at least two timestamps, determining the performance indicators of the application under test.

[0009] Compared with the method of mounting the eBPF program in the TCP / IP layer and the TCP transmission and reception related functions, and triggering the eBPF program to perform performance measurement when the TCP transmission and reception related functions are called, the server of the present application can obtain the second timestamp of the NIC layer in the network protocol stack receiving the TCP request message, or the first timestamp of the socket layer sending the first TCP response message. The NIC layer is below the TCP / IP layer. Therefore, it is possible to measure the performance indicators of the application under test at the layer below the TCP / IP layer. Moreover, the first timestamp of the first TCP response message can be used to calculate the delay of the message in the sending direction. In summary, the performance indicators of the application under test can be measured more accurately. Thus, the problem of inaccurate performance indicator measurement of the application is solved.

[0010] In one embodiment of the present application, when a TCP message includes a first TCP response message and at least two timestamps include a first timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and at least two timestamps also include a third timestamp, which is the timestamp when the TCP / IP layer receives the TCP confirmation message; the performance indicator of the application under test includes a first segment delay of the application under test, and the first segment delay is the difference between the third timestamp and the first timestamp.

[0011] By subtracting the first timestamp of the first TCP response message sent by the socket layer from the third timestamp of the TCP acknowledgment message received by the TCP / IP layer in the network protocol stack, and using the resulting difference as the first segment delay, we can accurately measure the delay between the transmission path from the socket layer sending the TCP response message, the client responding to the TCP response message and generating a TCP acknowledgment message, and the client returning the TCP acknowledgment message to the TCP / IP layer on the server. In other words, the first segment delay can reflect the delay of the TCP response message in the sending direction. Since the TCP response message needs to pass through the underlying network when it is sent from the server to the client, and the TCP acknowledgment message also passes through the underlying network when it is sent from the client to the server, the first segment delay can reflect the impact of the underlying network delay on the round-trip delay of the application under test.

[0012] In one embodiment of the present application, when the TCP message includes a TCP request message and at least two timestamps include a second timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and at least two timestamps also include a third timestamp, which is the timestamp when the TCP / IP layer receives the TCP confirmation message; the performance indicator of the application under test includes the total delay of the application under test, and the total delay is the difference between the third timestamp and the second timestamp.

[0013] By subtracting the first timestamp when the NIC layer receives the TCP request message from the third timestamp when the TCP / IP layer in the network protocol stack receives the TCP acknowledgment message, and using the difference as the total latency of the application under test, it is possible to accurately measure the total latency of the entire transmission path, from the application under test receiving the TCP request message at the server end, the server generating the first TCP response message based on the TCP request message, and sending the first TCP response message to the client end, the client generating the TCP acknowledgment message after receiving the first TCP response message, sending the TCP acknowledgment message to the server end, and the server end receiving the TCP acknowledgment message. Therefore, the latency of the entire transmission path from the user's actual request to the confirmation request response can be accurately measured on the server end.

[0014] In one embodiment of the present application, when the TCP message includes a TCP request message and the at least two timestamps include a second timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the second segment delay of the application under test, and the second segment delay of the application under test is the difference between the fourth timestamp and the second timestamp.

[0015] By subtracting the second timestamp of the TCP request message received at the NIC layer from the fourth timestamp of the TCP request message received at the socket layer in the network protocol stack, and using the difference as the second segment latency, we can accurately measure the latency between the time the TCP request message is received at the NIC layer and the time it is received at the socket layer. During the transmission of the TCP request message from the NIC layer to the socket layer, the server-side operating system calls the application program at the application layer. Therefore, the second segment latency reflects the scheduling latency of the operating system scheduling the application program.

[0016] In one embodiment of the present application, when the TCP message includes a TCP request message and a first TCP response message, and at least two timestamps include a first timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the third segment delay of the application under test, and the third segment delay is the difference between the first timestamp and the fourth timestamp.

[0017] By subtracting the fourth timestamp of the TCP request message received by the socket layer from the first timestamp of the first TCP response message sent by the socket layer in the network protocol stack, and using the difference as the third segment delay, we can accurately measure the delay between the transmission path from the socket layer receiving the TCP request message, the application (APP) layer processing the TCP request message to obtain the first TCP response message, the APP layer sending the first TCP response message to the socket layer, and the socket layer sending the first TCP response message. In other words, the third segment delay reflects the delay of the application layer processing the TCP request message.

[0018] In one embodiment of the present application, when the TCP message includes a first TCP response message and at least two timestamps include a first timestamp, the TCP message also includes a second TCP response message, and the at least two timestamps also include a fifth timestamp, which is the timestamp when the socket layer in the network protocol stack sends the second TCP response message; the performance indicators of the application under test include transactions per second (TPS), and TPS is the ratio of the sequence number difference to the time difference, wherein the sequence number difference is the difference between the second sequence number and the first sequence number, the time difference is the difference between the fifth timestamp and the first timestamp, the first sequence number is the sequence number corresponding to the first TCP response message, and the second sequence number is the sequence number corresponding to the second TCP response message.

[0019] Because the timestamp indicates the time when the TCP response message passes through the network protocol stack, the TPS of the application under test is determined based on the changes in the sequence number of the TCP response message over a period of time. There is no need to calculate TPS during the TCP connection handshake process. Therefore, TPS indicators can be measured in both long and short connection scenarios, and there is no need to manually specify the service port, achieving fully automated measurement.

[0020] In second aspect, an embodiment of the present application provides a performance measurement device for an application, which is configured on a server side and includes: an acquisition module for acquiring at least two timestamps of a Transmission Control Protocol TCP message on a transmission path of a network protocol stack, wherein the TCP message includes at least one of a TCP request message sent by a client of the application under test or a first TCP response message corresponding to the TCP request message, and the at least two timestamps include a first timestamp when the socket layer in the network protocol stack sends the first TCP response message or a second timestamp when the network interface card NIC layer in the network protocol stack receives the TCP request message; a determination module for determining the performance indicator of the application under test based on the at least two timestamps.

[0021] In one embodiment of the present application, when the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a TCP acknowledgment message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, which is the timestamp when the TCP / Internet Protocol (IP) layer in the network protocol stack receives the TCP acknowledgment message; the performance indicator of the application under test includes the first segment delay of the application under test, and the first segment delay is the difference between the third timestamp and the first timestamp.

[0022] In one embodiment of the present application, when the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, which is the timestamp when the TCP / IP layer in the network protocol stack receives the TCP confirmation message; the performance indicator of the application under test includes the total delay of the application under test, and the total delay is the difference between the third timestamp and the second timestamp.

[0023] In one embodiment of the present application, when the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the second segment delay of the application under test, and the second segment delay of the application under test is the difference between the fourth timestamp and the second timestamp.

[0024] In one embodiment of the present application, when the TCP message includes the TCP request message and the first TCP response message, and the at least two timestamps include the first timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the third segment delay of the application under test, and the third segment delay is the difference between the first timestamp and the fourth timestamp.

[0025] In one embodiment of the present application, when the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a second TCP response message, and the at least two timestamps also include a fifth timestamp, where the fifth timestamp is the timestamp when the socket layer in the network protocol stack sends the second TCP response message; the performance indicator of the application under test includes a transaction processing volume per second TPS, and the TPS is a ratio of a sequence number difference to a time difference, wherein the sequence number difference is a difference between a second sequence number and a first sequence number, and the time difference is a difference between the fifth timestamp and the first timestamp, the first sequence number is a sequence number corresponding to the first TCP response message, and the second sequence number is a sequence number corresponding to the second TCP response message.

[0026] In a third aspect, a network device is provided, comprising a processor coupled to a memory, wherein the memory stores at least one program instruction or code, and the at least one program instruction or code is loaded and executed by the processor so that the network device implements the method for measuring the performance of any application in the first aspect.

[0027] In a fourth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one program instruction or code, which, when loaded and executed by a processor, enables a computer to implement a method for measuring the performance of an application as described in any one of the first aspects.

[0028] In a fifth aspect, a system for measuring the performance of an application is provided, the system including a client and a server of the application under test, the client being used to send a TCP request message, and the server being used to execute the performance measurement method of any application in the first aspect.

[0029] In a sixth aspect, a communication device is provided, comprising: a transceiver, a memory, and a processor. The transceiver, the memory, and the processor communicate with each other via an internal connection path. The memory is configured to store instructions, and the processor is configured to execute the instructions stored in the memory to control the transceiver to receive signals and to control the transceiver to transmit signals. When the processor executes the instructions stored in the memory, the processor performs the method according to the first aspect or any possible implementation of the first aspect.

[0030] As an exemplary embodiment, there are one or more processors and one or more memories.

[0031] As an exemplary embodiment, the memory may be integrated with the processor, or the memory may be provided separately from the processor.

[0032] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips. The embodiments of the present application do not limit the type of memory and the setting method of the memory and the processor.

[0033] In a seventh aspect, a computer program (product) is provided, which includes: computer program code, which enables the computer to execute the methods in the above aspects when the computer program code is executed by the computer.

[0034] In an eighth aspect, a chip is provided, comprising a processor for calling and executing instructions stored in a memory from a memory, so that a communication device equipped with the chip executes the methods in the above aspects.

[0035] In the ninth aspect, another chip is provided, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the methods in the above aspects.

[0036] The technical effects that can be achieved in any of the second to ninth aspects mentioned above can refer to the description of the beneficial effects in the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] FIG1 is a system architecture diagram of a Kmon measurement tool provided by related art;

[0038] FIG2 is a schematic diagram of a TCP message sequence sorted by timestamp in the related art;

[0039] FIG3 is a schematic diagram of the delay interval collected by the Kmon tool in a request in the related art;

[0040] FIG4 is a schematic diagram of an application scenario of a performance measurement method for an application program provided in an embodiment of the present application;

[0041] FIG5 is a flow chart of a method for measuring the performance of an application program provided in an embodiment of the present application;

[0042] FIG6 is a structural diagram of a delay measurement system for an application provided in an embodiment of the present application;

[0043] FIG7 is a flowchart of a method for measuring delay of an application program provided in an embodiment of the present application;

[0044] FIG8 is a flowchart of a timestamp corresponding to a TCP request message received by a NIC layer according to an embodiment of the present application;

[0045] 9 is a flowchart of a timestamp corresponding to a TCP request message received by a socket layer according to an embodiment of the present application;

[0046] 10 is a flowchart of a timestamp when a socket layer sends a TCP response message according to an embodiment of the present application;

[0047] 11 is a flowchart of a timestamp corresponding to when a TCP / IP layer receives a TCP confirmation message according to an embodiment of the present application;

[0048] FIG12 is a schematic diagram of a TPS measurement method according to an embodiment of the present application;

[0049] FIG13 is a flow chart of a method for measuring TPS provided in an embodiment of the present application;

[0050] FIG14 is a schematic diagram of another scenario for measuring TPS provided in an embodiment of the present application;

[0051] FIG15 is a schematic diagram of the structure of a performance measurement device for an application program provided in an embodiment of the present application;

[0052] FIG16 is a schematic diagram of the structure of a network device provided in an embodiment of the present application;

[0053] FIG17 is a schematic diagram of the structure of a network device provided in an embodiment of the present application;

[0054] FIG18 is a schematic structural diagram of a network device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] The terms used in the implementation section of this application are only used to explain the embodiments of this application and are not intended to limit this application.

[0056] The following describes the application performance measurement method, apparatus, network device, system, and storage medium provided in the embodiments of the present application in conjunction with the accompanying drawings.

[0057] Currently, various applications are increasingly being used to solve practical problems across various industries. However, in practice, some applications place high demands on performance. Application performance refers to the performance of an application when running on a server. To optimize application performance, it's often necessary to test the application's performance in conjunction with the server's network protocol stack.

[0058] In the field of information technology and system management, APM monitors and manages the performance of applications. APM is dedicated to detecting and diagnosing performance issues in applications and continuously provides a series of application performance indicators. Among them, in application performance management, two groups of performance indicators are closely monitored. The first group of performance indicators defines the performance experienced by the end user of the application. The first group of performance indicators includes but is not limited to load and response time; load is the amount of transactions processed by the application, such as TPS, requests per second (RPS), and queries per second (QPS). Response time is the time required for the application to respond to user operations under the aforementioned load. The second group of performance indicators measures the computing resources used by the application for the load, indicating whether there is sufficient capacity to support the load and the possible location of performance bottlenecks.

[0059] In related technologies, APM solutions are mainly divided into two categories: one is to obtain application performance indicators through simulation testing, and the other is to detect the actual operation data of the application through real user access, and then calculate the application performance indicators. Obtaining application performance indicators through simulation testing means actively collecting and analyzing performance data by simulating users to initiate page access requests on the application client. This method does not affect the actual user experience, but because it simulates user access requests on the page, not actual application access requests, it cannot reflect the actual performance status of the application.

[0060] There are three main types of APM based on real user access:

[0061] The first method uses a system-based indicator measurement tool to obtain device resource usage indicators, indirectly reflecting changes in application performance. For example, using a system-based indicator measurement tool to measure basic resource usage indicators at the operating system level indirectly reflects changes in application performance. Resource usage indicators can include network performance indicators, disk usage, and central processing unit (CPU) usage. However, this method only indirectly reflects application performance indicators through device resource usage indicators and cannot accurately obtain application performance indicators.

[0062] The second category involves using application-specific performance measurement tools to measure the performance metrics of specific applications. Application-specific performance measurement tools lack universality. Some application-specific performance measurement tools are specific to specific programming languages. For example, the Java Flight Recorder (JFR) tool can collect data about the Java Virtual Machine (JVM) and the Java applications running on it; however, it cannot measure the performance metrics of applications built in other programming languages. Some application-specific performance measurement tools require a specific underlying architecture. For example, Istio is an open platform for service governance suitable for service meshes, but is not suitable for other server-side configurations. Some application-specific performance measurement tools require application code adaptation. For example, OpenTelemetry is an open source observability framework consisting of a series of tools, application programming interfaces (APIs), and software development kits (SDKs). In summary, application-specific performance measurement tools are application-specific and lack universality.

[0063] The third category is application performance measurement tools based on the network protocol stack, such as the remote network monitoring tool (Kmon) and the system analysis kit (sysAK). These tools can measure application performance indicators and are versatile. Kmon is used as an example in the present embodiment.

[0064] Among them, Kmon can observe the message sending and receiving points on the TCP / IP layer of the network protocol stack. Exemplarily, Figure 1 is a system architecture diagram of a Kmon measurement tool provided in an embodiment of the present application. As shown in Figure 1, the Kmon measurement tool mainly includes: a data providing module (provider), a data collection module (collector), an eBPF program and an output module (exporter). Among them, the provider directly collects upper-layer application information, for example: the upper-layer application information includes microservice information (micorservice), system information (host), etc., and sends the collected upper-layer application information to the collector. The collector is responsible for interacting with the eBPF program, the collector loads the eBPF program into the kernel of the server, the collector controls the running status of the eBPF program, and the collector converts and aggregates the data output by the eBPF program. The eBPF program is mounted in the function related to TCP sending and receiving, and the function related to TCP sending and receiving is the function of the TCP / IP layer of the network protocol stack deployed in the server. When the TCP message sent by the client reaches the TCP / IP layer, the functions related to TCP sending and receiving are called, which triggers the eBPF program to measure the performance of the application, obtain the performance indicators of the application and store them in the eBPF storage structure, such as the eBPF memory (instructions) in Figure 1, also known as eBPF Maps (control). The exporter can export the performance indicators of the application from the eBPF storage structure and store the performance indicators of the application in the database. For example, the eBPF memory (data) in Figure 1 is also called eBPF Map (data). The eBPF map is a general data structure used to store different types of data.

[0065] The eBPF program is a virtual machine running in the kernel. When mounted in the operating system kernel, the eBPF program can capture kernel packets and implement packet filtering, such as through the conditional filter shown in Figure 1. The eBPF program extends the register and instruction set definitions, improving the virtual machine's performance and enabling it to handle more complex programs. Furthermore, the eBPF program adds a key-value storage structure that can store state information and pass it from one eBPF event handler to another, or store statistics and pass them from the kernel to user-mode programs. Finally, eBPF can register with more kernel code hooks, enabling it to handle a wider range of kernel events. In summary, the eBPF program provides a versatile capability for efficiently and securely executing specific code based on system or program events. eBPF can be used to develop a variety of tools and platforms, including network analysis, performance analysis, system tracing, and network optimization.

[0066] Furthermore, the upper-layer application information that the provider needs to collect is shown in Table 1, mainly including: process identification (PID), which is mainly used to identify the receiving end of the TCP request message; service name, which is mainly used to convert the PID into a service name with read capabilities; Internet Protocol (IP) listen list, which is used to identify the persistent connection server.

[0067] Table 1

[0068] The application information that the eBPF program needs to collect is shown in Table 2. The TCP send function (tcp_sendmsg) is the send function in the TCP protocol, and the TCP buffer cleanup function (tcp_cleanup_rbuf) is the function used to clear the buffer in the TCP protocol. If the copy field in the tcp_cleanup_rbuf function is greater than 0, it indicates that the client has read the TCP response message. By obtaining information from the tcp_sendmsg and tcp_cleanup_rbuf functions, the eBPF program can obtain the time when the TCP / IP layer receives the TCP request message and sends the TCP response message, and then calculate the TCP message latency based on these times. The socket link establishment function (ssecurity_socket_accept) is a function used in the TCP protocol to characterize the establishment of a socket link. The TCP close function (tcp_close) is a function used in the TCP protocol to characterize the closure of TCP. By obtaining information from the tcp_sendmsg function and the tcp_cleanup_rbuf function, the eBPF program can obtain the time when the APP layer and the TCP / IP layer establish and disconnect the connection, and then identify the connected server.

[0069] Table 2

[0070] In summary, the eBPF program hooks into functions related to TCP transmission and reception. When a TCP request packet sent by the client reaches the TCP / IP layer on the server, the functions related to TCP transmission and reception in the server's host operating system kernel are called, triggering the eBPF program to measure application performance and obtain the timestamps of each TCP request packet and the timestamps of the sent TCP response packets.

[0071] Furthermore, FIG2 is a schematic diagram of a sequence of TCP messages sorted by timestamps in an embodiment of the present application. As shown in FIG2 , the eBPF program calculates the delay of the TCP message by subtracting the timestamp T1 of the first TCP message received by the TCP / IP layer (tcp_sendmsg) from the timestamp T2 of the last TCP message sent by the TCP / IP layer (tcp_cleanup_rbuf), that is, the TCP message time is T2-T1. The timestamp of the received TCP message refers to the timestamp corresponding to when the TCP / IP layer receives the TCP request message forwarded by the traffic shaping layer, and the timestamp of the sent TCP message refers to the timestamp corresponding to when the TCP / IP layer sends the TCP response message corresponding to the TCP request message to the flow shaping layer.

[0072] In summary, the Kmon tool can effectively obtain the delay in the transmission path from the TCP request message from the TCP / IP layer to the APP layer, where the APP layer processes the TCP request message, generates a TCP response message corresponding to the TCP request message, and returns the TCP response message to the TCP / IP layer. However, this method cannot fully and accurately reflect the user's actual request delay. Figure 3 is a schematic diagram of the delay interval collected by the Kmon tool in a TCP request in an embodiment of the present application. As shown in Figure 3, in a TCP request, the TCP request message (request) sent by the client passes through the basic network, NIC layer, TCP / IP layer, socket layer and APP layer in sequence. The APP layer processes the TCP request message and obtains a TCP response message (response) corresponding to the TCP request message. Then, the TCP response message passes through the socket layer, TCP / IP layer, NIC layer and basic network in sequence and returns to the client. After receiving the TCP response message, the client processes the TCP response message and generates a TCP confirmation (TCP acknowledge, TCP ACK) message corresponding to the TCP response message. Finally, the client sends the TCP confirmation message through the basic network and NIC layer in sequence to the TCP / IP layer of the server. Furthermore, as shown in Figure 3, the latency range collected by the kmon tool only covers the portion above the TCP / IP layer (the bold line in Figure 3), such as the TCP / IP layer, socket layer, and application layer. It does not cover the portion below the TCP / IP layer (the dashed line in Figure 3), such as the traffic control (TC) layer, NIC layer, and underlying network layer. Therefore, this method is not accurate in measuring application performance and cannot obtain accurate application performance indicators.

[0073] Furthermore, the performance indicators of an application also include TPS. In related technologies, the method for calculating the TPS indicator of a service based on TCP connection data is mainly as follows: the server runs on a computer operating system (Unix or Linux platform) and calculates the TPS indicator of the target service through a scheduled task. Since various services correspond to their own ports, the port configuration is specified through the firewall (iptables), and the number of TCP close messages sent and received per second by the server during the four TCP handshakes is counted. The number of TCP close messages in the four TCP handshakes per second is obtained, and the minimum value obtained is the TPS of the application. Among them, iptables is an IP packet filtering system integrated with the Linux kernel. This system is conducive to better control of IP packet filtering and firewall configuration on the Linux system.

[0074] However, in the above TPS measurement method, the number of TCP close messages counted can only be detected and counted during the TCP disconnection process, which is not suitable for long-connection services. In addition, the above method requires manual specification of the service port before use and cannot be fully automated.

[0075] In one embodiment of the present application, the application scenario of the embodiment of the present application, that is, the architecture of the network protocol stack is described. Figure 4 is a schematic diagram of the application scenario of a performance measurement method of an application provided by an embodiment of the present application. The present application mainly implements the measurement of performance indicators of the application based on the network protocol stack. Figure 4 shows the complete process of a TCP request, including: the application's client sends a TCP request message to the server. After the server's NIC layer receives the TCP request message, it forwards the TCP request message to the TCP / IP layer through the TC layer. The TCP / IP layer then sends the TCP request message to the APP layer through the socket layer. After receiving the TCP request message, the APP layer processes the TCP request message to obtain a TCP response message corresponding to the TCP request message. The APP layer then sends the TCP response message to the application's client through the socket layer, TCP / IP layer, TC layer, and NIC layer in sequence. After receiving the TCP response message, the application's client processes the TCP response message to obtain a TCP acknowledgment message corresponding to the TCP message, and sends a TCP acknowledgment message to the server's TCP / IP layer. The TCP acknowledgment message is used to inform the server that the application's client has received the TCP response message.

[0076] The socket layer is an abstraction layer between the application layer and the TCP / IP layer in the network protocol stack. In the TCP protocol, each process establishing a connection is identified by a socket, and the socket pair formed by these two sockets uniquely identifies a connection.

[0077] An embodiment of the present application provides a performance measurement method for an application. FIG5 is a flowchart of a performance measurement method for an application provided by an embodiment of the present application. The performance measurement method for the application is mainly applied to a server that interacts with a client based on a network protocol stack. The server can be a server, such as a central server, an edge server, or a local server in a local data center. The server can be a physical server or a cloud server that provides cloud computing services. The client can be a terminal, such as a desktop computer, a laptop computer, or a smart phone. The client can also be a server or other device capable of running an application. As shown in FIG5 , the performance measurement method for an application provided by an embodiment of the present application mainly includes steps S101-S102.

[0078] S101. Obtain at least two timestamps of a TCP message on a transmission path of a network protocol stack, where the TCP message includes at least one of a TCP request message sent by a client of the application under test or a first TCP response message corresponding to the TCP request message, and the at least two timestamps include a first timestamp when the socket layer in the network protocol stack sends the first TCP response message or a second timestamp when the NIC layer in the network protocol stack receives the TCP request message.

[0079] In an embodiment of the present application, if the NIC layer of the server receives a TCP request message sent by the client of the application under test for the first time, a TCP connection object is created. Creating a TCP connection object refers to establishing a TCP connection between the client and the server of the application under test. Once a TCP connection object is established, it is a two-way conversation, that is, the client can send information to the server, and the server can also send information to the client. Furthermore, the creation of a TCP connection object can be initiated by either party of the TCP communication. In other words, the client can initiate a request to create a TCP connection object to the server, or the server can initiate a request to create a TCP connection object to the client.

[0080] In an embodiment of the present application, the complete processing flow of a TCP request message is as follows: the client sends a TCP request message, and the TCP request message passes through the basic network, NIC layer, TC layer, TCP / IP layer, socket layer and APP layer in sequence. The APP layer processes the TCP request message and obtains the first TCP response message corresponding to the TCP request message. Then, the first TCP response message passes through the socket layer, TCP / IP layer, TC layer, NIC layer and basic network in sequence and returns to the client. After the client receives the first TCP response message, it processes the first TCP response message and generates a TCP confirmation message corresponding to the first TCP response message. Finally, the client sends the TCP confirmation message through the basic network, NIC layer, and TC layer to the TCP / IP layer in sequence. The network protocol stack deployed in the server includes the NIC layer, TC layer, TCP / IP layer, socket layer and APP layer. Furthermore, the above-mentioned TCP request message, the first TCP response message and the TCP confirmation message are in a one-to-one correspondence.

[0081] The timestamp of a TCP message in the transmission path can be understood as the timestamp corresponding to when the TCP message reaches or leaves a layer in the network protocol stack. In one embodiment of the present application, the at least two timestamps include: a first timestamp when the socket layer in the network protocol stack sends the first TCP response message, a second timestamp when the NIC layer in the network protocol stack receives the TCP request message, a third timestamp when the TCP / IP layer in the network protocol stack receives the TCP acknowledgment message, and a fourth timestamp when the socket layer in the network protocol stack receives the TCP request message.

[0082] In one embodiment of the present application, there is a kernel structure (sock) in the network protocol stack, and sock and socket are in a one-to-one correspondence. Sock runs through each layer in the network protocol stack and can be used to receive, store and send the relevant information of TCP messages in each layer in the network protocol stack. Wherein, the above-mentioned relevant information includes the corresponding timestamp of the TCP message in each layer. Wherein, the relevant information corresponding to all TCP connection objects can be stored in the sock kernel structure. Based on the TCP connection object between the client and the server of the application under test, the timestamp of the TCP message corresponding to the TCP connection object is screened out in the relevant information stored in the sock structure.

[0083] For example, if the performance indicators of the tested application 1 are to be measured, the corresponding TCP connection object 1 is searched for in the relevant information stored in the sock using connection object 1 as the keyword, and the timestamps of the TCP packets corresponding to connection object 1 at each layer are searched. If the performance indicators of the tested application N are to be measured, the corresponding TCP connection object N is to be searched for in the relevant information stored in the sock using connection object N as the keyword, and the timestamps of the TCP packets corresponding to connection object N at each layer are searched.

[0084] It should be noted that in the embodiment of the present application, the timestamps corresponding to the TCP messages in each layer can be obtained from the sock, and the timestamps corresponding to the TCP messages in each layer of the network protocol stack can be recorded by mounting other programs or codes in the network protocol stack. In the embodiment of the present application, the method of obtaining the timestamps corresponding to the TCP messages in each layer is not limited.

[0085] In one embodiment of the application, a connection table corresponding to multiple TCP connection objects can be obtained from the sock, as shown in Table 3. The connection table contains multiple connection objects, and the connection objects are arranged in sequence numbers, for example: connection object 1, ..., connection object N. Each TCP connection object corresponds to round-trip time (RTT) sampling information and TPS sampling information. For example: the RTT sampling information of TCP connection object 1 is RTT data 1, the TPS sampling information of TCP connection object 1 includes TPS data 1, the RTT sampling information of TCP connection object N is RTT data N, and the TPS sampling information of TCP connection object N includes TPS data N. As shown in Table 4, each RTT sampling information mainly includes the current request status, timestamp and message sequence number. As shown in Table 5, each TPS sampling information mainly includes two parts of information, a timestamp and a sequence number. The timestamp TT2 corresponds to the currently sent sequence number TN2, and the timestamp TT1 corresponds to the last sent sequence number TN1.

[0086] Table 3

[0087] Table 4

[0088] Table 5

[0089] S102: Determine a performance indicator of the application under test based on at least two timestamps.

[0090] In an embodiment of the present application, after the server receives the TCP request message sent by the client of the application under test, it obtains at least two timestamps formed by the TCP message in the transmission path, and then can select any two timestamps from the above at least two timestamps to determine the performance indicators of the application under test.

[0091] Because any two timestamps along the transmission path can be obtained, the performance metrics of any segment of the transmission path can be determined, rather than just measuring the performance metrics between specific transmission intervals. This allows for more accurate determination of the performance metrics of the application being tested, thus resolving the issue of inaccurate performance metric detection for applications.

[0092] In one embodiment of the present application, the performance indicator of the application under test includes at least one of the network delay of the application under test or the TPS of the application under test, wherein the network delay of the application under test includes at least one of the total delay of the application under test or the segmented delay of the application under test. In this embodiment of the present application, the delay of the application under test can be measured using at least two timestamps, which solves the problem of inaccurate application delay measurement. In addition, the TPS of the application under test can also be measured using at least two timestamps, which can be applied to measuring the TPS indicator of the application under test in long link scenarios.

[0093] Total latency refers to the time it takes for a TCP packet to complete its entire transmission path within the network protocol stack. For example, total latency is the time it takes for the NIC layer to receive a TCP request packet and for the TCP / IP layer to receive the corresponding TCP acknowledgment packet. Segmental latency refers to the latency between any one or more layers in the network protocol stack, and segmental latency is a portion of total latency.

[0094] Determining the latency of the application under test based on at least two timestamps can more accurately measure the network latency of the application under test, solving the problem of inaccurate application latency measurement. Alternatively, determining the TPS of the application under test based on at least two timestamps can be applicable to measuring the TPS indicator of the application under test in long connection scenarios. It should be noted that the method for determining the network latency of the application under test and the method for determining the TPS of the application under test can be selected and executed alone, or both methods can be executed simultaneously.

[0095] Based on the above embodiments, a method for measuring the delay of an application is provided in an embodiment of the present application. FIG6 is a structural diagram of a delay measurement system for an application provided in an embodiment of the present application, and FIG7 is a flow chart of a delay measurement method for an application provided in an embodiment of the present application. The delay measurement method for an application provided in an embodiment of the present application is described below with reference to FIG6 and FIG7. As shown in FIG7, the delay measurement method for an application provided in an embodiment of the present application mainly includes the following steps:

[0096] S201. Create a TCP connection object.

[0097] In the embodiment of the present disclosure, when the NIC layer receives a TCP request message, the server determines whether it is the first time to receive the TCP request message sent by the client of the application under test. If the NIC layer of the server receives the TCP request message sent by the client of the application under test for the first time, a TCP connection object is created.

[0098] S202: Obtain a timestamp corresponding to when the NIC layer receives the TCP request message, and record it as a second timestamp TS2.

[0099] In an embodiment of the present disclosure, when the NIC layer in the server receives a TCP request message sent by the client, the timestamp corresponding to the TCP request message received by the NIC layer is recorded as the second timestamp TS2, and the connection state of the TCP connection object is recorded as start sampling.

[0100] In one possible implementation, as shown in FIG6 , step S202 may be performed by the network card interrupt processing module shown in FIG6 , wherein the network card interrupt processing module may be deployed at the NIC layer. The connection state of the TCP connection object being "start sampling" means that sampling of this TCP message starts from the current timestamp.

[0101] S203: Obtain the timestamp corresponding to when the socket layer receives the TCP request message, and record it as the fourth timestamp TS4.

[0102] In the embodiment of the present disclosure, the TCP request message enters the TCP protocol stack queue. After the application is scheduled by the system, the socket layer starts to read the TCP request message. At this time, the connection state of the TCP connection object is modified to the request received, and the fourth timestamp TS4 corresponding to the reception of the TCP request message by the socket layer is recorded.

[0103] In one possible implementation, as shown in FIG6 , step S203 may be performed by the application request processing module shown in FIG6 , wherein the application request processing module may be deployed at the socket layer. The connection state of the TCP connection object is "request received," indicating that the TCP packet being transmitted has been received by the socket layer.

[0104] S204. Obtain the timestamp of the TCP response message sent by the socket layer, and record it as the first timestamp TS1.

[0105] In the embodiment of the present application, after the APP layer completes service processing, it generates a TCP response message corresponding to the TCP request message. The APP layer sends the TCP response message to the socket layer, which then sends the TCP response message to the client via the TCP / IP layer, the NIC layer, and the underlying network layer. The timestamp of the time when the socket layer sends the TCP response message to the TCP / IP layer is recorded as the first timestamp TS1, and the connection state of the TCP connection object is recorded as "response sent."

[0106] In one possible implementation, as shown in FIG6 , step S204 may be performed by the application request processing module shown in FIG6 . The application request processing module may be deployed at the socket layer. The TCP connection object's connection status is "response sent," indicating that the TCP response message for this transmission has been sent by the socket layer.

[0107] S205 : Obtain the timestamp corresponding to when the TCP / IP layer receives the TCP confirmation message, and record it as a third timestamp TS3 .

[0108] In an embodiment of the present application, according to the TCP protocol, after the client receives the TCP response message sent by the server, it will generate a corresponding TCP confirmation message. The TCP confirmation message will carry the sequence number of the received TCP response message, record the third timestamp TS3 corresponding to the TCP confirmation received by the TCP / IP layer, and record the connection status of the TCP connection object as request response completed. In one possible implementation, as shown in Figure 6, step S205 can be performed by the response matching module shown in Figure 6. Among them, the response matching module can be deployed in the TCP / IP layer. The connection status is request response completed, which means that the transmission process of this TCP message has ended.

[0109] In one embodiment of the present application, in the process of sending a TCP response message at the socket layer, the sequence number of the TCP response message is recorded. After the TCP response message reaches the client, the client processes the TCP response message, obtains a TCP confirmation message corresponding to the TCP response message, and adds the sequence number of the TCP response message to the TCP confirmation message. Then, the client sends the TCP confirmation message to the TCP / IP layer of the server. After receiving the TCP confirmation message, the TCP / IP layer parses the TCP confirmation message to obtain the message sequence number it carries. The sequence number carried in the TCP confirmation message is compared with the sequence number of the recorded TCP response message. If the sequence number carried in the TCP confirmation message is consistent with the sequence number of the recorded TCP response message, it indicates that the TCP confirmation message is a confirmation message for the TCP response message, and then the timestamp of the TCP / IP layer receiving the TCP confirmation message is used as the third timestamp TS3.

[0110] In the disclosed embodiment, after receiving the TCP acknowledgment message sent by the client, the TCP / IP layer first performs a sequence number match. Once the match is successful, it then records the timestamp. This ensures that the recorded timestamp is for the same TCP message, thereby ensuring latency accuracy. In this embodiment, after steps S202-S205, the RTT sampling information obtained is shown in Table 6.

[0111] Table 6

[0112] S206 : Calculate the network delay of the application under test based on the difference between the two timestamps.

[0113] In the embodiment of the present disclosure, the delay of the application under test can be obtained by taking the difference between any two timestamps obtained in the above steps.

[0114] In one embodiment of the present application, a TCP message includes a first TCP response message corresponding to a TCP request message and a TCP acknowledgment message corresponding to the TCP request message; at least two timestamps include a first timestamp and a third timestamp, the third timestamp being the timestamp when the TCP / Internet Protocol (IP) layer in the network protocol stack receives the TCP acknowledgment message; the performance indicator of the application under test includes a first segment delay of the application under test, and the first segment delay is the difference between the third timestamp and the first timestamp.

[0115] In an embodiment of the present application, the timestamp of the TCP acknowledgment message received by the TCP / IP layer in the network protocol stack is subtracted from the timestamp of the TCP response message sent by the socket layer, and the difference is used as the first segment delay. This can accurately measure the delay between the transmission path from the socket layer sending the first TCP response message, the client responding to the first TCP response message and generating a TCP acknowledgment message, and the client returning the TCP acknowledgment message to the TCP / IP layer of the server. In other words, the first segment delay can reflect the delay of the first TCP response message in the sending direction. Since the first TCP response message needs to pass through the underlying network when it is sent from the server to the client, and the TCP acknowledgment message also passes through the underlying network when it is sent from the client to the server, the first segment delay can reflect the impact of the underlying network delay on the round-trip delay of the application under test.

[0116] In one embodiment of the present application, the TCP message includes a TCP request message and a TCP acknowledgment message corresponding to the TCP request message; the at least two timestamps include a second timestamp and a third timestamp, and the third timestamp is the timestamp when the TCP / IP layer in the network protocol stack receives the TCP acknowledgment message; the performance indicator of the application under test includes the total delay of the application under test, and the total delay is the difference between the third timestamp and the second timestamp.

[0117] In an embodiment of the present application, the timestamp when the TCP / IP layer in the network protocol stack receives the TCP acknowledgment message is subtracted from the timestamp when the NIC layer receives the TCP request message as the total delay of the application under test. The total delay of the application under test in the entire transmission path can be accurately measured, from the time when the server receives the TCP request message, the server generates a first TCP response message based on the TCP request message, and sends the first TCP response message to the client. After the client receives the first TCP response message, it generates a TCP acknowledgment message and sends the TCP acknowledgment message to the server. The server receives the TCP acknowledgment message. In other words, the delay of the entire transmission path from the user's actual request to the completion of the confirmation request response can be accurately measured on the server.

[0118] In one embodiment of the present application, the TCP message includes a TCP request message; the at least two timestamps include a second timestamp and a fourth timestamp, wherein the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the second segment delay of the application under test, and the second segment delay of the application under test is the difference between the fourth timestamp and the second timestamp.

[0119] In this embodiment of the present application, the timestamp of the TCP request message received by the socket layer in the network protocol stack is subtracted from the timestamp of the TCP request message received by the NIC layer. The difference is used as the second segment delay. This accurately measures the delay between the transmission path from the NIC layer receiving the TCP request message to the socket layer receiving the TCP request message. During the transmission of the TCP request message from the NIC layer to the socket layer, the server-side operating system calls the application program at the application layer. Therefore, the second segment delay can reflect the scheduling delay of the operating system scheduling the application program.

[0120] In one embodiment of the present application, the TCP message includes a TCP request message and a first TCP response message corresponding to the TCP request message; at least two timestamps include a first timestamp and a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the third segment delay of the application under test, and the third segment delay is the difference between the first timestamp and the fourth timestamp.

[0121] In this embodiment of the present application, the first timestamp of the first TCP response message sent by the socket layer in the network protocol stack is subtracted from the fourth timestamp of the TCP request message received by the socket layer to form the third segment delay. This accurately measures the delay between the transmission path from the socket layer receiving the TCP request message, to the APP layer processing the TCP request message to obtain the first TCP response message, to the APP layer sending the first TCP response message to the socket layer, and finally to the socket layer sending the first TCP response message. In other words, the third segment delay can reflect the delay of the application in the APP layer processing the TCP request message.

[0122] In an embodiment of the present application, a method for a network card interrupt module to collect RTT sampling information is provided. Figure 8 is a flowchart provided by an embodiment of the present disclosure for recording the second timestamp corresponding to the TCP request message received by the NIC layer; as shown in Figure 8, after the client sends a TCP request message, the TCP request message enters the NIC layer of the network protocol stack from the basic network, and the NIC layer copies the TCP request message to the kernel memory of the server. At this time, the NIC layer generates an interrupt signal, and the interrupt signal is used to inform the kernel that a TCP request message has been received. When processing the interrupt signal, the network card interrupt processing module determines whether the server has received the TCP request message of the current TCP connection object for the first time. If the server has received the TCP request message of the current TCP connection object for the first time, a TCP connection object is created and the information of the TCP connection object is recorded in the connection table. As shown in Table 7, in the connection table, the current TCP connection object is recorded as connection object N, and the second timestamp TS2 corresponding to the TCP request message received by the NIC layer is recorded. At the same time, the connection status of the connection object N is recorded as starting sampling.

[0123] Table 7

[0124] In an embodiment of the present application, a method for an application request processing module to collect RTT sampling information is provided. Figure 9 is a flowchart of the fourth timestamp corresponding to the TCP request message received by the socket layer provided in the embodiment of the present disclosure; as shown in Figure 9, the TCP request message is processed by the TCP / IP kernel protocol stack and finally enters the TCP protocol stack receiving queue. At this time, after the application is scheduled by the system, the socket layer begins to read the TCP request message from the TCP protocol stack, and the application request processing module records the relevant information of the connection object N. As shown in Table 8, under the connection object N in the connection table, the fourth timestamp TS4 corresponding to the TCP request message received by the socket layer is recorded, and the connection status of the connection object N is recorded as the request has been received.

[0125] Table 8

[0126] In an embodiment of the present application, a method for an application response processing module to collect RTT sampling information is provided. Figure 10 is a flowchart of the first timestamp of the first TCP response message sent by the socket layer provided in the embodiment of the present disclosure; as shown in Figure 10, after the APP layer completes the business processing, when the first response TCP message is sent, the application response processing module records the relevant information of the connection object N. As shown in Table 9, under the connection object N in the connection table, the first timestamp TS1 of the first TCP response message sent by the socket layer is recorded, and the TCP connection status is recorded as the response has been sent. Furthermore, the sequence number of the first TCP response message sent by the socket layer is recorded.

[0127] Table 9

[0128] In one embodiment of the present application, a method for collecting RTT sampling information by a response matching module is provided. FIG11 is a flowchart of the third timestamp of the TCP / IP layer receiving the TCP confirmation message provided by the embodiment of the present disclosure; As shown in FIG11, the first TCP response message is processed by the TCP / IP core protocol stack, sent to the basic network through the NIC layer, and finally received by the client. According to the TCP protocol, after the client receives the first TCP response message from the server, a TCP confirmation message corresponding to the first TCP response message will be generated. When the server receives the TCP confirmation message, the response matching module will carry the sequence number of the first TCP response message corresponding to the TCP protocol in the TCP confirmation message. The response matching module queries the connection table for the sequence number of the first TCP response message sent by the connection object N. If the sequence number carried by the TCP confirmation message is consistent with the sequence number of the first TCP response message sent, then as shown in Table 10, under the connection object N in the connection table, the third timestamp TS3 corresponding to the TCP confirmation message received by the TCP / IP layer is recorded, and the connection status of the connection object N is recorded as the request response completed.

[0129] Table 10

[0130] In one embodiment of the present application, a method is provided for calculating the latency of a tested application using a statistics reporting module. After a complete TCP request sampling, the statistics reporting module calculates and reports the RTT sampling information for connection N, obtaining the latency of the application corresponding to connection N. The specific calculation method can be found in the description of the above embodiment.

[0131] Based on the above embodiment, the performance indicator of the tested application includes the TPS of the tested application. In the embodiment of the present application, a method for measuring the TPS of an application is provided. In the embodiment of the present application, the TPS measurement principle is: by collecting the sequence numbers of TCP packets sent by a TCP connection object at different times, the slope of the change of the sent sequence number over time is obtained, thereby obtaining the TPS of the application.

[0132] In one embodiment of the present application, a method for measuring the TPS of an application is provided. FIG12 is a schematic diagram of a TPS measurement method provided in an embodiment of the present disclosure. FIG13 is a flow chart of a method for measuring the TPS of an application provided in an embodiment of the present application. As shown in FIG13 , the steps for measuring the TPS of the application under test include:

[0133] S301. Obtain a first sequence number corresponding to a first TCP response message and a second sequence number corresponding to a second TCP response message.

[0134] In an embodiment of the present disclosure, as shown in FIG12 , the sequence number corresponding to the first TCP response message sent by the socket layer is obtained as the first sequence number TN1, and the sequence number corresponding to the second TCP response message sent by the socket layer is obtained as the second sequence number TN2. The first TCP response message and the second TCP response message are TCP messages sent by the socket layer at different time points in the same TCP connection object. Exemplarily, the second TCP response message is the TCP response message sent by the socket layer at the current time point, and the first TCP response message is the previous TCP response message sent by the socket layer.

[0135] S302: Obtain a first timestamp corresponding to the first TCP response message and a fifth timestamp corresponding to the second TCP response message.

[0136] In the disclosed embodiment, the first timestamp corresponding to the first TCP response message refers to the timestamp TT1 corresponding to the first TCP message sent by the socket layer in the network protocol stack, and the fifth timestamp corresponding to the second TCP response message refers to the timestamp TT2 corresponding to the second TCP response message sent by the socket layer. For example, the first sequence number may be the sequence number corresponding to the first TCP response message, and the corresponding first timestamp is also the timestamp corresponding to the first TCP response message sent by the socket layer. The second sequence number may be the sequence number corresponding to the second TCP response message sent by the socket layer, and the corresponding fifth timestamp is also the timestamp corresponding to the second TCP response message sent by the socket layer.

[0137] S303: Calculate the TPS of the application under test based on the first timestamp, the fifth timestamp, the first sequence number, and the second sequence number.

[0138] In one embodiment of the present application, TPS is the ratio of the sequence number difference to the time difference, wherein the sequence number difference is the difference between the second sequence number TN2 and the first sequence number TN1, and the time difference is the difference between the fifth timestamp TT2 and the first timestamp TT1.

[0139] The TPS of the application under test is determined by the TCP messages sent by the same TCP connection object in different time periods and the timestamps corresponding to each TCP message.

[0140] In one embodiment of the present application, as shown in FIG14 , the server receives a TCP request message 1 for the first time. After the APP layer completes the service processing, it generates a first TCP response message 1 corresponding to the TCP request message 1 and sends it to the socket layer. When the socket layer sends the first TCP response message 1, the application response processing module records the first timestamp TT1 and the first sequence number TN1 of the first TCP response message sent by the socket layer under the TCP connection object N in the connection table. The server receives a TCP request message 2 for the second time. After the APP layer completes the service processing, it generates a second TCP response message 2 corresponding to the TCP request message 2 and sends it to the socket layer. When the socket layer sends the second TCP response message 2, the application response processing module records the fifth timestamp TT2 and the second sequence number TN2 of the second TCP response message sent by the socket layer under the TCP connection object N in the connection table.

[0141] After the above two samplings, the statistical reporting module performs statistical calculations on the TPS sampling information of the connection object N, and calculates the application degree TPS = (TN2-TN1) / (TT2-TT1).

[0142] In the embodiment of the present application, since the timestamp represents the time node of the TCP response message in the network protocol stack, the TPS of the application under test is determined based on the changes in the sequence number of the TCP response message over a period of time. There is no need to calculate the TPS when the TCP connection is waved. Therefore, the TPS indicator can be measured in both long connection scenarios and short connection scenarios, and there is no need to manually specify the service port, which can achieve fully automated measurement. The TPS of the application under test is obtained by the changes in the TCP message over time, which can be calculated automatically.

[0143] The above introduces the method for measuring the performance of an application provided by an embodiment of the present application. Corresponding to the above method, an embodiment of the present application also provides a device for measuring the performance of an application. Figure 15 is a structural diagram of a performance measurement device for an application provided by an embodiment of the present application. The device is applied to a server, and the server is the server shown in any of the above Figures 4 to 14. Based on the following multiple modules shown in Figure 15, the performance measurement device 150 of the application shown in Figure 15 can perform all or part of the operations performed by the server. It should be understood that the device may include more additional modules than the modules shown or omit some of the modules shown therein, and the embodiment of the present application does not limit this. As shown in Figure 15, the device includes: an acquisition module 151, used to obtain at least two timestamps of a transmission control protocol TCP message on the transmission path of the network protocol stack, the TCP message includes at least one of a TCP request message sent by the client of the application under test or a first TCP response message corresponding to the TCP request message, and the at least two timestamps include a first timestamp when the socket layer in the network protocol stack sends the first TCP response message or a second timestamp when the network interface card NIC layer in the network protocol stack receives the TCP request message; a determination module 152, used to determine the performance indicators of the application under test based on the at least two timestamps.

[0144] Compared to the method in the related art where the eBPF program is mounted in the TCP / IP layer and in the TCP transmission and reception related functions, and the eBPF program is triggered to perform performance measurement when the TCP transmission and reception related functions are called, in the embodiment of the present application, since the second timestamp of the NIC layer in the network protocol stack receiving the TCP message or the first timestamp of the socket layer sending the first TCP response message can be obtained, and the NIC layer is below the TCP / IP layer, the performance indicators of the application under test at the layer below the TCP / IP layer can be measured, making it possible to more accurately measure the performance indicators of the application under test. This solves the problem of inaccurate performance indicator measurement of the application.

[0145] In one embodiment of the present application, when a TCP message includes a first TCP response message and at least two timestamps include a first timestamp, the TCP message also includes a TCP acknowledgment message corresponding to the TCP request message, and at least two timestamps also include a third timestamp, which is the timestamp when the TCP / Internet Protocol (IP) layer in the network protocol stack receives the TCP acknowledgment message; the performance indicator of the application under test includes a first segment delay of the application under test, and the first segment delay is the difference between the third timestamp and the first timestamp.

[0146] In an embodiment of the present application, the timestamp of the TCP acknowledgment message received by the TCP / IP layer in the network protocol stack is subtracted from the timestamp of the first TCP response message sent by the socket layer, and the difference is used as the first segment delay. This can accurately measure the delay between the transmission path from the socket layer sending the first TCP response message, the client responding to the first TCP response message and generating a TCP acknowledgment message, and the client returning the TCP acknowledgment message to the TCP / IP layer of the server. In other words, the first segment delay can reflect the delay of the first TCP response message in the sending direction. Since the first TCP response message needs to pass through the underlying network when it is sent from the server to the client, and the TCP acknowledgment message also passes through the underlying network when it is sent from the client to the server, the first segment delay can reflect the impact of the underlying network delay on the round-trip delay of the application under test.

[0147] In one embodiment of the present application, when the TCP message includes a TCP request message and at least two timestamps include a second timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and at least two timestamps also include a third timestamp, which is the timestamp when the TCP / IP layer in the network protocol stack receives the TCP confirmation message; the performance indicator of the application under test includes the total delay of the application under test, and the total delay is the difference between the third timestamp and the second timestamp.

[0148] In an embodiment of the present application, the timestamp when the TCP / IP layer in the network protocol stack receives the TCP acknowledgment message is subtracted from the timestamp when the NIC layer receives the TCP request message, and the difference is used as the total delay of the application under test. The total delay of the application under test in the entire transmission path can be accurately measured, from the time when the server receives the TCP request message, the server generates a first TCP response message based on the TCP request message, and sends the first TCP response message to the client, and after the client receives the first TCP response message, it generates a TCP acknowledgment message and sends the TCP acknowledgment message to the server, and the server receives the TCP acknowledgment message. In other words, the delay of the entire transmission path from the user's actual request to the completion of the confirmation request response can be accurately measured on the server.

[0149] In one embodiment of the present application, when the TCP message includes a TCP request message and at least two timestamps include a second timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the second segment delay of the application under test, and the second segment delay of the application under test is the difference between the fourth timestamp and the second timestamp.

[0150] In this embodiment of the present application, the timestamp of the TCP request message received by the socket layer in the network protocol stack is subtracted from the timestamp of the TCP request message received by the NIC layer to obtain the second segment delay. This accurately measures the delay between the transmission path from the time the TCP request message is received by the NIC layer to the time the TCP request message is received by the socket layer. During the transmission of the TCP request message from the NIC layer to the socket layer, the server-side operating system calls the application program at the application layer. Therefore, the second segment delay can reflect the scheduling delay of the operating system scheduling the application program.

[0151] In one embodiment of the present application, when the TCP message includes a TCP request message and a first TCP response message, and at least two timestamps include a first timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is the timestamp when the socket layer in the network protocol stack receives the TCP request message; the performance indicator of the application under test includes the third segment delay of the application under test, and the third segment delay is the difference between the first timestamp and the fourth timestamp.

[0152] In this embodiment of the present application, the timestamp of the first TCP response message sent by the socket layer in the network protocol stack is subtracted from the timestamp of the TCP request message received by the socket layer. The difference is used as the third segment delay. This can accurately measure the delay between the transmission path from the socket layer receiving the TCP request message, to the APP layer performing service processing on the TCP request message to obtain the first TCP response message, to the APP layer sending the first TCP response message to the socket layer, and to the socket layer receiving the first TCP response message. In other words, the third segment delay can reflect the delay of the application in the APP layer processing the TCP request message.

[0153] In one embodiment of the present application, when the TCP message includes a first TCP response message and at least two timestamps include a first timestamp, the TCP message also includes a second TCP response message, and the at least two timestamps also include a fifth timestamp, which is the timestamp when the socket layer in the network protocol stack sends the second TCP response message; the performance indicators of the application under test include transactions per second TPS, and TPS is the ratio of the sequence number difference to the time difference, wherein the sequence number difference is the difference between the second sequence number and the first sequence number, the time difference is the difference between the fifth timestamp and the first timestamp, the first sequence number is the sequence number corresponding to the first TCP response message, and the second sequence number is the sequence number corresponding to the second TCP response message.

[0154] In the embodiment of the present application, since the timestamp represents the time node of the TCP response message in the network protocol stack, the TPS of the application under test is determined based on the changes in the sequence number of the TCP response message over a period of time. There is no need to calculate TPS during the TCP connection handshake process. Therefore, TPS indicators can be measured in both long connection scenarios and short connection scenarios, and there is no need to manually specify the service port, which can achieve fully automated measurement.

[0155] It should be understood that the device provided in FIG. 15 is merely an example of the division of the functional modules described above when implementing its functions. In actual applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0156] The specific hardware structure of the server in the above embodiment is a network device 1600 shown in Figure 16, which includes a transceiver 1601, a processor 1602 and a memory 1603. The transceiver 1601, the processor 1602 and the memory 1603 are connected via a bus 1604. Among them, the transceiver 1601 is used to receive messages, the memory 1603 is used to store instructions or program codes, and the processor 1602 is used to call the instructions or program codes in the memory 1603 so that the server performs the relevant processing steps of the application performance measurement in the above method embodiment. In a specific embodiment, the network device 1600 of the embodiment of the present application may correspond to the server in each of the above method embodiments. The processor 1602 in the network device 1600 reads the instructions or program codes in the memory 1603, so that the network device 1600 shown in Figure 16 can perform all or part of the operations performed by the server.

[0157] The network device 1600 may also correspond to the apparatus shown in FIG. 15 . For example, the acquisition module 151 and the determination module 152 in FIG. 15 are equivalent to the processor 1602 .

[0158] Referring to Figure 17 , Figure 17 illustrates a schematic diagram of the structure of a network device 1700 provided in accordance with an exemplary embodiment of the present application. The network device 1700 shown in Figure 17 is configured to execute the operations described in the application performance measurement method of the aforementioned method embodiment. As shown in Figure 17 , the network device 1700 includes at least one processor 1701, a memory 1703, and at least one communication interface 1704.

[0159] The processor 1701 is, for example, a general-purpose central processing unit (CPU), a digital signal processor (DSP), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of the present application. For example, the processor 1701 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. It can implement or execute the various logic blocks, modules, and circuits described in conjunction with the disclosure of the embodiments of the present application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0160] Optionally, the network device 1700 further includes a bus. The bus is used to transmit information between the components of the network device 1700. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in Figure 17, but this does not mean that there is only one bus or one type of bus. In addition to being connected by a bus, the components of the network device 1700 in Figure 17 may also be connected in other ways. The embodiment of the present application does not limit the connection method of the components.

[0161] The memory 1703 is, for example, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, or a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1703 is, for example, independent and connected to the processor 1701 via a bus. The memory 1703 can also be integrated with the processor 1701.

[0162] The communication interface 1704 uses any transceiver-like device for communicating with other devices or communication networks. The communication network can be Ethernet, a radio access network (RAN), or a wireless local area network (WLAN). The communication interface 1704 can include a wired communication interface and a wireless communication interface. Exemplarily, the communication interface 1704 can be an Ethernet interface, a fast Ethernet (FE) interface, a gigabit Ethernet (GE) interface, an asynchronous transfer mode (ATM) interface, a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof. The Ethernet interface can be an optical interface, an electrical interface, or a combination thereof. In an embodiment of the present application, the communication interface 1704 can be used for the network device 1700 to communicate with other devices.

[0163] In a specific implementation, as an embodiment, the processor 1701 may include one or more CPUs, such as CPU0 and CPU1 shown in FIG17 . Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0164] In a specific implementation, as an embodiment, network device 1700 may include multiple processors, such as processor 1701 and processor 1705 shown in FIG17 . Each of these processors may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).

[0165] In a specific implementation, as an embodiment, the network device 1700 may further include an output device and an input device. The output device communicates with the processor 1701 and can display information in a variety of ways. For example, the output device can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device communicates with the processor 1701 and can receive user input in a variety of ways. For example, the input device can be a mouse, a keyboard, a touch screen device, or a sensor device.

[0166] In some embodiments, the memory 1703 is used to store program code 1702 for executing the solution of the present application, and the processor 1701 can execute the program code 1702 stored in the memory 1703. That is, the network device 1700 can implement the performance measurement method of the application provided in the method embodiment through the processor 1701 and the program code 1702 in the memory 1703. The program code 1702 may include one or more software modules. Optionally, the processor 1701 itself may also store program code or instructions for executing the solution of the present application.

[0167] In a specific embodiment, the network device 1700 of the embodiment of the present application may correspond to the first edge network device in the above-mentioned method embodiments. The processor 1701 in the network device 1700 reads the program code 1702 in the memory 1703 or the program code or instructions stored in the processor 1701 itself, so that the network device 1700 shown in Figure 17 can execute all or part of the operations performed by the server.

[0168] Network device 1700 may also correspond to the apparatus shown in FIG. 15 , with each functional module in the apparatus shown in FIG. 15 being implemented using software in network device 1700. In other words, the determination module included in the apparatus shown in FIG. 15 is generated by processor 1701 of network device 1700 after reading program code 1702 stored in memory 1703. For example, acquisition module 151 and determination module 152 in FIG. 15 correspond to processor 1701 and / or processor 1705.

[0169] Among them, each step of the above-mentioned application performance measurement method is completed by the hardware integrated logic circuit or software instructions in the processor of the network device 1700. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as being executed by the hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above-mentioned method in combination with its hardware. To avoid repetition, it will not be described in detail here.

[0170] Referring to Figure 18 , Figure 18 shows a schematic diagram of the structure of a network device 1800 provided in another exemplary embodiment of the present application. The network device 1800 shown in Figure 18 is used to perform all or part of the operations involved in the application performance measurement method in the above-described method embodiment. The network device 1800 is, for example, a switch or router, and can be implemented using a general bus architecture.

[0171] As shown in FIG. 18 , the network device 1800 includes a main control board 1810 and an interface board 1830 .

[0172] The main control board (MCB), also known as the main processing unit (MPU) or route processor card, is used to control and manage various components in network device 1800, including routing calculations, device management, device maintenance, and protocol processing. MCB 1810 includes a central processing unit (CPU) 1811 and memory 1812.

[0173] Interface board 1830 is also known as a line processing unit (LPU), line card, or service board. It provides various service interfaces and implements data packet forwarding. Service interfaces include, but are not limited to, Ethernet interfaces and POS (Packet over SONET / SDH) interfaces. Ethernet interfaces, for example, are Flexible Ethernet Clients (FlexE Clients). Interface board 1830 includes a central processing unit (CPU) 1831, a network processor (NPU) 1832, a forwarding table memory 1834, and a physical interface card (PIC) 1833.

[0174] The central processing unit 1831 on the interface board 1830 is used to control and manage the interface board 1830 and communicate with the central processing unit 1811 on the main control board 1810 .

[0175] The network processor 1832 is used to implement message transmission processing. The network processor 1832 can be in the form of a forwarding chip. The forwarding chip can be a network processor (NP). In some embodiments, the forwarding chip can be implemented using an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA). Specifically, the network processor 1832 is used to forward received messages based on the forwarding table stored in the forwarding entry memory 1834. If the destination address of the message is the address of the network device 1800, the message is sent to the CPU (such as the central processing unit 1831) for processing. If the destination address of the message is not the address of the network device 1800, the next hop and outgoing interface corresponding to the destination address are searched in the forwarding table based on the destination address, and the message is forwarded to the outgoing interface corresponding to the destination address. The processing of uplink messages may include processing the message inbound interface and forwarding table lookup; the processing of downlink messages may include forwarding table lookup, etc. In some embodiments, the central processing unit may also perform the functions of the forwarding chip, such as implementing software forwarding based on a general-purpose CPU, thereby eliminating the need for a forwarding chip in the interface board.

[0176] Physical interface card 1833 implements the NIC layer's interfacing functionality. Raw traffic enters interface board 1830 through this card, and processed packets are sent from this physical interface card 1833. Physical interface card 1833, also known as a daughter card, can be installed on interface board 1830. It converts optical and electrical signals into packets, performs a validity check on these packets, and then forwards them to network processor 1832 for processing. In some embodiments, central processing unit 1831 can also perform the functions of network processor 1832, such as implementing software forwarding based on a general-purpose CPU, eliminating the need for network processor 1832 in physical interface card 1833.

[0177] Optionally, network device 1800 includes multiple interface boards. For example, network device 1800 further includes interface board 1840, which includes a central processing unit 1841, a network processor 1842, a forwarding table entry memory 1844, and a physical interface card 1843. The functions and implementation of each component in interface board 1840 are the same as or similar to those of interface board 1830 and are not described in detail here.

[0178] Optionally, network device 1800 also includes a switching fabric board 1820. Switching fabric board 1820 may also be referred to as a switch fabric unit (SFU). If the network device has multiple interface boards, switching fabric board 1820 is used to exchange data between the interface boards. For example, interface board 1830 and interface board 1840 can communicate via switching fabric board 1820.

[0179] The main control board 1810 and the interface board are coupled. For example, the main control board 1810, the interface boards 1830 and 1840, and the switching network board 1820 are connected to the system backplane via a system bus to achieve intercommunication. In one possible implementation, an inter-process communication (IPC) channel is established between the main control board 1810 and the interface boards 1830 and 1840, and communication is performed between the main control board 1810 and the interface boards 1830 and 1840 via the IPC channel.

[0180] Logically, network device 1800 includes a control plane and a forwarding plane. The control plane includes a main control board 1810 and a central processing unit 1811. The forwarding plane includes various components that perform forwarding, such as a forwarding table entry memory 1834, physical interface cards 1833, and a network processor 1832. The control plane performs functions such as routing, generating forwarding tables, processing signaling and protocol messages, and configuring and maintaining the network device's status. The control plane sends the generated forwarding tables to the forwarding plane. On the forwarding plane, the network processor 1832 forwards messages received by the physical interface card 1833 based on the forwarding tables sent by the control plane. The forwarding tables sent by the control plane can be stored in the forwarding table entry memory 1834. In some embodiments, the control plane and forwarding plane can be completely separate and not located on the same network device.

[0181] It's worth noting that there may be one or more main control boards (SPUs), which can include both active and standby SPUs. There may also be one or more interface boards. The higher the network device's data processing capabilities, the more interface boards it provides. Interface boards can also have one or more physical interface cards. There may be no SPUs, one or more SPUs, and multiple SPUs can provide load balancing and redundancy. In a centralized forwarding architecture, network devices may not require SPUs; the interface boards handle service data processing for the entire system. In a distributed forwarding architecture, network devices may have at least one SPU, which enables data exchange between multiple interface boards, providing high-capacity data exchange and processing capabilities. Therefore, network devices with distributed architectures have greater data access and processing capabilities than those with centralized architectures. Alternatively, a network device may consist of a single board, i.e., without a switching fabric board. The functions of the interface board and the main control board are integrated on this single board. In this case, the central processing unit (CPU) on the interface board and the CPU on the main control board can be combined into a single CPU on this single board to perform the combined functions of the two. This type of network device has lower data exchange and processing capabilities (e.g., low-end network devices such as switches or routers). The specific architecture used depends on the exemplary networking deployment scenario and is not limited here.

[0182] In a specific embodiment, network device 1800 corresponds to the performance measurement device for an application configured on a server side as shown in FIG15 . In some embodiments, acquisition module 151 and determination module 152 in the performance measurement device for an application shown in FIG15 correspond to at least one of central processing unit 1811, network processor 1832, and network processor 1842 in network device 1800.

[0183] Based on the network devices shown in Figures 16, 17, and 18, an embodiment of the present application further provides an application performance measurement system, comprising: a client and a server. Optionally, the server is network device 1600 shown in Figure 16, network device 1700 shown in Figure 17, or network device 1800 shown in Figure 18.

[0184] The method executed by the server can be found in the relevant description of the above method embodiment, which will not be repeated here.

[0185] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. It is worth noting that the processor may be a processor that supports the Advanced RISC Machine (ARM) architecture.

[0186] Furthermore, in an optional embodiment, the memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. The memory may also include a non-volatile random access memory. For example, the memory may also store device type information.

[0187] The memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache memory. By way of example and not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0188] A computer-readable storage medium is also provided, in which at least one program instruction or code is stored. When the program instruction or code is loaded and executed by a processor, the computer implements the performance measurement method of any application program in the above method embodiments.

[0189] The present application provides a computer program, which, when executed by a computer, can enable a processor or computer to execute the corresponding steps and / or processes in the above method embodiments.

[0190] A chip is provided, comprising a processor for calling and executing instructions stored in a memory, so that a communication device equipped with the chip executes the methods in the above aspects.

[0191] Another chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute code in the memory. When the code is executed, the processor is used to execute the methods in the above aspects.

[0192] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).

[0193] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of this application in detail. It should be understood that the above are only specific implementation methods of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of this application should be included in the scope of protection of this application.

[0194] Those skilled in the art will appreciate that the various method steps and modules described in conjunction with the embodiments disclosed herein can be implemented in software, hardware, firmware, or any combination thereof. In order to clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0195] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0196] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. As an example, the method of the embodiment of the present application can be described in the context of a machine executable instruction, and the machine executable instruction is such as included in the program module executed in the device on the real or virtual processor of the target. Generally speaking, a program module includes a routine, a program, a library, an object, a class, a component, a data structure, etc., which performs a specific task or realizes a specific abstract data structure. In various embodiments, the function of the program module can be merged or split between the described program modules. The machine executable instruction for the program module can be executed in a local or distributed device. In a distributed device, the program module can be located in both a local and a remote storage medium.

[0197] The computer program code for realizing the method for the embodiment of the application can be written in one or more programming languages.These computer program codes can be provided to the processor of general-purpose computer, special-purpose computer or other programmable data processing device, so that program code, when being executed by computer or other programmable data processing device, causes the function / operation specified in flow chart and / or block diagram to be implemented.Program code can be executed completely on computer, partly on computer, as independent software package, partly on computer and partly on remote computer or completely on remote computer or server.

[0198] In the context of the embodiments of the present application, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like.

[0199] Examples of signals may include electrical, optical, radio, acoustic or other forms of propagated signals, such as carrier waves, infrared signals, etc.

[0200] A machine-readable medium may be any tangible medium that contains or stores a program for or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More detailed examples of machine-readable storage media include an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0201] Those skilled in the art will clearly understand that, for the sake of convenience and brevity of description, the specific working processes of the above-described systems, devices, and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0202] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, or can be electrical, mechanical or other forms of connection.

[0203] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0204] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.

[0205] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0206] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items that have substantially the same role and function. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity and execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the various examples, a first edge network device may be referred to as a second edge network device, and similarly, a second edge network device may be referred to as a first edge network device. Both the first edge network device and the second edge network device may be edge network devices, and in some cases, may be separate and different edge network devices.

[0207] It should also be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0208] In this application, the term "at least one" means one or more, and the term "plurality" means two or more. For example, "plurality of second messages" means two or more second messages. The terms "system" and "network" are often used interchangeably herein.

[0209] It should be understood that the terminology used in the description of the various examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0210] It will also be understood that the term “comprise” (also known as “includes,” “including,” “comprises,” and / or “comprising”) when used in this specification specifies the presence of stated features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0211] It should also be understood that the terms “if” and “if” may be interpreted to mean “when” or “upon” or “in response to determining” or “in response to detecting.” Similarly, the phrases “if it is determined that ” or “if [stated condition or event] is detected” may be interpreted to mean “upon determining ” or “in response to determining ” or “upon detecting [stated condition or event]” or “in response to detecting [stated condition or event],” depending on the context.

[0212] It should be understood that determining B based on A does not mean determining B based solely on A. B can also be determined based on A and / or other information.

[0213] It should also be understood that references throughout this specification to "one embodiment," "an embodiment," or "one possible implementation" mean that specific features, structures, or characteristics associated with that embodiment or implementation are included in at least one embodiment of the present application. Therefore, the appearance of "in one embodiment," "in an embodiment," or "one possible implementation" throughout this specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

Claims

1. A method for measuring the performance of an application, characterized in that: The method is applied to the server, and the method includes: Obtain at least two timestamps of a transmission control protocol TCP message on a transmission path of a network protocol stack, wherein the TCP message includes at least one of a TCP request message sent by a client of a tested application or a first TCP response message corresponding to the TCP request message, and the at least two timestamps include a first timestamp when a socket layer in the network protocol stack sends the first TCP response message or a second timestamp when a network interface card NIC layer in the network protocol stack receives the TCP request message; Based on the at least two timestamps, a performance indicator of the application under test is determined.

2. The method according to claim 1, characterized in that In a case where the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, and the third timestamp is a timestamp when the TCP / Internet Protocol IP layer in the network protocol stack receives the TCP confirmation message; The performance indicator of the application under test includes a first segment delay of the application under test, where the first segment delay is a difference between the third timestamp and the first timestamp.

3. The method according to claim 1, characterized in that In the case where the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, and the third timestamp is a timestamp when the TCP / IP layer in the network protocol stack receives the TCP confirmation message; The performance indicator of the application under test includes a total delay of the application under test, and the total delay is a difference between the third timestamp and the second timestamp.

4. The method according to claim 1, characterized in that In the case where the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is a timestamp when the socket layer in the network protocol stack receives the TCP request message; The performance indicator of the application under test includes a second segment delay of the application under test, and the second segment delay of the application under test is a difference between the fourth timestamp and the second timestamp.

5. The method according to claim 1, characterized in that In a case where the TCP message includes the TCP request message and the first TCP response message, and the at least two timestamps include the first timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is a timestamp when the socket layer in the network protocol stack receives the TCP request message; The performance indicator of the application under test includes a third segment delay of the application under test, and the third segment delay is a difference between the first timestamp and the fourth timestamp.

6. The method according to claim 1, characterized in that In a case where the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a second TCP response message, and the at least two timestamps also include a fifth timestamp, where the fifth timestamp is a timestamp at which the socket layer in the network protocol stack sends the second TCP response message; The performance indicators of the application under test include transactions per second TPS, where the TPS is a ratio of a sequence number difference to a time difference, wherein the sequence number difference is a difference between a second sequence number and a first sequence number, the time difference is a difference between a fifth timestamp and the first timestamp, the first sequence number is a sequence number corresponding to the first TCP response message, and the second sequence number is a sequence number corresponding to the second TCP response message.

7. A performance measurement device for an application, characterized in that: The device is configured at the server end, and the device includes: An acquisition module is used to acquire at least two timestamps of a transmission control protocol TCP message on a transmission path of a network protocol stack, wherein the TCP message includes at least one of a TCP request message sent by a client of a tested application or a first TCP response message corresponding to the TCP request message, and the at least two timestamps include a first timestamp when a socket layer in the network protocol stack sends the first TCP response message or a second timestamp when a network interface card NIC layer in the network protocol stack receives the TCP request message; A determination module is used to determine the performance indicator of the application under test based on the at least two timestamps.

8. The device according to claim 7, characterized in that In a case where the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, and the third timestamp is a timestamp when the TCP / Internet Protocol IP layer in the network protocol stack receives the TCP confirmation message; The performance indicator of the application under test includes a first segment delay of the application under test, where the first segment delay is a difference between the third timestamp and the first timestamp.

9. The device according to claim 7, characterized in that In the case where the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the TCP message also includes a TCP confirmation message corresponding to the TCP request message, and the at least two timestamps also include a third timestamp, and the third timestamp is a timestamp when the TCP / IP layer in the network protocol stack receives the TCP confirmation message; The performance indicator of the application under test includes a total delay of the application under test, and the total delay is a difference between the third timestamp and the second timestamp.

10. The device according to claim 7, characterized in that In the case where the TCP message includes the TCP request message and the at least two timestamps include the second timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is a timestamp when the socket layer in the network protocol stack receives the TCP request message; The performance indicator of the application under test includes a second segment delay of the application under test, and the second segment delay of the application under test is a difference between the fourth timestamp and the second timestamp.

11. The device according to claim 7, characterized in that In a case where the TCP message includes the TCP request message and the first TCP response message, and the at least two timestamps include the first timestamp, the at least two timestamps also include a fourth timestamp, and the fourth timestamp is a timestamp when the socket layer in the network protocol stack receives the TCP request message; The performance indicator of the application under test includes a third segment delay of the application under test, and the third segment delay is a difference between the first timestamp and the fourth timestamp.

12. The device according to claim 7, characterized in that In a case where the TCP message includes the first TCP response message and the at least two timestamps include the first timestamp, the TCP message also includes a second TCP response message, and the at least two timestamps also include a fifth timestamp, where the fifth timestamp is a timestamp at which the socket layer in the network protocol stack sends the second TCP response message; The performance indicators of the application under test include transactions per second TPS, where the TPS is a ratio of a sequence number difference to a time difference, wherein the sequence number difference is a difference between a second sequence number and a first sequence number, the time difference is a difference between a fifth timestamp and the first timestamp, the first sequence number is a sequence number corresponding to the first TCP response message, and the second sequence number is a sequence number corresponding to the second TCP response message.

13. A network device, characterized in that: The network device includes: a processor, the processor is coupled to a memory, the memory stores at least one program instruction or code, and the at least one program instruction or code is loaded and executed by the processor to enable the network device to implement the method for measuring the performance of an application program described in any one of claims 1-6.

14. A system for measuring the performance of a response program, characterized in that: The system comprises a client and a server of the application under test, wherein the client is used to send a TCP request message, and the server is used to execute the performance measurement method of the application program described in any one of claims 1-6.

15. A computer-readable storage medium, characterized in that: The storage medium stores at least one program instruction or code, and when the program instruction or code is loaded and executed by the processor, the computer implements the performance measurement method of the application program according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for measuring delay

    CN108075935A

  • Communication time detection method and device, electronic equipment and storage medium

    CN115904774A

  • Device fingerprinting for cyber-physical systems

    US20180048550A1

  • Method and apparatus for measuring the performance of a network based application program

    US6446028B1