Data processing method and apparatus, processor

CN117596310BActive Publication Date: 2026-10-16HILLSTONE NETWORKS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311515493.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2026-10-16
Estimated Expiration
2043-11-14

AI Technical Summary

Technical Problem

[0008]本申请的主要目的在于提供一种数据处理方法及装置、处理器,以解决相关技术中难以及时调整代理设备的接收窗口的大小,导致代理设备与发送端和接收端之间的TCP连接容易出现阻塞的情况,进而导致利用TCP传输控制协议传输数据的效率较低的问题

Benefits of technology

[0026]This application employs the following steps: When the proxy device receives a target request from the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket. The target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message. The application also obtains a data information set of the proxy device, which includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages the proxy device can currently receive. Based on the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, the application adjusts the size of the receive window of the first socket to obtain the adjusted receive window. Finally, the application responds to the target request using the adjusted receive window of the first socket and sends the target message to the receiving device. This solves the problem in related technologies where it is difficult to adjust the size of the receive window of the proxy device in a timely manner, leading to potential blocking of the TCP connection between the proxy device and the sending and receiving ends, and consequently, low efficiency in transmitting data using the TCP Transmission Control Protocol. By obtaining the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, and adjusting the size of the receive window of the first socket according to the length of the receive queue of the first socket, the adjusted receive window of the first socket is obtained. Then, the target request sent by the sending device is responded to through the adjusted receive window of the first socket, and the target packet is sent to the receiving device. This allows for timely adjustment of the receive window size of the proxy device and avoids blocking of the TCP connection between the proxy device and the sending and receiving ends, ensuring the stability of the TCP proxy and thus improving the efficiency of data transmission using the TCP Transmission Control Protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117596310B_ABST
    Figure CN117596310B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device and a processor. The method comprises the following steps: when a proxy device receives a target request sent by a sending device, the length of a receiving queue of a first socket and the length of a sending queue of a second socket are obtained; a data information set of the proxy device is obtained; the size of a receiving window of the first socket is adjusted according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket and the data information set of the proxy device, so that an adjusted receiving window of the first socket is obtained; the target request is responded through the adjusted receiving window of the first socket, and a target message is sent to a receiving device. Through the application, the size of the receiving window of the proxy device can be adjusted in time, the TCP connection between the proxy device and the sending end and the receiving end is prevented from being blocked, and the efficiency of data transmission by using the TCP transmission control protocol is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data transmission technology, and more specifically, to a data processing method, apparatus, and processor. Background Technology

[0002] Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. TCP is designed to adapt to layered protocol hierarchies that support multiple network applications. Pairs of processes on host computers connected to different but interconnected computer networks rely on TCP for reliable communication services. For example, Figure 1 This is a schematic diagram of TCP transmission based on existing technology, such as... Figure 1 As shown, a TCP connection can be established between the sending and receiving ends, and the established TCP connection can be used for data transmission between the sending and receiving ends.

[0003] in addition, Figure 2 This is a schematic diagram of a TCP proxy transmission based on existing technology, such as... Figure 2 As shown, a TCP proxy generally refers to inserting a proxy device between the sending and receiving ends of network communication. The proxy device establishes TCP connections with both the sending and receiving ends and forwards application layer protocol data running on top of the TCP protocol, such as an HTTP proxy (an intermediate server used to transmit HTTP requests and responses between clients and target servers).

[0004] Furthermore, since the TCP protocol is a reliable transmission protocol, the sender and receiver determine their respective send and receive windows, as well as the TCP window scale, when establishing a TCP connection. When transmitting data based on the TCP connection, the sender and receiver dynamically adjust the TCP receive window according to the current network status and the speed at which the application layer reads TCP data, in order to obtain a good data transmission speed and make full use of bandwidth.

[0005] However, when a proxy device intervenes, it breaks the original TCP connection. In scenarios where the network quality on both sides differs greatly, the number of concurrent connections is high, and especially when the proxy device's own resources (such as memory and CPU) are limited, how to balance the transmission speed of the TCP connections on both sides and ensure a good TCP proxy effect requires coordination from the proxy device, which is a great challenge for the proxy device.

[0006] Related technologies determine the size of the TCP network proxy's receive window by obtaining the size of the UE (User Equipment), the first delay between the TCP network proxy and the UE, and the second delay between the TCP network proxy and the Internet server. However, since network quality is dynamic, the TCP window also needs to be dynamically adjusted. Therefore, relying solely on the initial receive window size and delay of the UE device can only determine the initial window size of the TCP network proxy device at the initial moment. Furthermore, once network quality fluctuates, the related technologies cannot adjust the proxy device's window in a timely manner, which may frequently result in zero windows, leading to TCP connection blocking and other situations, thus resulting in low efficiency in transmitting data using the TCP Transmission Control Protocol.

[0007] There is currently no effective solution to the problem that it is difficult to adjust the size of the receiving window of the proxy device in a timely manner, which can easily lead to the blocking of TCP connections between the proxy device and the sending and receiving ends, resulting in low efficiency of data transmission using the TCP Transmission Control Protocol. Summary of the Invention

[0008] The main objective of this application is to provide a data processing method, apparatus, and processor to solve the problem in related technologies where it is difficult to adjust the size of the receiving window of the proxy device in a timely manner, which easily leads to the blocking of the TCP connection between the proxy device and the sending and receiving ends, resulting in low efficiency of data transmission using the TCP Transmission Control Protocol.

[0009] To achieve the above objectives, according to one aspect of this application, a data processing method is provided. This method is applied in a data processing system, which includes at least: a proxy device, a sending device for sending a target message, and a receiving device for receiving the target message. The proxy device includes at least a first socket and a second socket. The first socket is used to establish a first TCP connection between the proxy device and the sending device, and the second socket is used to establish a second TCP connection between the proxy device and the receiving device. The first TCP connection and the second TCP connection are used to transmit the target message, which includes at least data to be sent from the sending device to the receiving device. The data processing method includes: when the proxy device receives a target request sent by the sending device, obtaining the length of the receive queue of the first socket and the length of the second socket. The length of the sending queue of the first socket, wherein the target request is used to request the sending of the target message to the receiving device, the receiving queue is used to receive the target message, and the sending queue is used to send the target message; the data information set of the proxy device is obtained, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive; the size of the receiving window of the first socket is adjusted according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket; the target request is responded to through the adjusted receiving window of the first socket, and the target message is sent to the receiving device.

[0010] Further, adjusting the size of the receiving window of the first socket based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; and adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0011] Further, adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; if the number of packets that the proxy device can currently receive in the data information set is less than the preset number, then adjusting the size of the receiving window of the first socket to 0; if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, then determining whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate, and determining whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate, to obtain a determination result; adjusting the size of the receiving window of the first socket according to the determination result to obtain the adjusted receiving window of the first socket.

[0012] Further, adjusting the size of the receiving window of the first socket based on the judgment result to obtain the adjusted receiving window of the first socket includes: if the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate, and the memory utilization rate of the proxy device in the data information set is not greater than the second preset utilization rate, then the receiving window of the first socket is reduced to the target value; if the CPU utilization rate of the proxy device in the data information set is not greater than the first preset utilization rate, and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the receiving window of the first socket is reduced to the target value. The target value is stated; if the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization rate, and the memory utilization of the proxy device in the data information set is not greater than the second preset utilization rate, then the size of the receiving window of the first socket is not adjusted; if the CPU utilization of the proxy device in the data information set is greater than the first preset utilization rate, and the memory utilization of the proxy device in the data information set is greater than the second preset utilization rate, then the size of the receiving window of the first socket is adjusted based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receiving window of the first socket.

[0013] Further, adjusting the size of the receive window of the first socket based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receive window of the first socket includes: calculating the size of the receive window of the first socket based on the CPU utilization of the proxy device to obtain a first size corresponding to the receive window; calculating the size of the receive window of the first socket based on the memory utilization of the proxy device to obtain a second size corresponding to the receive window; comparing the values ​​corresponding to the first size and the second size to obtain the smaller value between the first size and the second size; and adjusting the size of the receive window of the first socket to the smaller value between the first size and the second size to obtain the adjusted receive window of the first socket.

[0014] Further, determining the size of the receive window of the first socket based on the length of the receive queue of the first socket and the length of the send queue of the second socket includes: obtaining the initial size of the receive window of the first socket; and determining the size of the receive window of the first socket based on the initial size of the receive window of the first socket, the length of the receive queue of the first socket, and the length of the send queue of the second socket.

[0015] Further, after responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device, the method further includes: when it is detected that the first socket sends target notification information to the sending device within a preset time period, the size of the receiving window of the first socket is recalculated to obtain a recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; if the recalculated size of the receiving window of the first socket is greater than the preset value, a window update message is sent to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0016] Further, responding to the target request through the adjusted first socket's receive window and sending the target message to the receiving device includes: obtaining the sequence number of the target message, and based on the sequence number of the target message, determining whether the adjusted first socket's receive window allows receiving the target message; if the adjusted first socket's receive window does not allow receiving the target message, then prohibiting the sending of the target message to the receiving device; if the adjusted first socket's receive window allows receiving the target message, then adding the target message to the first socket's receive queue; reading the target message from the first socket's receive queue and adding the target message to the second socket's send queue; and sending the target message in the second socket's send queue to the receiving device.

[0017] To achieve the above objectives, according to another aspect of this application, a data processing apparatus is provided. This apparatus is applied in a data processing system, which includes at least: a proxy device, a sending device for sending a target message, and a receiving device for receiving the target message. The proxy device includes at least a first socket and a second socket. The first socket is used to establish a first TCP connection between the proxy device and the sending device, and the second socket is used to establish a second TCP connection between the proxy device and the receiving device. The first TCP connection and the second TCP connection are used to transmit the target message, which includes at least data to be sent from the sending device to the receiving device. The data processing apparatus includes: a first acquisition module, used to acquire the length of the receiving queue of the first socket and the length of the sending queue of the second socket when the proxy device receives a target request sent by the sending device. The system comprises: a first socket receiving window and a second sending window; a first receiving module, which is configured to receive the target message and send the target message; a second acquisition module, which is configured to acquire the data information set of the proxy device, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive; a first processing module, which is configured to adjust the size of the receiving window of the first socket according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device, to obtain the adjusted receiving window of the first socket; and a first sending module, which is configured to respond to the target request through the adjusted receiving window of the first socket and send the target message to the receiving device.

[0018] Further, the first processing module includes: a first determining unit, configured to determine the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; and a first processing unit, configured to adjust the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0019] Further, the first processing unit includes: a first judgment submodule, configured to judge whether the number of packets currently receivable by the proxy device in the data information set is less than a preset number; a first processing submodule, configured to adjust the size of the receiving window of the first socket to 0 if the number of packets currently receivable by the proxy device in the data information set is less than the preset number; a second judgment submodule, configured to judge whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate and whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate if the number of packets currently receivable by the proxy device in the data information set is not less than the preset number, thereby obtaining a judgment result; and a second processing submodule, configured to adjust the size of the receiving window of the first socket according to the judgment result, thereby obtaining the adjusted receiving window of the first socket.

[0020] Further, the second processing submodule includes: a first shrinking subunit, configured to shrink the receiving window of the first socket to a target value if the CPU utilization of the proxy device in the data information set is greater than the first preset utilization rate and the memory utilization of the proxy device in the data information set is not greater than the second preset utilization rate; a second shrinking subunit, configured to shrink the receiving window of the first socket to the target value if the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization of the proxy device in the data information set is greater than the second preset utilization rate; the first processing subunit is configured to... If the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization rate, and the memory utilization of the proxy device in the data information set is not greater than the second preset utilization rate, then the size of the receiving window of the first socket is not adjusted; the second processing subunit is used to adjust the size of the receiving window of the first socket based on the CPU utilization and memory utilization of the proxy device in the data information set if the CPU utilization of the proxy device in the data information set is greater than the first preset utilization rate, and the memory utilization of the proxy device in the data information set is greater than the second preset utilization rate, to obtain the adjusted receiving window of the first socket.

[0021] Further, the second processing subunit includes: a calculation subunit one, used to calculate the size of the receive window of the first socket based on the CPU utilization of the proxy device, to obtain a first size corresponding to the receive window; a calculation subunit two, used to calculate the size of the receive window of the first socket based on the memory utilization of the proxy device, to obtain a second size corresponding to the receive window; a comparison subunit one, used to compare the values ​​corresponding to the first size and the second size, to obtain the smaller value between the first size and the second size; and an adjustment subunit one, used to adjust the size of the receive window of the first socket to the smaller value between the first size and the second size, to obtain the adjusted receive window of the first socket.

[0022] Further, the first determining unit includes: a first acquiring submodule, configured to acquire the initial size of the receiving window of the first socket; and a first determining submodule, configured to determine the size of the receiving window of the first socket based on the initial size of the receiving window of the first socket, the length of the receiving queue of the first socket, and the length of the sending queue of the second socket.

[0023] Furthermore, the device further includes: a first detection module, configured to, after responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device, when it is detected that the first socket sends target notification information to the sending device within a preset time period, recalculate the size of the receiving window of the first socket to obtain a recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; and a second sending module, configured to, when the recalculated size of the receiving window of the first socket is greater than a preset value, send a window update message to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0024] Further, the first sending module includes: a second processing unit, configured to obtain the sequence number of the target message and, based on the sequence number of the target message, determine whether the adjusted receiving window of the first socket allows receiving the target message; a third processing unit, configured to prohibit sending the target message to the receiving device if the adjusted receiving window of the first socket does not allow receiving the target message; a first adding unit, configured to add the target message to the receiving queue of the first socket if the adjusted receiving window of the first socket allows receiving the target message; a second adding unit, configured to read the target message from the receiving queue of the first socket and add the target message to the sending queue of the second socket; and a first sending unit, configured to send the target message in the sending queue of the second socket to the receiving device.

[0025] To achieve the above objectives, according to another aspect of this application, a processor for data processing is provided, the processor being configured to run a program, wherein the program, when running, executes any of the data processing methods described above.

[0026] This application employs the following steps: When the proxy device receives a target request from the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket. The target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message. The application also obtains a data information set of the proxy device, which includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages the proxy device can currently receive. Based on the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, the application adjusts the size of the receive window of the first socket to obtain the adjusted receive window. Finally, the application responds to the target request using the adjusted receive window of the first socket and sends the target message to the receiving device. This solves the problem in related technologies where it is difficult to adjust the size of the receive window of the proxy device in a timely manner, leading to potential blocking of the TCP connection between the proxy device and the sending and receiving ends, and consequently, low efficiency in transmitting data using the TCP Transmission Control Protocol. By obtaining the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, and adjusting the size of the receive window of the first socket according to the length of the receive queue of the first socket, the adjusted receive window of the first socket is obtained. Then, the target request sent by the sending device is responded to through the adjusted receive window of the first socket, and the target packet is sent to the receiving device. This allows for timely adjustment of the receive window size of the proxy device and avoids blocking of the TCP connection between the proxy device and the sending and receiving ends, ensuring the stability of the TCP proxy and thus improving the efficiency of data transmission using the TCP Transmission Control Protocol. Attached Figure Description

[0027] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0028] Figure 1 This is a schematic diagram of TCP transmission based on existing technology;

[0029] Figure 2 This is a schematic diagram of a TCP proxy transmission method based on existing technology;

[0030] Figure 3 This is a flowchart of a data processing method provided according to an embodiment of this application;

[0031] Figure 4 This is a schematic diagram of an optional data processing method provided according to an embodiment of this application;

[0032] Figure 5 This is a schematic diagram of the active notification window update in an embodiment of this application;

[0033] Figure 6 This is a schematic diagram of a data processing apparatus provided according to an embodiment of this application;

[0034] Figure 7 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0035] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0036] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0037] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0038] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.

[0039] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0040] A socket is a communication mechanism in computer networks that allows processes on different computers to communicate. Through sockets, data can be sent and received over a network, enabling data exchange between processes.

[0041] CPU: The full name is Central Processing Unit. It is an important component of a computer and is also called a processor or microprocessor. It is the computing and control center of a computer and determines the computer's processing power and response speed.

[0042] The present invention will now be described in conjunction with preferred implementation steps. Figure 3 This is a flowchart of a data processing method provided according to an embodiment of this application, such as... Figure 3 As shown, the method includes the following steps:

[0043] Step S301: When the proxy device receives the target request sent by the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket. The target request is used to request the sending of the target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message.

[0044] For example, Figure 4 This is a schematic diagram of an optional data processing method provided according to an embodiment of this application, and the aforementioned transmitting device can be... Figure 4 The sending end in the middle, and the sending end can be used to send a message request (the aforementioned target request) to the proxy device, and then the proxy device sends the message request (the aforementioned target request) to the receiving end (the aforementioned receiving device); the aforementioned receiving device can be Figure 4 The receiving end in the middle, and the receiving end can be used to receive message requests sent by the sending end, and return messages to the proxy device based on the message requests, and then the proxy device sends the messages returned by the receiving end to the sending end; the first socket mentioned above can be Figure 4 The sock0 socket in the middle, and such Figure 4 As shown, the proxy device and the sending end establish a TCP connection through sock0 (the first socket mentioned above); the second socket mentioned above can be... Figure 4 The sock1 socket in the middle, and such Figure 4 As shown, the proxy device and the receiving end establish a TCP connection through sock1 (the second socket mentioned above); the receive queue of the first socket mentioned above can be the receive queue of sock0 (the first socket mentioned above); the send queue of the second socket mentioned above can be the send queue of sock1 (the second socket mentioned above).

[0045] For example, such as Figure 4As shown, in a TCP proxy scenario, two user-space sockets are created (i.e., sock0 and sock1 are created) and associated with each other. The receive window of sock0 (the first socket mentioned above) can be jointly controlled by the receive queue length of sock0 (the first socket mentioned above) and the send queue length of sock1 (the second socket mentioned above).

[0046] sock0_rcv_wnd=default_wnd-(sock0_rcv_queue+sock1_send_queue)

[0047] Wherein, sock0_rcv_wnd represents the size of the receive window of sock0, default_wnd represents the size of the default window, and default_wnd can be agreed to have a default value of 128KB, sock0_rcv_queue represents the length of the receive queue of sock0, and sock1_send_queue represents the length of the send queue of sock1.

[0048] Step S302: Obtain the data information set of the proxy device, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of packets that the proxy device can currently receive.

[0049] For example, the aforementioned data set may include real-time CPU utilization, memory utilization, and remaining packet count of the proxy device. Therefore, the real-time system status of the proxy device can be obtained, including CPU utilization, memory utilization, and remaining packet count (the number of packets the proxy device can currently receive).

[0050] Step S303: Adjust the size of the receiving window of the first socket according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0051] For example, the size of the receive window of sock0 can be calculated and adjusted based on the receive queue length of sock0 (the first socket mentioned above), the send queue length of sock1 (the second socket mentioned above), and the CPU utilization, memory utilization, and remaining number of packets of the proxy device.

[0052] Step S304: Respond to the target request through the adjusted receiving window of the first socket and send the target message to the receiving device.

[0053] For example, after adjusting the size of the receive window of sock0 (the first socket mentioned above), the message request (the target request mentioned above) sent by the sender (the sending device mentioned above) can be sent to the receiver (the receiving device mentioned above) based on the adjusted receive window of sock0.

[0054] Through the steps S301 to S304 described above, by obtaining the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, and adjusting the size of the receive window of the first socket according to the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, the adjusted receive window of the first socket is obtained. Then, the target request sent by the sending device is responded to through the adjusted receive window of the first socket, and the target packet is sent to the receiving device. In this way, the size of the receive window of the proxy device can be adjusted in a timely manner, and the TCP connection between the proxy device and the sending and receiving ends can be avoided, ensuring the stability of the TCP proxy, thereby improving the efficiency of data transmission using the TCP Transmission Control Protocol.

[0055] Optionally, in the data processing method provided in this application embodiment, adjusting the size of the receiving window of the first socket based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; and adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0056] For example, the initial size of the receive window of sock0 (the first socket mentioned above) can be calculated first based on the receive queue length of sock0 (the first socket mentioned above) and the send queue length of sock1 (the second socket mentioned above). Then, the initial size of the receive window of sock0 (the first socket mentioned above) can be adjusted according to the CPU utilization, memory utilization and remaining number of packets of the proxy device, and the adjusted receive window of sock0 can be obtained.

[0057] The above method allows for dynamic adjustment of the TCP receive window size based on the device's real-time system status.

[0058] Optionally, in the data processing method provided in this application embodiment, determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket includes: obtaining the initial size of the receiving window of the first socket; and determining the size of the receiving window of the first socket based on the initial size of the receiving window of the first socket, the length of the receiving queue of the first socket, and the length of the sending queue of the second socket.

[0059] In a TCP proxy scenario, two user-space sockets are created (i.e., sock0 and sock1), and these two sockets are associated. The receive window of sock0 (the first socket mentioned above) can be jointly controlled by the receive queue length of sock0 (the first socket mentioned above) and the send queue length of sock1 (the second socket mentioned above).

[0060] sock0_rcv_wnd=default_wnd-(sock0_rcv_queue+sock1_send_queue)

[0061] Wherein, sock0_rcv_wnd represents the size of the receive window of sock0, default_wnd represents the size of the default window (corresponding to the initial size of the receive window mentioned above), and default_wnd can be agreed to have a default value of 128KB, sock0_rcv_queue represents the length of the receive queue of sock0, and sock1_send_queue represents the length of the send queue of sock1.

[0062] Similarly, the receive window of sock1 (the second socket mentioned above) is jointly controlled by the receive queue length of sock1 (the second socket mentioned above) and the send queue length of sock0 (the first socket mentioned above):

[0063] sock1_rcv_Wnd=default_wnd-(sock1_rcv_queue+sock0_send_queue)

[0064] Wherein, sock1_rcv_wnd represents the size of the receive window of sock1, default_wnd represents the size of the default window (corresponding to the initial size of the receive window mentioned above), and default_wnd can be agreed to have a default value of 128KB, sock1_rcv_queue represents the length of the receive queue of sock1, and sock0_send_queue represents the length of the send queue of sock0.

[0065] In summary, even when the network quality on both sides is inconsistent, the TCP connections on both sides remain independent. Based on the reliable transmission characteristics of TCP connections, reliable data transmission can be guaranteed. At the same time, by dynamically adjusting the receive windows of sock0 and sock1, the transmission speed of TCP connections on both sides can be balanced, avoiding situations where TCP connection data transmission is blocked due to slow application layer processing.

[0066] Optionally, in the data processing method provided in this application embodiment, adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; if the number of packets that the proxy device can currently receive in the data information set is less than the preset number, then adjusting the size of the receiving window of the first socket to 0; if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, then determining whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate, and determining whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate, and obtaining a determination result; adjusting the size of the receiving window of the first socket according to the determination result to obtain the adjusted receiving window of the first socket.

[0067] For example, when dynamically adjusting the TCP window, it can first be determined whether the remaining number of packets on the proxy device is less than the threshold (the aforementioned preset number). If the remaining number of packets on the proxy device is less than the threshold (the aforementioned preset number), the receive window size of sock0 (the aforementioned first socket) can be set to 0. If the remaining number of packets on the proxy device is not less than the threshold (the aforementioned preset number), it can then be determined whether the CPU utilization of the proxy device is greater than 90% (the aforementioned first preset utilization rate) and whether the memory utilization of the proxy device is greater than 95% (the aforementioned second preset utilization rate). The receive window of sock0 (the aforementioned first socket) can then be dynamically adjusted based on the results of both (CPU utilization and memory utilization). Furthermore, the values ​​corresponding to the aforementioned first preset utilization rate and the aforementioned second preset utilization rate can be the same or different. That is, the aforementioned first preset utilization rate and the aforementioned second preset utilization rate can both be set to 90%, or the aforementioned first preset utilization rate can be set to 90%, and the aforementioned second preset utilization rate can be set to 95%.

[0068] With the above scheme, when the number of remaining packets in the system is lower than the threshold, sock0 can close the TCP window and reject new TCP connections, preventing packet resources from being further consumed and affecting other TCP connections.

[0069] Optionally, in the data processing method provided in this application embodiment, adjusting the size of the receiving window of the first socket according to the judgment result to obtain the adjusted receiving window of the first socket includes: if the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate and the memory utilization rate of the proxy device in the data information set is not greater than a second preset utilization rate, then the receiving window of the first socket is reduced to a target value; if the CPU utilization rate of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the receiving window of the first socket is reduced to a target value; if the CPU utilization rate of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is not greater than the second preset utilization rate, then the size of the receiving window of the first socket is not adjusted; if the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the size of the receiving window of the first socket is adjusted based on the CPU utilization rate and the memory utilization rate of the proxy device to obtain the adjusted receiving window of the first socket.

[0070] For example, when the proxy device's CPU utilization is greater than 90% (the first preset utilization rate mentioned above) and the proxy device's memory utilization is not greater than 95% (the second preset utilization rate mentioned above), sock0 can multiply the original window by a coefficient. That is, when the CPU utilization exceeds 90%, the higher the CPU utilization, the smaller the TCP window. When the proxy device's CPU utilization is not greater than 90% (the first preset utilization rate mentioned above) and the proxy device's memory utilization is greater than 95% (the second preset utilization rate mentioned above), sock0 can multiply the original window by a coefficient. That is, when the memory utilization exceeds... If the CPU utilization is 95%, then the higher the memory utilization, the smaller the TCP window will be. When the CPU utilization of the proxy device is no greater than 90% (the first preset utilization rate mentioned above) and the memory utilization of the proxy device is no greater than 95% (the second preset utilization rate mentioned above), then there is no need to adjust the receive window of sock0 (the first socket mentioned above). When the CPU utilization of the proxy device is greater than 90% (the first preset utilization rate mentioned above) and the memory utilization of the proxy device is greater than 95% (the second preset utilization rate mentioned above), then the receive window size of sock0 (the first socket mentioned above) can be adjusted according to the CPU utilization and memory utilization of the proxy device.

[0071] By using the above method, when the system's CPU utilization or memory utilization exceeds the preset value, the TCP window can be reduced, thereby ensuring system stability and preventing impact on already proxied TCP connections.

[0072] Optionally, in the data processing method provided in this application embodiment, adjusting the size of the receiving window of the first socket based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receiving window of the first socket includes: calculating the size of the receiving window of the first socket based on the CPU utilization of the proxy device to obtain a first size corresponding to the receiving window; calculating the size of the receiving window of the first socket based on the memory utilization of the proxy device to obtain a second size corresponding to the receiving window; comparing the values ​​corresponding to the first size and the second size to obtain the smaller value of the first size and the second size; and adjusting the size of the receiving window of the first socket to the smaller value of the first size and the second size to obtain the adjusted receiving window of the first socket.

[0073] For example, when the CPU utilization of the proxy device is greater than 90% (the first preset utilization rate mentioned above) and the memory utilization of the proxy device is greater than 95% (the second preset utilization rate mentioned above), then sock0 can multiply the original window by a coefficient and determine the receiving window size of sock0 (the first socket mentioned above) calculated based on the CPU utilization rate and the receiving window size of sock0 (the first socket mentioned above) calculated based on the memory utilization rate. Then, the smaller of the two calculated receiving windows is taken as the final receiving window of sock0 (the first socket mentioned above).

[0074] By using the above scheme, when the system's CPU utilization and memory utilization both exceed the preset values, a smaller window can be used as the final receive window for sock0, thereby ensuring system stability and preventing impact on already proxied TCP connections.

[0075] Optionally, in the data processing method provided in this application embodiment, responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device includes: obtaining the sequence number of the target message, and determining whether the adjusted receiving window of the first socket allows receiving the target message based on the sequence number of the target message; if the adjusted receiving window of the first socket does not allow receiving the target message, then prohibiting the sending of the target message to the receiving device; if the adjusted receiving window of the first socket allows receiving the target message, then adding the target message to the receiving queue of the first socket; reading the target message from the receiving queue of the first socket and adding the target message to the sending queue of the second socket; and sending the target message in the sending queue of the second socket to the receiving device.

[0076] For example, Figure 4 This is a schematic diagram of an optional data processing method provided according to an embodiment of this application, such as... Figure 4As shown, the proxy device establishes a TCP connection with the sending end through sock0 and with the receiving end through sock1. Optional data processing methods include the following steps:

[0077] (1) The sending end sends a request to the proxy device;

[0078] (2) The agent device calculates and adjusts its own receiving window. When the received message sequence number is within the range allowed by the receiving window, it allows the receiving of the message and puts it into the receiving queue of sock0.

[0079] (3) The application layer reads the receive queue of sock0, reads in order, retrieves the message, and puts the message into the send queue of sock1 after processing.

[0080] (4) The proxy device sends the message to the receiving end through sock1;

[0081] (5) The response message returned by the receiving end arrives at the agent device;

[0082] (6) The agent device calculates and adjusts its own receiving window. When the received message sequence number is within the range allowed by the receiving window, it allows the receiving of the message and puts it into the receiving queue of sock1.

[0083] (7) The application layer reads the receive queue of sock1, reads in order, retrieves the message, and puts the message into the send queue of sock0 after processing.

[0084] (8) The agent device sends the message to the sender through sock0.

[0085] In summary, creating two user-space sockets can prevent TCP connection blocking and provide users with a high-performance, stable TCP proxy solution.

[0086] Optionally, in the data processing method provided in this application embodiment, after responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device, the method further includes: when it is detected that the first socket sends target notification information to the sending device within a preset time period, the size of the receiving window of the first socket is recalculated to obtain the recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; if the recalculated size of the receiving window of the first socket is greater than the preset value, a window update message is sent to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0087] For example, Figure 5 This is a schematic diagram of the active notification window update in an embodiment of this application, such as... Figure 5 As shown, after processing the packets in the sock1 receive queue, the proxy device actively checks if sock0 has recently had a zero window and recalculates the sock0 receive window size (since the sock0 receive queue has been cleared, the sock0 receive window is likely to be updated and expanded). If sock0 recently advertised a zero window and its current window has been updated (assuming the preset value is 16KB, meaning the recalculated sock0 receive window size exceeds 16KB), then sock0 can proactively send a window update message to the sender, allowing the TCP connection to resume data transmission. Conversely, if sock0 recently advertised a zero window, but the recalculated sock0 receive window size does not exceed 16KB, then sock0 cannot proactively send a window update message to the sender.

[0088] The above solution can prevent TCP connections from being idle for extended periods, thereby significantly improving data transmission efficiency.

[0089] For example, this embodiment provides a scheme for controlling the TCP receive window in proxy mode. By creating a user-space TCP socket and associating it with sockets on both sides, and combining the real-time CPU utilization, memory utilization, and the number of remaining available packets in the system, the TCP window is dynamically adjusted. When the TCP connection has a zero window, a TCP window update message is actively sent to avoid the TCP connection being in a waiting or congested state for a long time. This allows the network proxy device to have good TCP proxy creation performance and throughput in high-concurrency scenarios.

[0090] in addition, Figure 4 This is a schematic diagram of an optional data processing method provided according to an embodiment of this application, such as... Figure 4 As shown, the proxy device establishes a TCP connection with the sending end through sock0 and with the receiving end through sock1. Optional data processing methods include the following steps:

[0091] (1) The sending end sends a request to the proxy device;

[0092] (2) The agent device calculates and adjusts its own receiving window. When the received message sequence number is within the range allowed by the receiving window, it allows the receiving of the message and puts it into the receiving queue of sock0.

[0093] (3) The application layer reads the receive queue of sock0, reads in order, retrieves the message, and puts the message into the send queue of sock1 after processing.

[0094] (4) The proxy device sends the message to the receiving end through sock1;

[0095] (5) The response message returned by the receiving end arrives at the agent device;

[0096] (6) The agent device calculates and adjusts its own receiving window. When the received message sequence number is within the range allowed by the receiving window, it allows the receiving of the message and puts it into the receiving queue of sock1.

[0097] (7) The application layer reads the receive queue of sock1, reads in order, retrieves the message, and puts the message into the send queue of sock0 after processing.

[0098] (8) The agent device sends the message to the sender through sock0.

[0099] For example, associating two sockets can be specifically done as follows:

[0100] For example, such as Figure 4 As shown, in a TCP proxy scenario, two user-space sockets are created (i.e., sock0 and sock1 are created) and associated with each other. The receive window of sock0 can be controlled by both the receive queue length of sock0 and the send queue length of sock1.

[0101] sock0_rcv_wnd=default_wnd-(sock0_rcv_queue+sock1_send_queue)

[0102] Wherein, sock0_rcv_wnd represents the size of the receive window of sock0, default_wnd represents the size of the default window, and default_wnd can be agreed to have a default value of 128KB, sock0_rcv_queue represents the length of the receive queue of sock0, and sock1_send_queue represents the length of the send queue of sock1.

[0103] Similarly, the receive window of sock1 is jointly controlled by the receive queue length of sock1 and the send queue length of sock0:

[0104] sock1_rcv_wnd=default_wnd-(sock1_rcv_queue+sock0_send_queue)

[0105] Wherein, sock1_rcv_wnd represents the size of the receive window of sock1, default_wnd represents the size of the default window, and default_wnd can be agreed to have a default value of 128KB, sock1_rcv_queue represents the length of the receive queue of sock1, and sock0_send_queue represents the length of the send queue of sock0.

[0106] In this way, even when the network quality on both sides is inconsistent, the TCP connections on both sides remain independent. Based on the reliable transmission characteristics of TCP connections, reliable data transmission can be guaranteed. At the same time, by dynamically adjusting the receive windows of sock0 and sock1, the transmission speed of TCP connections on both sides can be balanced, avoiding situations where TCP connection data transmission is blocked due to slow application layer processing.

[0107] For example, dynamically adjusting the TCP window can be done as follows:

[0108] When multiple senders initiate TCP connection requests simultaneously, resulting in a large number of concurrent TCP connections, the receive and send queues of both sockets are initially idle. At this time, sock0 calculates the TCP receive window as default_wnd (which can be agreed upon as a default value of 128KB). However, given the large number of concurrent TCP connections and the limited remaining resources of the proxy device, it is inappropriate for sock0 to announce a 128KB window to the senders. This can easily cause TCP connection congestion and further consume the system resources of the proxy device, even affecting the data transmission of other TCP connections.

[0109] In this embodiment, the real-time system status of the agent device can be fully considered, including CPU utilization (denoted by c, and 0% ≤ c ≤ 100%), memory utilization (denoted by m, and 0% ≤ m ≤ 100%), and remaining packet count (denoted by p, and p should not be lower than the threshold P). thresh (And this threshold is configurable), and the receive window of the TCP connection can be dynamically calculated in the following way.

[0110]

[0111] Where sock0_rcv_wnd represents the size of the receive window of sock0, K m and K c All represent coefficients, and wnd represents the size of the default window (base window).

[0112] (1) When p <P thresh That is, when the number of remaining packets in the system is lower than the threshold, sock0 should close the TCP window, reject new TCP connections, and prevent packet resources from being further consumed, thus affecting other TCP connections;

[0113] (2) When m≥90% and c<90%, sock0 should be multiplied by a coefficient based on the original window. When the memory utilization exceeds 90%, the higher the memory utilization, the smaller the TCP window will be.

[0114] (3) When m < 90% and c ≥ 90%, sock0 should be multiplied by a coefficient based on the original window. When the CPU utilization exceeds 90%, the higher the CPU utilization, the smaller the TCP window should be.

[0115] (4) When m≥90% and c≥90%, sock0 should be multiplied by a coefficient based on the original window size, and the smaller window size should be selected.

[0116] For example, the process of proactively notifying the window to update can be specifically as follows:

[0117] In practical applications, due to various influencing factors (such as slow application layer processing leading to a backlog in the receive queue), the TCP zero-window phenomenon is inevitable. When sock0 has a TCP zero window (i.e., sock0 announces a receive window of 0 to the sender), it means that the sender can no longer send data to the proxy device. According to the inherent TCP mechanism, the sender can only send a window probe packet to the proxy device after 200ms. If the proxy device has already finished processing the received packets, it will update the receive window of sock0 and announce it to the sender. However, under normal circumstances, the proxy device has already finished processing the data in the sock1 receive queue within 200ms and is already capable of receiving data again. If the proxy device keeps passively updating the window, there will be no data transmission on the TCP connection during those 200ms, resulting in inefficient data transmission.

[0118] For example, Figure 5 This is a schematic diagram of the active notification window update in an embodiment of this application, such as... Figure 5 As shown, after the proxy device completes the message processing of the sock1 receive queue, it actively checks whether sock0 has recently had a zero window and recalculates the receive window size of sock0 (since the sock0 receive queue has been cleared at this time, the sock0 receive window is likely to be updated and expanded). If sock0 has recently announced a zero window and the current sock0 window has been updated, then sock0 actively sends a window update message to the sender, so that the TCP connection resumes data transmission, avoids the TCP connection being idle for a long time, and can greatly improve data transmission efficiency.

[0119] For example, the methods provided in the embodiments of this application can be applied to network proxy devices (including but not limited to network traffic security devices, network data forwarding devices, network traffic analysis devices, and network traffic management devices, such as FW (Firewall) / NGFW (Next-Generation Firewall), IDS (Intrusion Detection System) / IPS (Intrusion Prevention System), WAF (Web Application Firewall), ADC (Application Delivery Controller, load balancing refers to a technology that distributes network traffic to different application servers to achieve network load balancing), BDS (a platform for network security protection), etc.), and are also applicable to virtualized network functions or virtualized network devices (including but not limited to virtualized network traffic security functions or devices, virtualized network data forwarding functions or devices, virtualized network traffic analysis functions or devices, and virtualized network traffic management functions or devices).

[0120] Moreover, it can be applied to network proxy devices to proxy TCP connections based on user-space TCP sockets. On this TCP proxy basis, various application layer functions can be implemented.

[0121] For example, this embodiment provides users with a high-performance and stable TCP proxy solution by creating a user-space TCP socket, and has the following beneficial effects:

[0122] (1) It has a wide range of applications

[0123] It is suitable for various network devices, security devices, network function software, and network security software, including bare metal, virtualization, and container platforms.

[0124] (2) Stable TCP proxy can be achieved

[0125] By associating sockets on both sides, dynamically adjusting the TCP window, and proactively sending window update messages when the TCP connection reaches zero window, multiple measures are taken to ensure the stability of the TCP proxy and high-performance data transmission.

[0126] Furthermore, TCP connection proxying can be implemented by creating user-space TCP sockets; and TCP receive windows can be dynamically adjusted by associating sockets on both sides and using an efficient associative window adjustment algorithm; in addition, when a zero window occurs, efficient data transmission of TCP connections can be achieved by actively sending window update messages.

[0127] In summary, the data processing method provided in this application, when the proxy device receives a target request sent by the sending device, obtains the length of the receive queue of the first socket and the length of the send queue of the second socket. The target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message. The method also obtains a data information set of the proxy device, which includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive. Based on the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, the method adjusts the size of the receive window of the first socket to obtain the adjusted receive window. Finally, the method responds to the target request through the adjusted receive window of the first socket and sends the target message to the receiving device. This solves the problem in related technologies where it is difficult to adjust the size of the receive window of the proxy device in a timely manner, leading to potential blocking of the TCP connection between the proxy device and the sending and receiving ends, and consequently, low efficiency in transmitting data using the TCP Transmission Control Protocol. By obtaining the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, and adjusting the size of the receive window of the first socket according to the length of the receive queue of the first socket, the adjusted receive window of the first socket is obtained. Then, the target request sent by the sending device is responded to through the adjusted receive window of the first socket, and the target packet is sent to the receiving device. This allows for timely adjustment of the receive window size of the proxy device and avoids blocking of the TCP connection between the proxy device and the sending and receiving ends, ensuring the stability of the TCP proxy and thus improving the efficiency of data transmission using the TCP Transmission Control Protocol.

[0128] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0129] This application also provides a data processing apparatus. It should be noted that the data processing apparatus of this application can be used to execute the data processing method provided in this application. The data processing apparatus provided in this application will be described below.

[0130] Figure 6 This is a schematic diagram of a data processing apparatus provided according to an embodiment of this application. For example... Figure 6 As shown, the device includes: a first acquisition module 601, a second acquisition module 602, a first processing module 603, and a first sending module 604.

[0131] Specifically, the first acquisition module 601 is used to acquire the length of the receiving queue of the first socket and the length of the sending queue of the second socket when the proxy device receives the target request sent by the sending device. The target request is used to request the sending of a target message to the receiving device, the receiving queue is used to receive the target message, and the sending queue is used to send the target message.

[0132] The second acquisition module 602 is used to acquire a set of data information of the proxy device, wherein the set of data information includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of packets that the proxy device can currently receive;

[0133] The first processing module 603 is used to adjust the size of the receiving window of the first socket according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device, so as to obtain the adjusted receiving window of the first socket.

[0134] The first sending module 604 is used to respond to the target request through the adjusted receiving window of the first socket and send the target message to the receiving device.

[0135] In summary, the data processing apparatus provided in this application embodiment, through the first acquisition module 601, when the proxy device receives a target request sent by the sending device, acquires the length of the receive queue of the first socket and the length of the send queue of the second socket, wherein the target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message; the second acquisition module 602 acquires the data information set of the proxy device, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive; the first processing module 603 adjusts the size of the receive window of the first socket according to the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, to obtain the adjusted receive window of the first socket; the first sending module 604 responds to the target request through the adjusted receive window of the first socket and sends the target message to the receiving device, thereby solving the problem in the related technology that it is difficult to adjust the size of the receive window of the proxy device in a timely manner, which leads to the TCP connection between the proxy device and the sending end and the receiving end being easily blocked, resulting in low efficiency of data transmission using the TCP transmission control protocol. By obtaining the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device, and adjusting the size of the receive window of the first socket according to the length of the receive queue of the first socket, the adjusted receive window of the first socket is obtained. Then, the target request sent by the sending device is responded to through the adjusted receive window of the first socket, and the target packet is sent to the receiving device. This allows for timely adjustment of the receive window size of the proxy device and avoids blocking of the TCP connection between the proxy device and the sending and receiving ends, ensuring the stability of the TCP proxy and thus improving the efficiency of data transmission using the TCP Transmission Control Protocol.

[0136] Optionally, in the data processing apparatus provided in this application embodiment, the first processing module 603 includes: a first determining unit, configured to determine the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; and a first processing unit, configured to adjust the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0137] Optionally, in the data processing apparatus provided in this application embodiment, the first processing unit includes: a first judgment submodule, configured to determine whether the number of packets currently receivable by the proxy device in the data information set is less than a preset number; a first processing submodule, configured to adjust the size of the receiving window of the first socket to 0 if the number of packets currently receivable by the proxy device in the data information set is less than the preset number; a second judgment submodule, configured to determine whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate and whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate if the number of packets currently receivable by the proxy device in the data information set is not less than the preset number, thereby obtaining a judgment result; and a second processing submodule, configured to adjust the size of the receiving window of the first socket according to the judgment result, thereby obtaining the adjusted receiving window of the first socket.

[0138] Optionally, in the data processing apparatus provided in this application embodiment, the second processing submodule includes: a first shrinking subunit, configured to shrink the receiving window of the first socket to a target value if the CPU utilization of the proxy device in the data information set is greater than a first preset utilization rate and the memory utilization of the proxy device in the data information set is not greater than a second preset utilization rate; a second shrinking subunit, configured to shrink the receiving window of the first socket to a target value if the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization of the proxy device in the data information set is greater than the second preset utilization rate; a first processing subunit, configured not to adjust the size of the receiving window of the first socket if the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization of the proxy device in the data information set is not greater than the second preset utilization rate; and a second processing subunit, configured to adjust the size of the receiving window of the first socket based on the CPU utilization and memory utilization of the proxy device in the data information set if the CPU utilization of the proxy device in the data information set is greater than the first preset utilization rate and the memory utilization of the proxy device in the data information set is greater than the second preset utilization rate, to obtain an adjusted receiving window of the first socket.

[0139] Optionally, in the data processing apparatus provided in this application embodiment, the second processing subunit includes: a calculation subunit one, used to calculate the size of the receiving window of the first socket based on the CPU utilization of the proxy device, to obtain a first size corresponding to the receiving window; a calculation subunit two, used to calculate the size of the receiving window of the first socket based on the memory utilization of the proxy device, to obtain a second size corresponding to the receiving window; a comparison subunit one, used to compare the values ​​corresponding to the first size and the second size, to obtain the smaller value of the first size and the second size; and an adjustment subunit one, used to adjust the size of the receiving window of the first socket to the smaller value of the first size and the second size, to obtain the adjusted receiving window of the first socket.

[0140] Optionally, in the data processing apparatus provided in this application embodiment, the first determining unit includes: a first acquiring submodule, used to acquire the initial size of the receiving window of the first socket; and a first determining submodule, used to determine the size of the receiving window of the first socket based on the initial size of the receiving window of the first socket, the length of the receiving queue of the first socket, and the length of the sending queue of the second socket.

[0141] Optionally, in the data processing apparatus provided in this application embodiment, the apparatus further includes: a first detection module, configured to, after responding to a target request through the adjusted receiving window of the first socket and sending a target message to the receiving device, when it is detected that the first socket sends target notification information to the sending device within a preset time period, recalculate the size of the receiving window of the first socket to obtain the recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; a second sending module, configured to, when the recalculated size of the receiving window of the first socket is greater than a preset value, send a window update message to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0142] Optionally, in the data processing apparatus provided in this application embodiment, the first sending module 604 includes: a second processing unit, configured to obtain the sequence number of the target message and, based on the sequence number of the target message, determine whether the adjusted receiving window of the first socket allows receiving the target message; a third processing unit, configured to prohibit sending the target message to the receiving device if the adjusted receiving window of the first socket does not allow receiving the target message; a first adding unit, configured to add the target message to the receiving queue of the first socket if the adjusted receiving window of the first socket allows receiving the target message; a second adding unit, configured to read the target message from the receiving queue of the first socket and add the target message to the sending queue of the second socket; and a first sending unit, configured to send the target message in the sending queue of the second socket to the receiving device.

[0143] The data processing device includes a processor and a memory. The first acquisition module 601, the second acquisition module 602, the first processing module 603, and the first sending module 604 mentioned above are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0144] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the efficiency of data transmission using the TCP transmission control protocol.

[0145] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0146] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the data processing method.

[0147] This invention provides a processor for running a program, wherein the program executes the data processing method during runtime.

[0148] like Figure 7 As shown, this embodiment of the invention provides an electronic device. The device includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: When the proxy device receives a target request sent by the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket, wherein the target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message; it obtains a data information set of the proxy device, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive; it adjusts the size of the receive window of the first socket according to the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device to obtain the adjusted receive window of the first socket; it responds to the target request through the adjusted receive window of the first socket and sends the target message to the receiving device.

[0149] When the processor executes the program, it also performs the following steps: adjusting the size of the receiving window of the first socket based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket, including: determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0150] When the processor executes the program, it also performs the following steps: adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; if the number of packets that the proxy device can currently receive in the data information set is less than the preset number, then adjusting the size of the receiving window of the first socket to 0; if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, then determining whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate, and determining whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate, and obtaining the determination result; adjusting the size of the receiving window of the first socket according to the determination result to obtain the adjusted receiving window of the first socket.

[0151] When the processor executes the program, it also performs the following steps: adjusting the size of the receiving window of the first socket according to the judgment result to obtain the adjusted receiving window of the first socket includes: if the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is not greater than the second preset utilization rate, then the receiving window of the first socket is reduced to the target value; if the CPU utilization rate of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the receiving window of the first socket is reduced to the target value; if the CPU utilization rate of the proxy device in the data information set is not greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is not greater than the second preset utilization rate, then the size of the receiving window of the first socket is not adjusted; if the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the size of the receiving window of the first socket is adjusted based on the CPU utilization rate and the memory utilization rate of the proxy device to obtain the adjusted receiving window of the first socket.

[0152] When the processor executes the program, it also performs the following steps: adjusting the size of the receive window of the first socket based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receive window of the first socket, including: calculating the size of the receive window of the first socket based on the CPU utilization of the proxy device to obtain a first size corresponding to the receive window; calculating the size of the receive window of the first socket based on the memory utilization of the proxy device to obtain a second size corresponding to the receive window; comparing the values ​​corresponding to the first size and the second size to obtain the smaller value of the first size and the second size; and adjusting the size of the receive window of the first socket to the smaller value of the first size and the second size to obtain the adjusted receive window of the first socket.

[0153] When the processor executes the program, it also performs the following steps: determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket, including: obtaining the initial size of the receiving window of the first socket; determining the size of the receiving window of the first socket based on the initial size of the receiving window of the first socket, the length of the receiving queue of the first socket, and the length of the sending queue of the second socket.

[0154] The processor, when executing the program, also implements the following steps: after responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device, the method further includes: when it is detected that the first socket sends target notification information to the sending device within a preset time period, the size of the receiving window of the first socket is recalculated to obtain the recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; if the recalculated size of the receiving window of the first socket is greater than the preset value, a window update message is sent to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0155] When the processor executes the program, it also performs the following steps: responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device, including: obtaining the sequence number of the target message, and determining, based on the sequence number of the target message, whether the adjusted receiving window of the first socket allows receiving the target message; if the adjusted receiving window of the first socket does not allow receiving the target message, then prohibiting the sending of the target message to the receiving device; if the adjusted receiving window of the first socket allows receiving the target message, then adding the target message to the receiving queue of the first socket; reading the target message from the receiving queue of the first socket and adding the target message to the sending queue of the second socket; and sending the target message in the sending queue of the second socket to the receiving device.

[0156] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0157] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: when the proxy device receives a target request sent by the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket, wherein the target request is used to request the sending of a target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message; it obtains a data information set of the proxy device, wherein the data information set includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of messages that the proxy device can currently receive; it adjusts the size of the receive window of the first socket according to the length of the receive queue of the first socket, the length of the send queue of the second socket, and the data information set of the proxy device to obtain the adjusted receive window of the first socket; it responds to the target request through the adjusted receive window of the first socket and sends the target message to the receiving device.

[0158] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: adjusting the size of the receiving window of the first socket based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket, including: determining the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket.

[0159] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; if the number of packets that the proxy device can currently receive in the data information set is less than the preset number, then adjusting the size of the receiving window of the first socket to 0; if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, then determining whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate, and determining whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate, and obtaining the determination result; adjusting the size of the receiving window of the first socket according to the determination result to obtain the adjusted receiving window of the first socket.

[0160] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: adjusting the size of the receiving window of the first socket based on the judgment result to obtain the adjusted receiving window of the first socket includes: if the CPU utilization of the proxy device in the data set is greater than a first preset utilization and the memory utilization of the proxy device in the data set is not greater than a second preset utilization, then the receiving window of the first socket is reduced to the target value; if the CPU utilization of the proxy device in the data set is not greater than the first preset utilization and the memory utilization of the proxy device in the data set is greater than the second preset utilization, then the receiving window of the first socket is reduced to the target value; if the CPU utilization of the proxy device in the data set is not greater than the first preset utilization and the memory utilization of the proxy device in the data set is not greater than the second preset utilization, then the size of the receiving window of the first socket is not adjusted; if the CPU utilization of the proxy device in the data set is greater than the first preset utilization and the memory utilization of the proxy device in the data set is greater than the second preset utilization, then the size of the receiving window of the first socket is adjusted based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receiving window of the first socket.

[0161] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: adjusting the size of the receive window of the first socket based on the CPU utilization and memory utilization of the proxy device to obtain the adjusted receive window of the first socket, including: calculating the size of the receive window of the first socket based on the CPU utilization of the proxy device to obtain a first size corresponding to the receive window; calculating the size of the receive window of the first socket based on the memory utilization of the proxy device to obtain a second size corresponding to the receive window; comparing the values ​​corresponding to the first size and the second size to obtain the smaller value of the first size and the second size; adjusting the size of the receive window of the first socket to the smaller value of the first size and the second size to obtain the adjusted receive window of the first socket.

[0162] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: determining the size of the receive window of the first socket based on the length of the receive queue of the first socket and the length of the send queue of the second socket, including: obtaining the initial size of the receive window of the first socket; determining the size of the receive window of the first socket based on the initial size of the receive window of the first socket, the length of the receive queue of the first socket, and the length of the send queue of the second socket.

[0163] When executed on a data processing device, the method is also suitable for executing an initialization procedure with the following steps: after responding to a target request through the adjusted receiving window of the first socket and sending a target message to the receiving device, the method further includes: when it is detected that the first socket sends target notification information to the sending device within a preset time period, recalculating the size of the receiving window of the first socket to obtain a recalculated size of the receiving window of the first socket, wherein the preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message, and the target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0; if the recalculated size of the receiving window of the first socket is greater than the preset value, sending a window update message to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receiving window of the first socket is not 0.

[0164] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: responding to a target request through the adjusted receiving window of the first socket and sending a target message to the receiving device, including: obtaining the sequence number of the target message, and determining, based on the sequence number of the target message, whether the adjusted receiving window of the first socket allows receiving the target message; if the adjusted receiving window of the first socket does not allow receiving the target message, then prohibiting the sending of the target message to the receiving device; if the adjusted receiving window of the first socket allows receiving the target message, then adding the target message to the receiving queue of the first socket; reading the target message from the receiving queue of the first socket and adding the target message to the sending queue of the second socket; sending the target message in the sending queue of the second socket to the receiving device.

[0165] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0166] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0167] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0170] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0171] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0172] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0173] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0174] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data processing method, characterized in that, The method is applied in a data processing system, which includes at least: a proxy device, a sending device for sending a target message, and a receiving device for receiving the target message. The proxy device includes at least a first socket and a second socket. The first socket is used to establish a first TCP connection between the proxy device and the sending device, and the second socket is used to establish a second TCP connection between the proxy device and the receiving device. The first TCP connection and the second TCP connection are used to transmit the target message, which includes at least data to be sent from the sending device to the receiving device. The data processing method includes: When the proxy device receives a target request sent by the sending device, it obtains the length of the receive queue of the first socket and the length of the send queue of the second socket. The target request is used to request the sending of the target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message. Obtain a set of data information of the proxy device, wherein the set of data information includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of packets that the proxy device can currently receive; The size of the receiving window of the first socket is adjusted based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket. The adjustment of the receiving window size based on the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: The size of the receiving window of the first socket is determined based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; the size of the receiving window of the first socket is adjusted based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket. Adjusting the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket includes: determining whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; if the number of packets that the proxy device can currently receive in the data information set is less than the preset number, then adjusting the size of the receiving window of the first socket to 0; if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, then determining whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate, and determining whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate, and obtaining a determination result; adjusting the size of the receiving window of the first socket according to the determination result to obtain the adjusted receiving window of the first socket; The target request is responded to through the receiving window of the adjusted first socket, and the target message is sent to the receiving device.

2. The method according to claim 1, characterized in that, Based on the judgment result, the size of the receiving window of the first socket is adjusted to obtain the adjusted receiving window of the first socket, which includes: If the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate, and the memory utilization rate of the proxy device in the data information set is not greater than the second preset utilization rate, then the receiving window of the first socket is reduced to the target value. If the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization, and the memory utilization of the proxy device in the data information set is greater than the second preset utilization, then the receiving window of the first socket is reduced to the target value. If the CPU utilization of the proxy device in the data information set is not greater than the first preset utilization, and the memory utilization of the proxy device in the data information set is not greater than the second preset utilization, then the size of the receiving window of the first socket will not be adjusted. If the CPU utilization rate of the proxy device in the data information set is greater than the first preset utilization rate, and the memory utilization rate of the proxy device in the data information set is greater than the second preset utilization rate, then the size of the receiving window of the first socket is adjusted based on the CPU utilization rate and the memory utilization rate of the proxy device to obtain the adjusted receiving window of the first socket.

3. The method according to claim 2, characterized in that, The size of the receive window of the first socket is adjusted based on the CPU utilization and memory utilization of the proxy device, resulting in the adjusted receive window of the first socket, which includes: The size of the receiving window of the first socket is calculated based on the CPU utilization of the proxy device, and the first size corresponding to the receiving window is obtained. The size of the receiving window of the first socket is calculated based on the memory utilization of the proxy device, and the second size corresponding to the receiving window is obtained. Compare the values ​​corresponding to the first size and the second size to obtain the smaller value between the first size and the second size; The size of the receiving window of the first socket is adjusted to the smaller value between the first size and the second size to obtain the adjusted receiving window of the first socket.

4. The method according to claim 1, characterized in that, The size of the receive window of the first socket is determined based on the length of the receive queue of the first socket and the length of the send queue of the second socket, including: Get the initial size of the receive window of the first socket; The size of the receive window of the first socket is determined based on the initial size of the receive window of the first socket, the length of the receive queue of the first socket, and the length of the send queue of the second socket.

5. The method according to claim 1, characterized in that, After responding to the target request through the receive window of the adjusted first socket and sending the target message to the receiving device, the method further includes: When it is detected that the first socket sends target notification information to the sending device within a preset time period, the size of the receiving window of the first socket is recalculated to obtain the recalculated size of the receiving window of the first socket. The preset time period is the time period after the sending device sends the target request and before the receiving device receives the target message. The target notification information is used to notify the sending device that the size of the receiving window of the first socket is 0. If the size of the receive window of the recalculated first socket is greater than a preset value, a window update message is sent to the sending device through the first socket, wherein the window update message is used to notify the sending device that the size of the receive window of the first socket is not 0.

6. The method according to claim 1, characterized in that, Responding to the target request through the adjusted receiving window of the first socket and sending the target message to the receiving device includes: Obtain the sequence number of the target message, and based on the sequence number of the target message, determine whether the receive window of the adjusted first socket allows receiving the target message; If the receiving window of the adjusted first socket does not allow the receiving of the target message, then the sending of the target message to the receiving device is prohibited. If the adjusted receive window of the first socket allows the receiving of the target message, then the target message is added to the receive queue of the first socket. Read the target message from the receive queue of the first socket and add the target message to the send queue of the second socket; The target message in the send queue of the second socket is sent to the receiving device.

7. A data processing apparatus, characterized in that, The apparatus is used in a data processing system, which includes at least: a proxy device, a sending device for sending a target message, and a receiving device for receiving the target message. The proxy device includes at least a first socket and a second socket. The first socket is used to establish a first TCP connection between the proxy device and the sending device, and the second socket is used to establish a second TCP connection between the proxy device and the receiving device. The first TCP connection and the second TCP connection are used to transmit the target message, which includes at least data to be sent from the sending device to the receiving device. The data processing apparatus includes: The first acquisition module is used to acquire the length of the receive queue of the first socket and the length of the send queue of the second socket when the proxy device receives the target request sent by the sending device, wherein the target request is used to request the sending of the target message to the receiving device, the receive queue is used to receive the target message, and the send queue is used to send the target message; The second acquisition module is used to acquire a set of data information of the proxy device, wherein the set of data information includes at least: the CPU utilization rate of the proxy device, the memory utilization rate of the proxy device, and the number of packets that the proxy device can currently receive; The first processing module is used to adjust the size of the receiving window of the first socket according to the length of the receiving queue of the first socket, the length of the sending queue of the second socket, and the data information set of the proxy device, so as to obtain the adjusted receiving window of the first socket. The first processing module includes: a first determining unit, configured to determine the size of the receiving window of the first socket based on the length of the receiving queue of the first socket and the length of the sending queue of the second socket; and a first processing unit, configured to adjust the size of the receiving window of the first socket based on the data information set of the proxy device to obtain the adjusted receiving window of the first socket. The first processing unit includes: a first judgment submodule, used to judge whether the number of packets that the proxy device can currently receive in the data information set is less than a preset number; a first processing submodule, used to adjust the size of the receiving window of the first socket to 0 if the number of packets that the proxy device can currently receive in the data information set is less than the preset number; a second judgment submodule, used to judge whether the CPU utilization rate of the proxy device in the data information set is greater than a first preset utilization rate and whether the memory utilization rate of the proxy device in the data information set is greater than a second preset utilization rate if the number of packets that the proxy device can currently receive in the data information set is not less than the preset number, and to obtain a judgment result; and a second processing submodule, used to adjust the size of the receiving window of the first socket according to the judgment result, to obtain the adjusted receiving window of the first socket. The first sending module is used to respond to the target request through the receiving window of the adjusted first socket and send the target message to the receiving device.

8. A processor for data processing, characterized in that, The processor is used to run a program, wherein the program executes the data processing method according to any one of claims 1 to 6 when it runs.

Citation Information

Patent Citations

  • Congestion control method and device, and computer readable medium

    CN112054965A

  • Method and device for optimizing network congestion

    CN112532535A