Search

CN-122027676-A - Data transmission method, device, program product and medium

CN122027676ACN 122027676 ACN122027676 ACN 122027676ACN-122027676-A

Abstract

A data transmission method, a device, a program product and a medium are provided, the method is applied to first equipment, the first equipment comprises an operating system and an application, the operating system comprises a global connection pool, the global connection pool is pre-stored with information of at least one connection based on a TCP/IP protocol, the at least one connection is in a state of established connection, the method comprises the steps of detecting that the application triggers a first event, the first event is used for triggering establishment of connection based on the TCP/IP protocol between a first node and a second node, the first node is the first equipment or a module in the first equipment, determining that a first connection matched with the first event exists based on the global connection pool, the first connection is one of the at least one connection, and transmitting data between the first node and the second node based on the first connection. The shared degree of the global connection pool in the operating system is higher, so that the overhead of the storage connection and the difficulty of the management connection are reduced.

Inventors

  • PU LEHUI
  • XU KUOHAI
  • YE WEIHUA

Assignees

  • 华为技术有限公司

Dates

Publication Date
20260512
Application Date
20241112

Claims (18)

  1. 1. A data transmission method, characterized in that it is applied to a first device, the first device includes an operating system, the operating system includes a global connection pool, the global connection pool stores information of at least one connection based on a transmission control protocol TCP/internet protocol IP protocol, the at least one connection is in a state of an established connection, the method includes: In the case of detecting a first event, determining, based on the global connection pool, that there is a first connection matching the first event, the first connection being one of the at least one connection, the first event being for triggering establishment of a connection between a first node and a second node based on a TCP/IP protocol, the first node being the first device or a module in the first device; first data between the first node and the second node is transmitted based on the first connection.
  2. 2. The method of claim 1, wherein the path for transmitting data for the first connection comprises an N-layer protocol of a TCP/IP protocol stack, N being an integer greater than 1, wherein transmitting the first data between the first node and the second node based on the first connection comprises: and transmitting first data between the first node and the second node through a second connection, wherein the second connection is a result after the first connection is converted, and a path for transmitting the data by the second connection comprises an M-layer protocol of the TCP/IP protocol stack, and M is a positive integer smaller than N.
  3. 3. The method of claim 2, wherein the first node and the second node are each modules in the first device, and wherein the transmitting the first data between the first node and the second node over the second connection comprises: Invoking a socket interface through the first node, redirecting the first data to a socket interface invoked by the second node, or The first data is obtained from the socket interface called by the second node through the socket interface called by the first node; The socket interface called by the first node is arranged in the operating system and is used for realizing communication between an application layer and a transmission layer of the TCP/IP protocol stack.
  4. 4. The method of claim 2, wherein the first node and the second node are different devices or the first node and the second node belong to modules in different devices, wherein the transmitting the first data between the first node and the second node over the second connection comprises: Invoking the application layer and the transmission layer of the first node to process the second data in turn, redirecting the processed second data to the network card of the first node, and sending the first data to the network card of the second node through the network card of the first node, or And receiving third data from the network card of the second node through the network card of the first node, and calling a transmission layer and an application layer of the first node to sequentially process the third data to obtain the first data.
  5. 5. The method according to any of claims 2-4, wherein prior to said transmitting first data between said first node and said second node over said second connection, said method further comprises: Determining that the hit frequency of the first connection is greater than or equal to a first hit frequency, wherein the hit frequency represents the number of times that the first connection is successfully matched with a plurality of events in unit time, any event of the plurality of events is used for establishing a connection between the first node and other nodes based on a TCP/IP protocol, and the other nodes are nodes except the first node.
  6. 6. The method of claim 5, wherein prior to said determining that the hit frequency of the first connection is greater than or equal to a first hit frequency, the method further comprises: Adding 1 to the number of successful matches if it is detected that the first connection is successful in matching with one of the plurality of events, and maintaining the number of successful matches if it is detected that the first connection is unsuccessful in matching with one of the plurality of events; dividing the accumulated successful times of the matching by the survival time of the first connection to determine the hit frequency of the first connection.
  7. 7. The method according to any of claims 1-6, wherein the first event indicates a first internet protocol address of the first node, an internet protocol address of the second node, and a port of the second node, and wherein the global connection pool has pre-stored therein the second internet protocol address of the first node, the internet address of a peer node, and the port of the peer node, the peer node being a node that communicates data with the first node over the first connection; The determining, based on the global connection pool, that there is a first connection matching the first event includes: determining that the first internet protocol address is the same as the second internet protocol address, the internet protocol address of the second node matches the internet protocol address of the correspondent node, and the port of the second node matches the port of the correspondent node.
  8. 8. The method of any of claims 1-7, wherein after the determining that there is a first connection that matches the first event based on the global connection pool, the method further comprises: And moving out the information of the first connection pre-stored in the global connection pool, and binding the information of the first connection in the global connection pool with a socket interface called by the first node, wherein the socket interface called by the first node is arranged in the operating system and is used for realizing communication between an application layer and a transmission layer of the TCP/IP protocol stack.
  9. 9. The method of claim 8, wherein after said binding information of said first connection in said global connection pool with a socket interface invoked by said first node, said method further comprises: Releasing the first connection if the number of connections of the global connection pool that are the same as the first connection type is greater than or equal to a first number in the event that a second event is detected; In the case of detecting a second event, if the number of connections of the global connection pool that are the same as the first connection type is smaller than a first number, storing information of the first connection in the global connection pool; the second event is used for triggering disconnection of the connection based on the TCP/IP protocol between the first node and the second node, the type of the connection is the same, the type of the connection comprises the same internet protocol address of the first node corresponding to the two connections, the internet protocol addresses of the opposite end nodes corresponding to the two connections are the same, the ports of the opposite end nodes corresponding to the two connections are the same, and the opposite end nodes refer to nodes which transmit data with the first node through the connections.
  10. 10. The method according to claim 9, wherein the method further comprises: recording the time of storing the information of the first connection when the information of the first connection is stored in the global connection pool; If the time length of the first connection stored in the global connection pool is greater than or equal to the first time length according to the time of storing the information of the first connection, deleting the information of the first connection stored in the global connection pool and releasing the first connection.
  11. 11. A data transmission apparatus, comprising: A processing unit, configured to determine, based on a global connection pool in an operating system, that there is a first connection matching the first event, where the first event is used to trigger establishment of a connection between a first node and a second node based on a transmission control protocol TCP/internet protocol IP, the first connection is one of at least one connection, the at least one connection is a connection based on the TCP/IP protocol, the at least one connection is in a state of being an established connection, and information of the at least one connection is pre-stored in the global connection pool; and the communication unit is used for transmitting first data between the first node and the second node based on the first connection.
  12. 12. The apparatus of claim 11, wherein the path for transmitting data for the first connection comprises an N-layer protocol of a TCP/IP protocol stack, N being an integer greater than 1, and wherein the communication unit is configured to: and transmitting first data between the first node and the second node through a second connection, wherein the second connection is a result after the first connection is converted, and a path for transmitting the data by the second connection comprises an M-layer protocol of the TCP/IP protocol stack, and M is a positive integer smaller than N.
  13. 13. The apparatus of claim 12, wherein the first node and the second node are each modules in a first device, and wherein the communication unit is specifically configured to: Invoking a socket interface through the first node, redirecting the first data to a socket interface invoked by the second node, or The first data is obtained from the socket interface called by the second node through the socket interface called by the first node; The socket interface called by the first node is arranged in the operating system and is used for realizing communication between an application layer and a transmission layer of the TCP/IP protocol stack.
  14. 14. The apparatus according to claim 12, wherein the first node and the second node are different devices or the first node and the second node belong to modules in different devices, the communication unit being specifically configured to: Invoking the application layer and the transmission layer of the first node to process the second data in turn, redirecting the processed second data to the network card of the first node, and sending the first data to the network card of the second node through the network card of the first node, or And receiving third data from the network card of the second node through the network card of the first node, and calling a transmission layer and an application layer of the first node to sequentially process the third data to obtain the first data.
  15. 15. A data transmission device comprising a processor and a memory, wherein: The memory is used for storing computer instructions; The processor configured to invoke the computer instructions to cause the apparatus to perform the method of any of claims 1-10.
  16. 16. A computer-readable storage medium comprising, the computer-readable storage medium has stored therein computer-executable instructions, the computer executable instructions, when invoked by the computer, to perform the method of any one of claims 1-10.
  17. 17. A computer program product comprising instructions which, when run on a computer, cause the method of any of claims 1-10 to be performed.
  18. 18. A chip, characterized in that the chip is coupled to a memory for reading and executing program instructions stored in the memory for implementing the method according to any of claims 1-10.

Description

Data transmission method, device, program product and medium Technical Field The present application relates to the field of computer technologies, and in particular, to a data transmission method, apparatus, program product, and medium. Background Among the many network communication protocols, the transmission control protocol/internet protocol (transmission control protocol/internet protocol, TCP/IP), also known as TCP/IP, has become one of the mainstream communication protocols due to its high accuracy and reliability. TCP/IP protocol communications require a TCP connection (or link) to be established through a three-way handshake, which results in a large resource overhead in establishing the TCP connection. In order to reduce the overhead required to establish a TCP connection, a user-mode connection pool technique is proposed. Under the user state connection pool technology, information of TCP connection used before each task can be cached in user state space of each task respectively. When a certain task needs to establish TCP connection, whether a proper TCP connection exists or not can be searched from a user state space corresponding to the task, and if the proper TCP connection exists, the TCP connection can be directly used. In this way, the situation of re-establishing a TCP connection is reduced. However, under the technology of the user state connection pool, a certain user state space needs to be allocated to each task, and the information of the TCP connection is cached by using the user state space, so that the resource cost in the storage process is high. In addition, when managing these TCP connections, it is necessary to manage the information of the TCP connections corresponding to the tasks based on the specific conditions of the tasks, respectively, and the complexity of TCP connection management is high. Disclosure of Invention The application provides a data transmission method, a data transmission device, a program product and a medium, which are used for reducing resource expenditure and complexity of managing TCP connection. In a first aspect, an embodiment of the present application provides a data transmission method. The method may be applied to the first device side. The first device side may refer to the first device itself, or a module in the first device. The first device, such as a computing device, e.g., a cell phone, personal computer, or server, may also be referred to as a computing device, or first computing device, etc. The modules in the first device may be software modules in the first device, such as logic modules or software that can implement all or part of the functionality. Or the module in the first device is, for example, a hardware module in the first device, such as a processor, a communication module, or a circuit or a chip responsible for a communication function, etc., a chip, such as a modem (modem) chip, also called a baseband (baseband) chip, or a system on chip (SoC) chip or a system in package (SYSTEMIN PACKAGE, SIP) chip containing a modem core, etc. For ease of description, the method is described below as being performed by the first device. The method comprises the steps of determining that a first connection matched with a first event exists based on a global connection pool pre-stored by an operating system of first equipment under the condition that the first event is detected, wherein the first connection is one of at least one connection, the first event is used for triggering establishment of the connection based on a TCP/IP protocol between a first node and a second node, the global connection pool pre-stores information of the at least one connection based on the TCP/IP protocol, the at least one connection is in a state of the established connection, the at least one connection comprises the first connection, and transmitting first data between the first node and the second node based on the first connection. The first device may be a receiving end or a transmitting end of the data. The first node is the first device or a module in the first device, such as a software module in the first device. The operating system of the first device may have a global connection pool pre-stored, e.g., the global connection pool may be pre-stored in a kernel mode of the operating system. The global connection pool may also be referred to as a connection pool, information pool, or other names, etc., and is not limited thereto. The global connection pool includes information of at least one connection in a state of an established connection. An established connection means that the at least one connection is in a live state and can be invoked directly. At least one connection may also be referred to as at least one TCP connection and, correspondingly, a first connection may also be referred to as a first TCP connection. In the embodiment of the application, the global connection pool is arranged in the operating system, and the first equipment can ca