Method and system for establishing TCP connection

By allocating sock memory in the physical memory units corresponding to each CPU core on the client and server, and storing the data packets in the sock memory of the NUMA node corresponding to the current process, the long time-consuming data packet acquisition during the TCP connection establishment process is solved. problem, improving the efficiency of TCP connections.

CN115914332BActive Publication Date: 2024-09-06UNIONTECH SOFTWARE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211387099.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-07
Publication Date
2024-09-06
Estimated Expiration
2042-11-07

AI Technical Summary

Technical Problem

In computing devices with non-uniform memory architecture, during the TCP connection establishment process, because the NUMA node corresponding to the sock memory is far away from the NUMA node to which the corresponding CPU core belongs, frequent access to the sock queue takes a long time and reduces the TCP connection. efficiency.

Method used

Allocate sock memory to each CPU core in the physical memory unit corresponding to each CPU core on the client and server, and store the encapsulated data packets in the sock memory of the NUMA node corresponding to the current process to shorten the distance for data packet acquisition. , thereby improving the efficiency of TCP connections.

Benefits of technology

By storing data packets into the sock memory of the NUMA node corresponding to the CPU core corresponding to the current process, the efficiency of data packet acquisition is significantly improved, thereby improving the efficiency of TCP connection establishment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914332B
    Figure CN115914332B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method and system for establishing a TCP connection. The method comprises: generating a first SYN data packet, generating a connection request message according to the first SYN data packet, and sending the message to a server; the server generates a second SYN data packet, generates a first ACK data packet according to the first SYN data packet, generates a first confirmation message according to the two data packets, and sends the message to a client; after verifying that the first ACK data packet is qualified, the client generates a second ACK data packet according to the second SYN data packet, generates a first confirmation message for the confirmation message according to the second ACK data packet, and sends the message to the server; the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method for establishing a TCP connection, a system for establishing a TCP connection, a computing device and a readable storage medium. Background Art

[0002] A TCP connection can be understood as a communication connection between a client and a server established according to the TCP protocol. Non-uniform memory access (NUMA) can be understood as dividing the memory into memory units equal to the number of CPU cores in a multi-CPU core computing device. Each memory unit can be understood as a NUMA node, and each CPU core is assigned the NUMA node closest to it.

[0003] At present, in computing devices with non-consistent memory architecture, when the kernel of its operating system allocates sock memory (packed data packets are stored in sock memory during TCP connection establishment) to each CPU core through an initialization function during the initialization process, it is not allocated on each NUMA node to which each CPU belongs, but all sock memory is allocated preferentially on the NUMA node to which the CPU core that executes the initialization function belongs. The kernel will put the packaged ACK packet in the waiting queue of the sock instance, so that in the process of establishing a TCP link between the client and the server, it is necessary to access the sock queue multiple times to read and send the ack data packet. However, since the NUMA node corresponding to the sock memory is far away from the NUMA node to which the corresponding CPU core belongs, the process of other CPU cores frequently accessing the sock queue is relatively time-consuming, that is, the process of obtaining the ack packet is relatively time-consuming, thereby making the process of establishing a TCP connection relatively time-consuming, reducing the efficiency of establishing a TCP connection.

[0004] Therefore, it is desired to provide a method for establishing a TCP connection to solve the existing technical problem of low efficiency in establishing a TCP connection between a client and a server. Summary of the invention

[0005] To this end, the embodiments of the present invention provide a method for establishing a TCP connection and a system for establishing a TCP connection, in an effort to solve or at least alleviate the above problems.

[0006] According to one aspect of an embodiment of the present invention, a method for establishing a TCP connection is provided, the method comprising: a client generates a first SYN data packet and stores it in a physical memory unit corresponding to a CPU core where a current process of the client is located; the client obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a connection request message according to the first SYN data packet, and sends it to a server; the server responds to the connection request message, generates a second SYN data packet, generates a first ACK data packet according to the first SYN data packet, and stores the first ACK data packet and the second SYN data packet in the physical memory unit corresponding to the CPU core where the current process of the server is located; the server obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and sends the first SYN data packet to the server; the server ... obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and sends the first SYN data packet to the server; the server obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and sends the first SYN data packet to the server; the server obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and sends the first SYN data packet to the server; the server obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and sends the first SYN data packet to the server; the server obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where its current process is located, and The first ACK data packet and the second SYN data packet are obtained from the physical memory unit corresponding to the PU core, and a first confirmation message is generated according to the first ACK data packet and the second SYN data packet, and sent to the client; the client responds to the first confirmation message, and after verifying that the first ACK data packet is qualified, a second ACK data packet is generated according to the second SYN data packet, and stored in the physical memory unit corresponding to the CPU core where the current process is located; the client obtains the second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a first confirmation message for the confirmation message according to the second ACK data packet, and sends it to the server; the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.

[0007] Optionally, the TCP connection establishment method provided by the present invention also includes: during the initialization process of the client or server, sock memory is allocated to each CPU core in the physical memory unit corresponding to each CPU core of the client or server, wherein the sock memory is used to store encapsulated data packets in the TCP connection process, and the data packets include ACK data packets.

[0008] Optionally, in the physical memory unit corresponding to each CPU core, sock memory is allocated to each CPU core, including: obtaining the identifier of the NUMA node corresponding to each CPU core; determining each corresponding NUMA node according to the identifier of the NUMA node corresponding to each CPU core; and allocating sock memory to each CPU core in the NUMA node corresponding to each CPU core.

[0009] Optionally, the data structure of the sock memory includes a queue; wherein, it is stored in the physical memory unit corresponding to the CPU core where the current process of the client is located, or stored in the physical memory unit corresponding to the CPU core where the current process of the server is located, including: storing in the physical memory unit corresponding to the CPU core where the current process of the client or server is located, and in the queue corresponding to the sock memory.

[0010] Optionally, the TCP connection establishment method provided by the present invention also includes: the client generates a third ACK data packet for closing the TCP connection, and stores it in a physical memory unit corresponding to the CPU core where the client's current process is located; the client obtains the third ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a first connection release message based on the third ACK data packet, and sends it to the server; the server responds to the first connection release message, generates a fourth ACK data packet, generates a fifth ACK data packet based on the third ACK data packet, and stores it in the physical memory unit corresponding to the CPU core where the server's current process is located; the server obtains the fourth ACK data packet and the fifth ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a second confirmation message based on the fourth ACK data packet and the fifth ACK data packet, and sends it to the client; the client responds to the second confirmation message, verifies whether the fifth ACK data packet is qualified, and closes the connection if qualified. A TCP connection from the client to the server; the server generates a sixth ACK data packet and stores it in the physical memory unit corresponding to the CPU core where its current process is located; the server obtains the sixth ACK data packet and the fifth ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a second connection release message and a fifth ACK data packet according to the sixth ACK data packet and the fifth ACK data packet, and sends them to the client; the client responds to the second connection release message, generates a seventh ACK data packet according to the sixth ACK data packet, and stores it in the physical memory unit corresponding to the CPU core where its current process is located; the client obtains the seventh ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a third confirmation message according to the fifth ACK data packet and the seventh ACK data packet, and sends it to the client; the server responds to the third confirmation message, verifies whether the seventh ACK data packet is qualified, and if qualified, closes the TCP connection from the server to the client.

[0011] Optionally, the confirmation message includes a confirmation connection character, and the client responds to the confirmation message. After verifying that the first ACK data packet is qualified, a second ACK data packet is generated according to the second SYN data packet, including: verifying whether the first ACK data packet is qualified, and if qualified, continuing to determine whether the confirmation connection character is a preset value, and if so, generating a second ACK data packet according to the second SYN data packet.

[0012] Optionally, the first confirmation message for the confirmation message includes a confirmation connection character, and the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified, including: checking whether the second ACK data packet is qualified, and if qualified, continuing to determine whether the confirmation connection field is a preset value; if it is a preset value, establishing a TCP connection with the client; if the second ACK data packet is unqualified, or if the second ACK data packet is qualified but the confirmation connection field is not a preset value, generating a verification failure message and sending it to the client.

[0013] Optionally, the TCP connection establishment method provided by the present invention also includes: the client responds to the verification failure message and determines the type of the verification failure message; if the type of the verification failure message is that the second ACK data packet fails, the client generates a new second ACK data packet based on the second SYN data packet, and stores it in the physical memory unit corresponding to the CPU core where the current process is located; the client obtains a new second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a second confirmation message for the confirmation message based on the new second ACK data packet, and resends it to the server until the verification is qualified; if the type of the verification failure message is that the second ACK data packet passes but the confirmation connection field is not a preset value, the client responds to the verification failure message and updates the value of the confirmation connection field to the preset value; the client obtains the second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a third confirmation message for the confirmation message based on the second ACK data packet and the updated confirmation connection field, and resends it to the server.

[0014] According to another aspect of an embodiment of the present invention, a method for establishing a TCP connection is provided, which is suitable for execution on a client, and the method includes: generating a first SYN data packet requesting to establish a TCP connection, and storing it in a physical memory unit corresponding to a CPU core where a current process of the client is located; obtaining the first SYN data packet from the physical memory unit corresponding to the CPU core where the current process is located, generating a connection request message according to the first SYN data packet, and sending it to a server; responding to a first confirmation message sent by the client, after verifying that the first ACK data packet is qualified, generating a second ACK data packet according to the second SYN data packet, and storing it in a physical memory unit corresponding to the CPU core where the current process is located, wherein The second SYN data packet is generated by the server in response to the connection request message, the first ACK data packet is generated by the server based on the first SYN data packet and stored in the physical memory unit corresponding to the CPU core where its current process is located, and the first confirmation message is generated by the server based on the first ACK data packet and the second SYN data packet obtained from the physical memory unit corresponding to the CPU core where its current process is located; the second ACK data packet is obtained from the physical memory unit corresponding to the CPU core where its current process is located, and a first confirmation message for the confirmation message is generated based on the second ACK data packet, and sent to the server, so that the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.

[0015] According to another aspect of an embodiment of the present invention, a method for establishing a TCP connection is provided, which is suitable for execution on a server, the method comprising: generating a second SYN data packet in response to a connection request message sent by a client, generating a first ACK data packet according to the first SYN data packet, and storing the first ACK data packet and the second SYN data packet in a physical memory unit corresponding to a CPU core where a current process of the server is located, wherein the connection request message is generated by the client according to obtaining the first SYN data packet from the physical memory unit corresponding to the CPU core where the current process of the server is located, and the first SYN data packet is generated by the client and stored in the physical memory unit corresponding to the CPU core where the current process of the server is located; The first ACK data packet and the second SYN data packet are obtained from the physical memory unit corresponding to the CPU core of the U, a first confirmation message is generated according to the first ACK data packet and the second SYN data packet, and the message is sent to the client; a confirmation message for the confirmation message is responded to, and a TCP connection with the client is established after the second ACK data packet is verified to be qualified, wherein the second ACK data packet is generated according to the second SYN data packet by the client in response to the first confirmation message after the first ACK data packet is verified to be qualified, and the message is stored in the physical memory unit corresponding to the CPU core where the current process is located, and the first confirmation message for the confirmation message is generated according to the second ACK data packet obtained by the client from the physical memory unit corresponding to the CPU core where the current process is located.

[0016] According to another aspect of an embodiment of the present invention, a system for establishing a TCP connection is provided, including a client and a server, wherein: the client is adapted to generate a first SYN packet requesting to establish a TCP connection, and store the packet in a physical memory unit corresponding to a CPU core where a current process of the client is located, obtain the first SYN packet from the physical memory unit corresponding to the CPU core where the current process of the client is located, generate a connection request message according to the first SYN packet, and send the message to the server; the server is adapted to respond to the connection request message, generate a second SYN packet, and generate a first ACK packet according to the first SYN packet, store the first ACK packet and the second SYN packet in the physical memory unit corresponding to the CPU core where the current process of the server is located, and obtain the first SYN packet from the physical memory unit corresponding to the CPU core where the current process of the server is located, and generate a connection request message according to the first SYN packet, and send the message to the server; the server is adapted to respond to the connection request message, generate a second SYN packet, and generate a first ACK packet according to the first SYN packet, store the first ACK packet and the second SYN packet in the physical memory unit corresponding to the CPU core where the current process of the server is located, and The first ACK data packet and the second SYN data packet are obtained from the physical memory unit corresponding to the CPU core where the current process is located, and a first confirmation message is generated according to the first ACK data packet and the second SYN data packet, and the first confirmation message is sent to the client; the client is also suitable for responding to the first confirmation message, and after verifying that the first ACK data packet is qualified, a second ACK data packet is generated according to the second SYN data packet, and the second ACK data packet is stored in the physical memory unit corresponding to the CPU core where the current process is located, and the second ACK data packet is obtained from the physical memory unit corresponding to the CPU core where the current process is located, and a first confirmation message for the confirmation message is generated according to the second ACK data packet, and the first confirmation message is sent to the server; the server is also suitable for establishing a TCP connection with the client after verifying that the second ACK data packet is qualified.

[0017] According to another aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for execution by the at least one processor, and the program instructions include instructions for executing the method as described above.

[0018] According to another aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the method described above.

[0019] According to the method for establishing a TCP connection of an embodiment of the present invention, the client generates a first SYN packet and stores it in the physical memory unit corresponding to the CPU core where the current process of the client is located. The client obtains the first SYN packet from it, generates a connection request message according to the first SYN packet, and sends it to the server. The server responds to the connection request message, generates a second SYN packet, and generates a first ACK packet according to the first SYN packet, stores the first ACK packet and the second SYN packet in the physical memory unit corresponding to the CPU core where the current process of the server is located, and obtains the first ACK packet and the second SYN packet from it, generates a first confirmation message according to the first ACK packet and the second SYN packet, and sends it to the client. The client responds to the first confirmation message, and after verifying that the first ACK packet is qualified, generates a second ACK packet according to the second SYN packet, and stores it in the physical memory unit corresponding to the CPU core where the current process is located. The client obtains the second ACK packet from it, generates a first confirmation message for the confirmation message according to the second ACK packet, and sends it to the server. The server establishes a TCP connection with the client after verifying that the second ACK packet is qualified.

[0020] It can be seen that during the TCP connection process, the encapsulated data packets are stored in the sock memory in the NUMA node corresponding to the CPU core corresponding to the current process. In this way, the distance for obtaining data packets can be shortened, thereby improving the efficiency of obtaining data packets and further improving the efficiency of TCP connection.

[0021] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation method of the embodiment of the present invention is specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.

[0023] Figure 1 A schematic diagram of a system 100 for establishing a TCP connection according to an embodiment of the present invention;

[0024] Figure 2A schematic diagram showing the relationship between a CPU core, a NUMA node, and a sock memory after sock memory is allocated according to an embodiment of the present invention;

[0025] Figure 3 A block diagram of a computing device 300 according to one embodiment of the present invention is shown;

[0026] Figure 4 A flowchart of a method 400 for establishing a TCP connection according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0028] In order to solve the existing technical problem of low efficiency in establishing TCP connection between client and server, the present invention first provides a system for establishing TCP connection. Figure 1 FIG. 1 is a schematic diagram of a system 100 for establishing a TCP connection according to an embodiment of the present invention. Figure 1 As shown, the system 100 includes a client 110 and a server 120. The client 110 may be multiple, namely, client 1101, client 1102, ..., client 110n. The client 110 is connected to the server 120 in communication, for example, through a wired or wireless network connection. Any client can establish a TCP connection with the server.

[0029] It should be noted that during the initialization process of each client and server, sock memory will be allocated to each CPU core in the physical memory unit (i.e., NUMA node) corresponding to each CPU core in the client and server. The sock memory can be understood as being used to store encapsulated data packets in the process of establishing a TCP connection. Data packets may include ACK data packets, SYN data packets, etc., which are not restricted here. All data packets generated in the process of establishing TCP connection are stored in the sock memory. The schematic diagram of the relationship between the CPU core, NUMA node, and sock memory after the sock memory is allocated in each client or server is as follows: Figure 2 shown.

[0030] Depend on Figure 2It can be seen that by allocating sock memory to each CPU core in the manner of the present invention, the sock memory allocated to each CPU core can be in the corresponding NUMA node, instead of allocating the sock memory of each CPU core on the NUMA node corresponding to the CPU core where the function executing the client or server initialization is located.

[0031] In some embodiments, the data structure of the sock memory may include a queue, that is, the data packets generated during the TCP understanding process are stored in the sock queue of the NUMA node corresponding to the CPU core where the current process is located. Of course, other types of data structures may also be included according to the actual application scenario, and the present invention is not limited to this. The sock queue may also be set according to the actual application scenario, and the present invention is not limited to this. For example, the sock queue may be sk_write_queue.

[0032] In some implementations, in the physical memory unit corresponding to each CPU core, sock memory is allocated to each CPU core, including: first obtaining the identifier of the NUMA node corresponding to each CPU core, then determining the corresponding NUMA node according to the identifier of the NUMA node corresponding to each CPU core, and finally allocating sock memory to each CPU core in the NUMA node corresponding to each CPU core. The following is a key code example for allocating sock memory to each CPU core in the physical memory unit corresponding to each CPU core:

[0033] inet_ctl_sock_create_node(struct sock**sk,unsigned short family,

[0034] unsigned short type,unsigned char protocol,

[0035] struct net*net,int node)

[0036] sock_create_kern_node(struct net*net,int family,int type,intprotocol,struct socket**res,int node)

[0037] __sock_create_node(struct net*net,int family,int type,int protocol,

[0038] struct socket**res,int kern,int node)

[0039] sock_alloc_node(int node)

[0040] new_inode_pseudo_node(struct super_block*sb,int node)

[0041] alloc_inode_node(struct super_block*sb,int node)

[0042] sock_alloc_inode_node(struct super_block*sb,int node)

[0043] The above-mentioned client 110 and server 120 can both be implemented as a computing device 300, and the computing device 300 can be further implemented as a server, such as an application server, a Web server, etc.; it can also be implemented as a desktop computer, a laptop computer, a processor chip, a tablet computer, etc., but is not limited to this. Figure 3 300. In a basic configuration, computing device 300 includes at least one processing unit 302 and system memory 304. According to one aspect, system memory 304 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories, depending on the configuration and type of computing device.

[0044] According to one aspect, system memory 304 includes operating system 305. System memory 104 also includes application programs 350. According to one aspect, operating system 305, for example, is suitable for controlling the operation of computing device 330. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other application programs, and are not limited to any particular application or system. Figure 3 This basic configuration is illustrated in FIG. 3 by those components within dashed line 308. According to one aspect, computing device 300 has additional features or functionality. For example, according to one aspect, computing device 300 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes. Such additional storage Figure 3 3 is illustrated by a removable storage device 309 and a non-removable storage device 310.

[0045] As stated above, according to one aspect, a plurality of program modules are stored in the system memory 304. When the keyboard indicator light control method provided by the present invention is implemented as an application 350 and executed on the processing unit 302, the application 350 executes a process, which includes but is not limited to Figure 4 According to one aspect, the type of application is not limited, for example, the application also includes: email and contact applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided applications, web browser applications, etc.

[0046] According to one aspect, the examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 3 Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such a SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") into a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via a dedicated logic integrated with other components of the computing device 300 on a single integrated circuit (chip). Other technologies that can perform logical operations (such as AND, OR, and NOT) can also be used to practice embodiments of the present invention, including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.

[0047] According to one aspect, computing device 300 may also have one or more input devices 312, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output devices 314 may also be included, such as a display, a speaker, a printer, etc. The aforementioned devices are examples and other devices may also be used. Computing device 300 may include one or more communication connections 316 that allow communication with other computing devices 318. Examples of suitable communication connections 316 include, but are not limited to: RF transmitter, receiver and / or transceiver circuits; Universal Serial Bus (USB), parallel and / or serial ports.

[0048] The term computer-readable medium as used herein includes computer storage media. Computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules). System memory 304, removable storage device 309, and non-removable storage device 310 are all examples of computer storage media (i.e., memory storage). Computer storage media may include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices, or any other products that can be used to store information and can be accessed by computer device 300. According to one aspect, any such computer storage medium can be a part of computing device 300. Computer storage media does not include carrier waves or other propagated data signals.

[0049] According to one aspect, communication media is implemented by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in a manner that encodes information in the signal. By way of example and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0050] Figure 4 A flow chart of a method 400 for establishing a TCP connection according to an embodiment of the present invention is shown. The method 400 is suitable for being executed in a TCP connection establishment system 100, and the method 400 may include steps 410 to 470. Through the method 400, when a client and a server establish a TCP connection, since the sock memory allocated to each CPU core is in the corresponding NUMA node, the efficiency of obtaining encapsulated data packets from the sock memory can be improved, thereby improving the efficiency of establishing a TCP connection between the client and the server.

[0051] Before describing method 400, it is worth noting that in the present invention, a three-way handshake connection is required to establish a TCP connection. The first is a first handshake connection from the client to the server, and the process of the first handshake connection includes steps 410 to 420. After the first handshake connection, a second handshake connection is made from the server to the client, and the process of the second handshake connection includes steps 430 to 440. After the second handshake connection, a third handshake connection is made from the client to the server, and the process of the third handshake connection includes steps 450 to 460.

[0052] The client executes step 410 to generate a first SYN packet and stores it in a physical memory unit corresponding to the CPU core where the client's current process is located. Specifically, the client generates a first SYN packet requesting to establish a TCP connection and stores it in a queue corresponding to the sock memory of the NUMA node corresponding to the CPU core where the client's current process is located.

[0053] Afterwards, the client executes step 420, obtains the first SYN packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a connection request message according to the first SYN packet, and sends it to the server. Specifically, the first SYN packet is obtained from the queue corresponding to the sock memory of the NUMA node corresponding to the CPU core where the current process is located, generates a connection request message according to the first SYN packet, and sends it to the server.

[0054] The connection request message includes the first SYN data packet and the connection request character SYN. ​​If the connection is requested, SYN=1, and if the connection is not requested, SYN=0. Since the client requests to establish a connection with the server at this time, the character SYN in the connection request message is 1. The first SYN data packet is a random number generated by the client. For example, the first SYN data packet can be SYN=j, and j can be any random number, for example, j is 123456.

[0055] At this point, the client has sent a connection request message to the server, and the client is waiting for the server to confirm whether a TCP connection can be established.

[0056] After the first handshake connection, the second handshake connection is performed:

[0057] After receiving the connection request message sent by the client, the server responds to the connection request message, allocates cache and variables for the TCP connection, and executes step 430 to generate a second SYN data packet, and generates a first ACK data packet based on the first SYN data packet, and stores the first ACK data packet and the second SYN data packet in the queue corresponding to the CPU core where the current process is located and the sock memory of the NUMA node.

[0058] In some implementations, generating the first ACK data packet according to the first SYN data packet includes: using the random number corresponding to the first SYN data packet plus 1 as the first ACK data packet. Of course, the present invention is not limited to this.

[0059] The second SYN packet is a random number generated by the server, but different SYN packets correspond to different random numbers. For example, the second SYN packet can be SYN=k, where k can be any random number, such as 223456. Taking the first SYN as j as an example, since the random number corresponding to the first SYN packet plus 1 is the first ACK packet, the first ACK packet is j+1.

[0060] Afterwards, the server executes step 440, obtains the first ACK packet and the second SYN packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a first confirmation message based on the first ACK packet and the second SYN packet, and sends it to the client. Specifically, the server obtains the first ACK packet and the second SYN packet from the queue corresponding to the sock memory of the NUMA node corresponding to the CPU core where the current process is located, generates a first confirmation message based on the first ACK packet and the second SYN packet, and sends it to the client.

[0061] The first confirmation message includes a first ACK data packet, a second SYN data packet, a connection request character SYN and a confirmation connection character ACK. The connection request character SYN here is the same as the above, and will not be repeated here. Since the server replies to the client to confirm the establishment of the connection at this time, the connection request character SYN in the first confirmation message is 1. The character ACK represents the confirmation connection character. If the server confirms to establish a connection with the client, ACK=1, and if the server confirms not to establish a connection with the client, ACK=0. Taking the server confirming the establishment of a TCP connection with the client as an example, ACK=1 in the first confirmation message. Then, the first confirmation message at this time includes the first ACK data packet (j+1), the second SYN data packet (k), the connection request character SYN=1 and the confirmation connection character ACK=1. Of course, the values ​​of SYN and ACK may not be 1 or 0, and can be set according to the actual application scenario. The present invention is not limited to this. The above-mentioned values ​​of SYN and ACK are 1 or 0 for only an example.

[0062] At this point, the second handshake connection on the server is completed, that is, the server sends a message to the client to confirm the establishment of the connection. Then the third handshake connection is performed:

[0063] The client responds to the first confirmation message sent by the server, allocates a buffer and a variable for the TCP connection, and executes step 450. After verifying that the first ACK packet is qualified, a second ACK packet is generated according to the second SYN packet, and stored in the physical memory unit corresponding to the CPU core where the current process is located, that is, stored in the queue corresponding to the sock memory of the NUMA node corresponding to the CPU core where the current process is located. Continue to execute step 460, obtain the second ACK packet from the physical memory unit corresponding to the CPU core where the current process is located, generate a first confirmation message for the confirmation message according to the second ACK packet, the first confirmation message for the confirmation message includes the second ACK packet, ACK=1, and send the first confirmation message for the confirmation message to the server.

[0064] In some implementations, steps 450 to 460 include:

[0065] The client responds to the first confirmation message sent by the server, allocates buffer and variables for the TCP connection, and then determines whether the first ACK packet is the random number in the first SYN packet + 1. If so, it means the verification is qualified, otherwise, it means the verification is unqualified.

[0066] After verifying that the first ACK data packet is qualified, continue to determine whether the value of the confirmation connection character ACK is a preset value. If so, it means that the server agrees to establish a TCP connection with the client, and then generate a second ACK data packet based on the second SYN data packet. The second ACK data packet is the random number of the second SYN data packet + 1, and is stored in the physical memory unit corresponding to the CPU core where the current process is located. The client obtains the second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, and generates a first confirmation message for the confirmation message based on the second ACK data packet, and sends it to the server. The first confirmation message for the confirmation message includes: the second ACK data packet, ACK=1.

[0067] If the first ACK packet fails to pass the check, or passes the check but the ACK value is not 1, it means that the server does not agree to establish a connection with the client. In this case, the client can stop sending connection request messages to the server, or continue to send connection request messages to the server.

[0068] The following takes the first SYN data packet as j, the first ACK data packet as j+1, the second SYN data packet as K, SYN=1, ACK=1 as an example to illustrate steps 450 to 460, that is, to illustrate the third handshake connection process:

[0069] The client responds to the first confirmation message sent by the server, allocates buffer and variables for the TCP connection, and then determines whether the first ACK packet is the random number in the first SYN packet + 1, that is, determines whether the first ACK packet is j+1. If so, it means the verification is qualified, otherwise, it means the verification is unqualified.

[0070] After verifying that the first ACK packet is qualified, continue to determine whether the value of the confirmation connection character ACK is 1. If it is 1, it means that the server agrees to establish a TCP connection with the client, and the random number + 1 of the second SYN packet is used as the second ACK packet. Then the second ACK packet is K+1, which is in the physical memory unit corresponding to the CPU core where the current process is located and in the queue corresponding to the sock memory. After that, the client obtains the second ACK packet from the physical memory unit corresponding to the CPU core where its current process is located and the queue corresponding to the sock memory, and generates the first confirmation message for the confirmation message according to the second ACK packet. The first confirmation message for the confirmation message includes the second ACK packet (K+1), ACK=1, and is sent to the server.

[0071] If the first ACK data packet is not j+1, that is, it is determined that the verification of the first ACK data packet is unqualified, or it is determined that the verification is qualified but ACK=1 is not 1, it means that the server does not agree to establish a connection with the client. Then the client can suspend sending connection request messages to the server, or continue to execute step 410 to send connection request messages to the server again.

[0072] After the third handshake connection, the server responds to the first confirmation message sent by the client, executes step 470, and establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.

[0073] In some implementations, step 470 includes: checking whether the second ACK data packet is qualified, and if qualified, continuing to determine whether the confirmation connection field is a preset value. If it is a preset value, establishing a TCP connection with the client.

[0074] If the second ACK data packet fails to pass, or if the second ACK data packet passes but the confirmation connection field is not the preset value, a verification failure message is generated and sent to the client. The client responds to the verification failure message and determines the type of the verification failure message. If the type of the verification failure message is that the second ACK data packet fails to pass, the client generates a new second ACK data packet based on the second SYN data packet and stores it in the physical memory unit corresponding to the CPU core where the current process is located. The client obtains a new second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a second confirmation message for the confirmation message based on the new second ACK data packet and the confirmation connection character ACK=1, and the second confirmation message for the confirmation message includes the new second ACK data packet and the confirmation connection character ACK=1, and sends the second confirmation message for the confirmation message to the server until the verification passes.

[0075] If the type of the verification failure message is that the second ACK data packet is qualified but the confirmation connection field is not the preset value, the client responds to the verification failure message and updates the value of the confirmation connection field to the preset value. The client obtains the second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, and generates a third confirmation message for the confirmation message based on the second ACK data packet and the updated confirmation connection character ACK=1. At this time, the third confirmation message for the confirmation message includes the second ACK data packet and the updated confirmation connection character ACK (ACK=1), and sends the third confirmation message for the confirmation message to the server, so that the server re-checks the confirmation message for the confirmation message.

[0076] At this point, it is achieved that a TCP connection is established between any client and server by obtaining the encapsulated data packet from the NUMA node corresponding to the CPU core where the current process is located. Whenever the client requests to establish a TCP connection with the server, steps 410 to 470 need to be executed.

[0077] In some implementations, after establishing a TCP connection, the TCP connection can also be released, and the release end can be a server end or a client end. The following takes the client end as the initiator of releasing the connection, and releasing the TCP connection includes four handshake connections, and the working process of releasing the TCP connection is described:

[0078] First, the first handshake connection: the client generates the third ACK packet for closing the TCP connection, and stores it in the queue corresponding to the NUMA node and sock memory corresponding to the CPU core where the client's current process is located. The client obtains the third ACK packet from the NUMA node and sock memory corresponding to the CPU core where its current process is located, and generates the first connection release message according to the third ACK packet. The first connection release message includes the third ACK packet and the connection closing character FIN, and sends it to the server.

[0079] Among them, the third ACK data packet is a random number generated by the client, for example, the third ACK data packet can be ACK=u, and u can be any random number, for example, u is 451456. It is worth noting that, whether it is the client or the server, the random number generated randomly each time is different, that is, in the process of establishing a TCP connection or in the process of releasing a connection, the generated data packets are different, and the data packets may include SYN data packets, ACK data packets, etc. Close connection character FIN, if the connection is requested to be closed, FIN=1, otherwise FIN=0, because the client requests to close the TCP connection with the server at this time, the close connection character FIN=1 in the first connection release message, that is, the first connection release message includes the third ACK data packet (ACK=u) and the close connection character FIN=1.

[0080] Then comes the second wave connection: the server responds to the first connection release message sent by the client, generates the fourth ACK data packet, takes the random number + 1 corresponding to the third ACK data packet as the fifth ACK data packet, stores it in the queue corresponding to the NUMA node corresponding to the CPU core where the current process is located and the sock memory, and obtains the fourth ACK data packet and the fifth ACK data packet from it, generates the second confirmation message according to the fourth ACK data packet and the fifth ACK data packet, and sends it to the client. Among them, the second confirmation message includes the fourth ACK data packet (ack=v), the fifth ACK data packet (ack=u+1), and the confirmation connection character ACK=1.

[0081] Similarly, the fourth ACK data packet is a random number generated by the client, for example, the fourth ACK data packet can be ACK=v, then the second confirmation message includes the fourth ACK data packet (ACK=v), the fifth ACK data packet (ACK=u+1), and the confirmation connection character ACK=1. v can be any random number, for example, v is 561456.

[0082] The client responds to the second confirmation message and determines whether the fifth ACK data packet is the random number corresponding to the third ACK data packet + 1. If so, the fifth ACK data packet is checked to be qualified, and the TCP connection from the client to the server is closed. At this time, the TCP connection enters a semi-closed state.

[0083] The third wave connection: The server generates the sixth ACK packet (ack=w), stores it in the queue corresponding to the NUMA node corresponding to the CPU core where the current process is located and the sock memory, and obtains the sixth ACK packet and the fifth ACK packet from it, generates the second connection release message according to the sixth ACK packet and the fifth ACK packet, and sends it to the client. The second connection release message includes the sixth ACK packet, the fifth ACK packet (ACK=u+1), the confirmation connection character ACK=1, and the closing connection character FIN=1.

[0084] Similarly, the sixth ACK data packet is a random number generated by the client, for example, the sixth ACK data packet can be ACK=w, then the second connection release message includes the sixth ACK data packet (ACK=w), the fifth ACK data packet (ACK=u+1), the confirmation connection character ACK=1 and the closing connection character FIN=1. w can be any random number, for example, w is 891456.

[0085] Fourth wave connection: The client responds to the second connection release message sent by the server, generates a seventh ACK packet based on the sixth ACK packet, and further uses the random number + 1 corresponding to the sixth ACK packet as the seventh ACK packet, which is stored in the queue corresponding to the NUMA node corresponding to the CPU core where the current process is located and the sock memory, obtains the seventh ACK packet in the client, generates a third confirmation message based on the fifth ACK packet and the seventh ACK packet, and sends it to the client. The third confirmation message includes the fifth ACK packet (ACK=u+1), the seventh ACK packet (ACK=w+1), and the confirmation connection character ACK=1.

[0086] Afterwards, the server responds to the third confirmation message sent by the client, verifies whether the seventh ACK data packet is qualified, and further determines whether the seventh ACK data packet is the random number corresponding to the sixth ACK data packet + 1. If so, it means that the seventh ACK data packet is qualified, otherwise it means that the seventh ACK data packet is not qualified. If qualified, the TCP connection from the server to the client is closed, and the TCP connection established between the client and the server is completely disconnected.

[0087] If it fails, the TCP connection from the server to the client will not be disconnected, and the current TCP connection will enter a semi-closed state. If you want to completely disconnect the TCP connection, the server needs to re-execute the third handshake connection process.

[0088] It is worth noting that the contents of the above-mentioned first confirmation message, the second confirmation message, the third confirmation message, the first confirmation message for the confirmation message, the second confirmation message for the confirmation message, the third confirmation message for the confirmation message, the first connection release message, the second connection release message and the third connection release message are all different. The contents of the first ACK data packet, the second ACK data packet, the third ACK data packet, the fourth ACK data packet, the fifth ACK data packet, the sixth ACK data packet and the seventh ACK data packet are all different, and the contents of the first SYN data packet and the second SYN data packet are also different.

[0089] From the above content, it can be seen that a method for establishing a TCP connection provided by the present invention, during the initialization process of the client and the server, will allocate sock memory to each CPU core in the NUMA node corresponding to each CPU core in the client and the server, so that during the TCP connection process, the encapsulated data packet is stored in the sock memory in the NUMA node corresponding to the CPU core corresponding to the current process. In this way, the distance for obtaining the data packet can be shortened, thereby improving the efficiency of obtaining the data packet, and then improving the efficiency of the TCP connection.

[0090] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.

[0091] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the method for establishing a TCP connection of the present invention according to the instructions in the program code stored in the memory.

[0092] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.

[0093] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to implement the content of the present invention described herein, and the above description of specific languages ​​is for the purpose of disclosing the best mode of the present invention.

[0094] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0095] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.

[0096] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.

[0097] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0098] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.

[0099] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0100] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.

[0101] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.

Claims

1. A method for establishing a TCP connection, the method comprising: The client generates a first SYN packet and stores it in the physical memory unit corresponding to the CPU core where the client's current process is located; The client obtains the first SYN data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a connection request message according to the first SYN data packet, and sends it to the server; The server generates a second SYN packet in response to the connection request message, generates a first ACK packet according to the first SYN packet, and stores the first ACK packet and the second SYN packet in a physical memory unit corresponding to the CPU core where the current process of the server is located; The server obtains the first ACK data packet and the second SYN data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a first confirmation message according to the first ACK data packet and the second SYN data packet, and sends the first confirmation message to the client; The client responds to the first confirmation message, and after verifying that the first ACK data packet is qualified, generates a second ACK data packet according to the second SYN data packet, and stores it in the physical memory unit corresponding to the CPU core where the current process is located; The client obtains the second ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a first confirmation message for the confirmation message according to the second ACK data packet, and sends the first confirmation message to the server; The server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.

2. The method of claim 1, further comprising: During the initialization process of the client or the server, a sock memory is allocated to each CPU core in the physical memory unit corresponding to each CPU core of the client or the server, wherein the sock memory is used to store data packets in the encapsulated TCP connection process, and the data packets include ACK data packets.

3. The method of claim 2, wherein: In the physical memory unit corresponding to each CPU core, sock memory is allocated to each CPU core, including: Get the ID of the NUMA node corresponding to each CPU core; Determine the corresponding NUMA nodes according to the identifiers of the NUMA nodes corresponding to the CPU cores; In the NUMA node corresponding to each CPU core, sock memory is allocated to each CPU core.

4. The method according to claim 2 or 3, wherein: The data structure of the sock memory includes a queue; The storage in the physical memory unit corresponding to the CPU core where the current process of the client is located, or the storage in the physical memory unit corresponding to the CPU core where the current process of the server is located, includes: Stored in the physical memory unit corresponding to the CPU core where the current process of the client or server is located, and in the queue corresponding to the sock memory.

5. The method according to claim 4, further comprising: The client generates a third ACK data packet for closing the TCP connection, and stores the data packet in a physical memory unit corresponding to the CPU core where the current process of the client is located; The client obtains the third ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a first connection release message according to the third ACK data packet, and sends the first connection release message to the server; The server generates a fourth ACK data packet in response to the first connection release message, generates a fifth ACK data packet according to the third ACK data packet, and stores the fifth ACK data packet in a physical memory unit corresponding to the CPU core where the current process of the server is located; The server obtains the fourth ACK data packet and the fifth ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a second confirmation message according to the fourth ACK data packet and the fifth ACK data packet, and sends it to the client; The client responds to the second confirmation message, verifies whether the fifth ACK data packet is qualified, and if qualified, closes the TCP connection from the client to the server; The server generates a sixth ACK data packet and stores it in the physical memory unit corresponding to the CPU core where the current process is located; The server obtains the sixth ACK data packet and the fifth ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a second connection release message and a fifth ACK data packet according to the sixth ACK data packet and the fifth ACK data packet, and sends them to the client; The client responds to the second connection release message, generates a seventh ACK data packet according to the sixth ACK data packet, and stores the seventh ACK data packet in a physical memory unit corresponding to the CPU core where the current process is located; The client obtains the seventh ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a third confirmation message according to the fifth ACK data packet and the seventh ACK data packet, and sends the third confirmation message to the client; The server responds to the third confirmation message and checks whether the seventh ACK data packet is qualified. If qualified, the TCP connection from the server to the client is closed.

6. The method of claim 5, wherein: The confirmation message includes a confirmation connection character, and the client responds to the confirmation message, and after verifying that the first ACK data packet is qualified, generates a second ACK data packet according to the second SYN data packet, including: Check whether the first ACK data packet is qualified. If qualified, continue to determine whether the confirmation connection character is a preset value. If so, generate a second ACK data packet according to the second SYN data packet.

7. The method of claim 6, wherein: The first confirmation message for the confirmation message includes the confirmation connection character, and the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified, including: Check whether the second ACK data packet is qualified, and if qualified, continue to determine whether the confirmation connection field is a preset value; If it is a preset value, a TCP connection with the client is established; If the second ACK data packet fails to pass, or if the second ACK data packet passes but the confirmation connection field is not a preset value, a verification failure message is generated and sent to the client.

8. The method of claim 7, further comprising: The client responds to the verification failure message and determines the type of the verification failure message; If the type of the verification unqualified message is that the second ACK data packet is unqualified, the client generates a new second ACK data packet according to the second SYN data packet, and stores it in the physical memory unit corresponding to the CPU core where the current process is located; The client obtains a new second ACK data packet from the physical memory unit corresponding to the CPU core where the current process is located, generates a second confirmation message for the confirmation message according to the new second ACK data packet, and resends it to the server until the verification is qualified; If the type of the verification failure message is that the second ACK data packet is qualified but the confirmation connection field is not a preset value, the client responds to the verification failure message and updates the value of the confirmation connection field to the preset value; The client obtains a second ACK data packet from the physical memory unit corresponding to the CPU core where its current process is located, generates a third confirmation message for the confirmation message according to the second ACK data packet and the updated confirmation connection field, and resends it to the server.

9. A method for establishing a TCP connection, suitable for execution on a client, the method comprising: Generate the first SYN packet requesting to establish a TCP connection, and store it in the physical memory unit corresponding to the CPU core where the current process of the client is located; Obtain the first SYN data packet from the physical memory unit corresponding to the CPU core where the current process is located, generate a connection request message according to the first SYN data packet, and send the message to the server; In response to the first confirmation message sent by the client, after verifying that the first ACK data packet is qualified, a second ACK data packet is generated according to the second SYN data packet, and stored in the physical memory unit corresponding to the CPU core where the current process is located, wherein the second SYN data packet is generated by the server in response to the connection request message, the first ACK data packet is generated by the server according to the first SYN data packet, and stored in the physical memory unit corresponding to the CPU core where the current process is located, and the first confirmation message is generated by the server according to the first ACK data packet and the second SYN data packet obtained from the physical memory unit corresponding to the CPU core where the current process is located; The second ACK data packet is obtained from the physical memory unit corresponding to the CPU core where the current process is located, and a first confirmation message for the confirmation message is generated based on the second ACK data packet, and sent to the server, so that the server establishes a TCP connection with the client after verifying that the second ACK data packet is qualified.

10. A method for establishing a TCP connection, suitable for execution at a server, the method comprising: In response to the connection request message sent by the client, a second SYN packet is generated, and a first ACK packet is generated according to the first SYN packet, and the first ACK packet and the second SYN packet are stored in the physical memory unit corresponding to the CPU core where the current process of the server is located, wherein the connection request message is generated by the client according to obtaining the first SYN packet from the physical memory unit corresponding to the CPU core where the current process of the server is located, and the first SYN packet is generated by the client and stored in the physical memory unit corresponding to the CPU core where the current process of the server is located; Acquire the first ACK data packet and the second SYN data packet from the physical memory unit corresponding to the CPU core where the current process is located, generate a first confirmation message according to the first ACK data packet and the second SYN data packet, and send the first confirmation message to the client; In response to the first confirmation message for the confirmation message, a TCP connection with the client is established after verifying that the second ACK data packet is qualified, wherein the second ACK data packet is the client's response to the first confirmation message, and is generated based on the second SYN data packet after verifying that the first ACK data packet is qualified, and is stored in the physical memory unit corresponding to the CPU core where the current process is located, and the first confirmation message for the confirmation message is generated based on the second ACK data packet obtained by the client from the physical memory unit corresponding to the CPU core where its current process is located.

11. A system for establishing a TCP connection, comprising a client and a server, wherein: The client is adapted to generate a first SYN packet requesting to establish a TCP connection, and store the packet in a physical memory unit corresponding to a CPU core where a current process of the client is located, obtain the first SYN packet from the physical memory unit corresponding to the CPU core where the current process of the client is located, generate a connection request message according to the first SYN packet, and send the message to the server; The server is adapted to respond to the connection request message, generate a second SYN packet, and generate a first ACK packet according to the first SYN packet, store the first ACK packet and the second SYN packet in a physical memory unit corresponding to a CPU core where the current process of the server is located, obtain the first ACK packet and the second SYN packet from the physical memory unit corresponding to the CPU core where the current process is located, generate a first confirmation packet according to the first ACK packet and the second SYN packet, and send the first confirmation packet to the client; The client is further adapted to respond to the first confirmation message, generate a second ACK packet according to the second SYN packet after verifying that the first ACK packet is qualified, store the second ACK packet in the physical memory unit corresponding to the CPU core where the current process is located, obtain the second ACK packet from the physical memory unit corresponding to the CPU core where the current process is located, generate a first confirmation packet for the confirmation packet according to the second ACK packet, and send the second ACK packet to the server; The server is further adapted to establish a TCP connection with the client after verifying that the second ACK data packet is qualified.

12. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 10.

13. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, the computing device executes the method according to any one of claims 1 to 10.