Data transmission method and device
By dynamically switching the network port of the network card queue, when data transmission times out, data continues to be transmitted from the available network port, which solves the problem of data transmission interruption caused by network equipment failure in the data center, and improves fault recovery efficiency and system stability.
Patent Information
- Application Number
- CN202110167457.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-02-05
AI Technical Summary
In data centers, network equipment failures cause data transmission connections to be disconnected and reconnected, resulting in data transmission being unavailable. It is difficult to effectively solve this problem with existing technology.
By receiving the transmission request, the network card queue is determined and data is transmitted from the first network port. If no response is received within the preset time period, the system dynamically switches to the second network port for transmission to avoid fault paths and achieve fault recovery of data transmission.
It improves the fault recovery efficiency of data transmission, avoids data transmission interruptions caused by fault paths, and ensures the reliability and stability of data transmission.
Smart Images

Figure CN113300978B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of data processing technology, and more particularly to a data transmission method and device. Background Art
[0002] Remote Direct Memory Access (RDMA) is a technology for directly accessing remote memory. It transfers data to the storage area of the device through the network, and directly migrates data from one system to another remote system memory without causing any impact on the operating system. It reduces the consumption of the central processing unit in the data transmission process, frees up memory bandwidth and central processing unit (CPU) cycles, and thus improves the system's performance in processing business. It has the characteristics of high bandwidth, low latency and low CPU occupancy.
[0003] At present, data centers fully use ordinary commercial servers and network equipment, and the scale of a single data center is very large. The increase in the scale of data centers is accompanied by more network equipment failures (life expiration, hardware bugs, sudden power outages, regular failure probability, natural disasters, etc.). For disaster recovery and redundancy, two or more network interfaces (network ports) are usually configured for each server, and each network port is connected to a switch. In the event of a switch failure, the communicating parties need to re-establish the network connection. However, the re-established network connection will randomly select the network port and may pass through the network equipment that has failed in the original transmission path, resulting in the unavailability of the newly established network connection, resulting in continuous disconnection and reconnection. Therefore, it is urgent to provide a data transmission method that can solve the above problems. Summary of the invention
[0004] In view of this, an embodiment of this specification provides a data transmission method. One or more embodiments of this specification also relate to a data transmission device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0005] A first aspect of the embodiments of this specification provides a data transmission method, including:
[0006] receiving a transmission request for target data;
[0007] Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0008] When no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is modified to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue.
[0009] A second aspect of the embodiments of this specification provides a data transmission device, including:
[0010] A receiving module, configured to receive a transmission request for target data;
[0011] A transmission module, configured to determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0012] The modification module is configured to modify the network port corresponding to the network card queue to a second network port and transmit the target data from the second network port corresponding to the network card queue if no reception response for the target data is received through the network card queue within a preset time.
[0013] According to a third aspect of the embodiments of this specification, a computing device is provided, including:
[0014] Memory and processor;
[0015] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions:
[0016] receiving a transmission request for target data;
[0017] Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0018] When no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is modified to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue.
[0019] In a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the data transmission method are implemented.
[0020] The present specification provides a data transmission method, including: receiving a transmission request for target data; determining a corresponding network card queue based on the transmission request, and transmitting the target data from a first network port corresponding to the network card queue; if no reception response for the target data is received through the network card queue within a preset time, modifying the network port corresponding to the network card queue to a second network port, and transmitting the target data from the second network port corresponding to the network card queue, so that when the target data transmission times out, the network port corresponding to the network card queue (i.e., the network port where a transmission failure occurs) is dynamically switched to an available network port, and the target data can be transmitted from the available network port through the network card queue, thereby avoiding data transmission from the fault path corresponding to the first network port, and there is no need to create a new network card queue, thereby improving fault recovery efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a processing flow chart of a data transmission method provided by an embodiment of this specification;
[0022] Figure 2 is a schematic diagram of a data transmission method provided by an embodiment of this specification;
[0023] Figure 3 It is a processing flow chart of a data transmission method applied to an RDMA network transmission scenario provided by an embodiment of this specification;
[0024] Figure 4 is a schematic diagram of a data transmission device provided by an embodiment of this specification;
[0025] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0026] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0027] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0028] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0029] First, the terms involved in one or more embodiments of this specification are explained.
[0030] RDMA (Remote Direct Memory Access): It was created to solve the delay of server-side data processing in network transmission. RDMA transmits data directly to the computer's storage area through the network, quickly moving data from one system to the remote system memory without any impact on the operating system, so that little computer processing function is not required. It eliminates the overhead of external memory copying and context switching, thereby freeing up memory bandwidth and CPU cycles to improve application system performance.
[0031] ASW (Access Switch): Server online switch.
[0032] PSW (Pod Switch): Data center delivery unit upstream switch.
[0033] MMU (Memory Management Unit): Sometimes called paged memory management unit (PMMU). It is a computer hardware responsible for processing memory access requests from the central processing unit (CPU). Its functions include virtual address to physical address conversion (i.e. virtual memory management), memory protection, CPU cache control, and in simpler computer architectures, bus arbitration and memory bank switching.
[0034] In this specification, a data transmission method is provided. One or more embodiments of this specification also involve a data transmission device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0035] An embodiment of a data transmission method provided in this specification is as follows:
[0036] Figure 1A processing flow chart of a data transmission method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:
[0037] Step 102: Receive a transmission request for target data.
[0038] Among them, the target data can be understood as the data to be transmitted; the transmission request includes a data read request or a data write request; specifically, the data read request can be understood as a request to read data in the receiving end; the data write request can be understood as a request to write data to the receiving end.
[0039] In practical applications, the transmission request may carry data information of the target data. Specifically, the data information includes: the storage address of the target data, and / or the data identifier of the target data, etc. Then, the target data to be transmitted can be determined based on this data information.
[0040] Step 104: determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue.
[0041] Among them, the network card queue can be a transmission queue that supports the RDMA protocol (which can also be understood as an RDMA network connection). During specific implementation, the sending end schedules the network card queue to transmit data between the sending end and the receiving end. Furthermore, the network card queue includes queue pairs (Queue Pairs, QP) composed of a sending queue (Send Queue, SQ) and a receiving queue (Receive Queue, RQ).
[0042] Furthermore, the network card queue and the network port have a corresponding relationship. When data is transmitted between the sending end and the receiving end, the target data contained in or pointed to by the network card queue will be transmitted from the network port corresponding to the network card queue, where the network port can be understood as the external connection interface of the network device (such as a network card), and each network port has a corresponding network port identifier (such as a network port number), such as 0, 1, or port0, port1, etc.
[0043] In a specific implementation, in an optional implementation provided by an embodiment of this specification, the determining of the corresponding network card queue based on the transmission request and transmitting the target data from the first network port corresponding to the network card queue is specifically implemented in the following manner:
[0044] Determining the network card queue according to the queue information carried in the transmission request;
[0045] Convert the transmission request into a queue element and add it to the corresponding network card queue;
[0046] Parsing the queue elements to determine the target data;
[0047] The target data is transmitted from the first network port corresponding to the network card queue.
[0048] In actual applications, the transmission request carries queue information of the network card queue, such as the IP address, port number and / or queue identifier of the communication end. Based on the carried queue information, a network card queue can be uniquely determined, and the target data can be transmitted through the network card queue and the receiving end corresponding to the IP address.
[0049] Specifically, converting the transmission request into a queue element can be understood as formatting the transmission request, converting it into the format of the queue element of the network card queue, and adding it to the network card queue, so as to process the queue element in the network card queue.
[0050] In practical applications, when the network card queue is a transmission queue of the RDMA protocol, a work queue element (WQE) placed in the receive queue (RQ) of the network card queue, that is, a queue element, mainly includes a pointer to a buffer, which is used to indicate the address where the data to be received will be stored, and a WQE placed in the send queue (SQ) of the network card queue contains a pointer to the data to be sent, which is used to point to the data to be sent.
[0051] Furthermore, by parsing the queue elements, the target data to be transmitted can be obtained, and the target data can be transmitted from the first network port corresponding to the network card queue, thereby realizing the transmission of the target data by scheduling the network card queue and transmitting the target data from the designated network port (i.e., the network port corresponding to the network card queue).
[0052] In actual applications, in the process of creating a network card queue, a corresponding network port is allocated to the network card queue to indicate from which network port the data in the network card queue is transmitted. In an optional implementation manner provided by an embodiment of this specification, before determining the corresponding network card queue based on the transmission request and transmitting the target data from the first network port corresponding to the network card queue, it also includes:
[0053] Receive a queue creation request, wherein the queue creation request carries queue address information and queue port information;
[0054] Based on the queue address information and the queue port information, create a network card queue corresponding to the queue creation request;
[0055] Determine a first network port corresponding to the network card queue, and assign the first network port to the network card queue.
[0056] Specifically, the queue creation request refers to a request for creating a network card queue, which carries queue address information and queue port information, wherein the queue address information can be understood as an IP address, and the queue port information can be understood as a port number. In actual applications, a network card queue can be created based on the source IP address and source port number of the sender, and the target IP address and target port number of the receiver corresponding to the sender.
[0057] During specific implementation, the network port corresponding to the network card queue can also be specified in the queue creation request. For example, the network port identifier is specified in the queue creation request, and the network port identifier is assigned to the network card queue, that is, the network port corresponding to the network port identifier is used as the network port corresponding to the network card queue, wherein the network port identifier refers to the identifier of the network port that can uniquely identify a network card.
[0058] In actual applications, when the network card queue is a transmission queue of the RDMA protocol, a specified network port can be allocated to the network card queue in the driver software stack through the network card driver software interface. In addition, the preset allocation rules can be queried to allocate the network port corresponding to the network port identifier indicated in the allocation rule to the network card queue.
[0059] Further, after the network card queue is created, in an optional implementation manner provided in the embodiment of this specification, before the receiving of the transmission request for the target data, the method further includes:
[0060] The correspondence between the network card queue and the first network port is recorded in a preset correspondence table.
[0061] In actual applications, the correspondence between the network card queue and the first network port can be expressed by the correspondence between the queue identifier of the network card queue and the first network port identifier of the first network port, or the correspondence between the name of the network card queue and the network port name of the first network port. There is no limitation here, and this correspondence is recorded (i.e., stored) in a preset correspondence table.
[0062] Specifically, the corresponding relationship table may be shown in Table 1 below:
[0063] Network card queue (queue ID) Network port (network port identification) QP1 Port0 QP2 Port1 QP3 Port0 QP4 Port1 QP5 Port0 QP6 Port1
[0064] Table 1
[0065] Among them, the queue identifier refers to an identifier that can uniquely identify a network card queue, the first network port identifier refers to the identifier of the first network card, and the correspondence table can be understood as a table or a data table in a database. In addition, it can also be understood as any storage file that can store data, etc., which is not limited here.
[0066] In the embodiment of this specification, after the network card queue is created, the correspondence between the network card queue and the network port is recorded in a preset relationship correspondence table, so as to correspond to the created network card, and search and track the correspondence between the network card queue and the network port.
[0067] Step 106: if no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is changed to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue.
[0068] Specifically, the preset duration refers to the maximum duration for receiving a receiving response that is preset in advance. If no receiving response for the target data is received within the preset duration, it indicates that the transmission of the target data has failed. If a receiving response for the target data is received within the preset duration, it indicates that the transmission of the target data has been successful. The receiving response can be an acknowledgment character (ACK) or other types of custom acknowledgment messages used to indicate that the receiving end has received the target data, which is not limited here.
[0069] The second network port can be understood as any network port in a network device (such as a network card) except the first network port. In actual applications, a network card can have at least one network port, each network port is connected to a switch (such as ASW), and the switch can be connected to multiple switches (such as PSW). Therefore, the physical path between the sender and the receiver may pass through multiple switches. If any switch in the transmission path fails (such as MMU blockage, black hole, etc.), the network port corresponding to the path where the failed switch is located will be disconnected. Therefore, by switching the traffic of the sender from the network port corresponding to the failed path to another available network port, the traffic between the sender and the receiver can be interconnected, thereby ensuring the availability of the upper-layer business.
[0070] It should be noted that when the network card driver sends data, it sends the data on the RDMA network connection from the corresponding network port according to the network port identifier corresponding to the RDMA network connection. The network port identifier corresponding to each RDMA network connection can be dynamically modified through the driver software interface. The next time data is sent for the RDMA network connection, the new network port identifier is read and then sent from the network port corresponding to the new network port identifier.
[0071] like Figure 2As shown, taking the network card queue QP1 as an example, the network cards of the sending end and the receiving end both have two network ports, and the network port identifiers of these two network ports are Port0 and Port1 respectively. The network port corresponding to the sending end QP1 is network port Port0, and network port Port0 is connected to a switch 1 (such as an access layer switch), and network port Port1 is connected to switch 2. Among them, switch 1 is further connected to eight switches, namely switch 11, switch 12...switch 18, and switch 2 is also connected to eight switches, namely switch 21, switch 22...switch 28, which are connected to switch 3 or switch 4 respectively, and switch 3 is connected to network port Port0 of the receiving end, and switch 4 is connected to network port Port1 of the receiving end. In the case of a failure of switch 1, the physical path from Port0 of the sending end to the receiving end is disconnected, that is, the target data cannot be transmitted to the receiving end through the network port Port0 corresponding to QP1, then the network port corresponding to QP1 is changed from network port Port0 to network port Port1, and the target data is transmitted from the network port Port1 corresponding to QP1.
[0072] On the basis of modifying the network port corresponding to the network card queue to the second network port, in an optional implementation manner provided by the embodiment of this specification, the data transmission method further includes:
[0073] The correspondence between the network card queue and the first network port in the correspondence table is updated to the correspondence between the network card queue and the second network port.
[0074] In actual applications, after the network port corresponding to the network card queue is changed from the first network port to the second network port, the correspondence between the network card queue and the network port in the correspondence table is updated. Furthermore, the queue record of the network card queue in the correspondence table can be determined by the queue identifier of the network card queue, and the first network port identifier of the first network port in the queue record is updated to the second network port identifier of the second network port to complete the update of the queue record, so as to ensure that the correspondence recorded in the correspondence table is updated in time, that is, to ensure that the correspondence queried in the correspondence table is accurate.
[0075] Specifically, taking the above correspondence table as Table 1 as an example, after the correspondence table is updated, it is specifically shown in the following Table 2:
[0076] Network card queue (queue ID) Network port (network port identification) QP1 Port1 QP2 Port1 QP3 Port0 QP4 Port1 QP5 Port0 QP6 Port1
[0077] Table 2
[0078] Furthermore, if the newly created network card queue at the sending end still passes through the fault path, data transmission timeout may occur. In this case, the network port corresponding to the newly created network card queue will also be modified. Therefore, after a period of time, the network card queue and network traffic for communication between the sending end and the receiving end will converge to the available network port, and the network card queues are all long connections, but once the connection is successfully established, it will be kept alive. Therefore, even if the fault path is restored and available, the network card queue and traffic that have been switched to the available network port have stabilized and will not be actively switched to the original fault path, resulting in a large amount of sending and receiving traffic at the sending end being concentrated on one network port, that is, resulting in an unbalanced network traffic. In the end, the business layer sees the results of halving the network throughput and reducing the business capacity, which greatly reduces the available bandwidth and cannot fully restore the maximum service availability of the application, resulting in a waste of resources. Therefore, it is necessary to balance the traffic for the network port, and there are various ways to balance the traffic for the network port. In the first optional implementation mode provided in the embodiment of this specification, it is specifically implemented in the following way:
[0079] Receive queue balancing instructions for network ports;
[0080] Based on the queue balancing instruction, determine the total number of queues of the network card queues, the number of network ports, and the number of queues of the network card queues corresponding to each network port in the corresponding relationship table;
[0081] Determine the number of balanced queues corresponding to each network port according to the total number of queues and the number of network ports;
[0082] Based on the number of queues and the number of balanced queues, the network card queues corresponding to the respective network ports are queue balanced.
[0083] Among them, the queue balancing instruction can be understood as an instruction to balance the queue quantity of the network card queue of each network port. In actual applications, after the fault is recovered, the application on the server node (sending end) can be linked with the network operation and maintenance system, or the operation and maintenance engineer can manually trigger the queue balancing to achieve the even distribution of the traffic of the upper-layer application to the network ports corresponding to each network port identifier (network port number), so that the traffic can pass through the switch and network path after the fault is recovered again, without disconnecting the current connection and re-establishing a new connection, that is, the network card supports the function of dynamically switching network ports for the network card queue to achieve uninterrupted chain.
[0084] The total number of queues refers to the total number of network card queues recorded in the correspondence table, for example, the total number of network card queues recorded in the above Table 2 is 6; the number of network ports can be understood as the number of network ports recorded in the correspondence table, for example, the number of network ports recorded in the above Table 2 is 2, and the two network ports are network port Port0 and network port Port1 respectively; the number of queues refers to the number of network card queues corresponding to each network port recorded in the correspondence table, for example, the number of network card queues corresponding to network port Port0 recorded in the above Table 2 is 4, and the number of network card queues corresponding to network port Port1 is 2.
[0085] Based on this, the balanced number corresponding to each network port is determined according to the total number of queues and the number of network ports. It can be understood as calculating through the total number of queues and the number of network ports, such as calculating the quotient between the total number of queues and the number of network ports, as the balanced queue number of the network queue corresponding to each network port.
[0086] Furthermore, queue balancing is performed according to the number of queues of the network card queue corresponding to each network port and the number of balanced queues. Specifically, taking the above Table 2 as an example, the number of queues of the network card queue corresponding to network port Port0 is 4, the number of queues of the network card queue corresponding to network port Port1 is 2, and the number of balanced queues of the network card queue corresponding to each network port is (4+2) / 2=3. Then, in the network card queue corresponding to the number of queues of 4, one network card queue is selected according to a preset rule (such as randomly or according to the arrangement order in the correspondence table), and the network port corresponding to the network card queue is changed from Port0 to Port1. After the modification is completed, the number of queues of the network card queues corresponding to network port Port0 and network port Port1 are both 3, and there are half of the network card queues on each network port.
[0087] In addition, you can also choose to disconnect the network card queue (transmission connection) and recreate the network card queue (transmission connection) to randomly break up the aggregation of the network card queue on the network port. However, disconnection and reconnection will cause unstable perception and service at the business layer.
[0088] In specific implementation, queue balancing is performed on the network card queues corresponding to each network port, and the network card queues can be evenly distributed to each network port according to the number of network ports, thereby avoiding traffic bottlenecks at individual network ports and avoiding waste of resources, while improving the accuracy of queue balancing. In an optional implementation manner provided in the embodiment of this specification, the following method is specifically adopted to implement:
[0089] Determine a first number of queues in the number of queues that is greater than the balanced number of queues, and determine a second number of queues in the number of queues that is less than the balanced number of queues;
[0090] Calculating a first quantity difference between the number of the first queues and the number of the balanced queues, and calculating a second quantity difference between the number of the balanced queues and the number of the second queues;
[0091] In the first network card queues corresponding to the first queue quantity, a target network card queue having the same number as the difference between the first number and the first number is selected according to a preset rule;
[0092] According to the second quantity difference and the third network port corresponding to the second quantity difference, the network port corresponding to the target network card queue is modified to the third network port, and the corresponding relationship table is updated according to the modification result.
[0093] Specifically, determining the number of first queues in the number of queues that is greater than the number of balanced queues, and determining the number of second queues in the number of queues that is less than the number of balanced queues, is to determine the number of queues (i.e., the number of first queues) in the number of queues of the network card queues corresponding to each network port that is greater than the number of balanced queues, and determine the number of queues (i.e., the number of second queues) in the number of queues of the network card queues corresponding to each network port that is less than the number of balanced queues, and calculate how much the number of first queues is greater than the number of balanced queues (i.e., the first number difference), and calculate how much the number of second queues is less than the number of balanced queues (i.e., the second number difference), and filter out the excess number of network card queues (i.e., the target network card queues) from the network card queues with a large number of queues (i.e., the first network card queue).
[0094] Furthermore, the network port corresponding to the network card queue (i.e., the target network card queue) that is screened out with a number greater than the number of balanced queues is modified to a network port with a smaller number of queues (i.e., the third network port). During specific implementation, the screened network card queue can be modified according to the number of queues that are missing from each third network port.
[0095] For example, there are 4 network ports, which are respectively network port Port0, network port Port1, network port Port2, and network port Port3. The number of queues of the network card queue corresponding to network port Port0 is 10, the number of queues of the network card queue corresponding to network port Port1 is 14, the number of queues of the network card queue corresponding to network port Port2 is 6, and the number of queues of the network card queue corresponding to network port Port3 is 22. The balanced number of queues of the 4 network ports is (10+14+6+22) / 4=13. It is determined that the number of queues (the first number of queues) in the number of queues of the network card queues in the 4 network ports that is greater than the balanced number of queues includes: the number of queues 14 corresponding to network port Port1, and the number of queues 22 corresponding to network port Port3. It is also determined that the number of queues (the second number of queues) in the number of queues of the network card queues in the 4 network ports that is less than the balanced number of queues includes: the number of queues 1 corresponding to network port Port0, and the number of queues 6 corresponding to network port Port2.
[0096] Calculating the quantity difference between the first number of queues and the number of balanced queues (first quantity difference) includes: the difference between the number of queues 14 corresponding to the network port Port1 and the number of balanced queues 13 is 1, and the difference between the number of queues 22 corresponding to the network port Port3 and the number of balanced queues 13 is 9, and calculating the quantity difference between the second number of queues and the number of balanced queues (second quantity difference) includes: the difference between the number of queues 10 corresponding to the network port Port0 and the number of balanced queues 13 is 3, and the difference between the number of queues 6 corresponding to the network port Port2 and the number of balanced queues 13 is 7;
[0097] Furthermore, one network card queue is randomly selected from network port Port1, and nine network card queues are randomly selected from network port Port3. These ten network card queues are used as target network card queues, and the network ports corresponding to three network card queues among these ten network card queues (determined by the number of queues 3 missing from network port Port0) are changed to Port0, and the network cards corresponding to the remaining seven network card queues among the ten network card queues (determined by the number of queues 7 missing from network port Port2) are changed to network port Port2.
[0098] In addition to the above-mentioned queue balancing method, in a second optional implementation manner provided in the embodiment of this specification, the data transmission method further includes:
[0099] When it is detected that the number of queues of the network card queue corresponding to any network port is greater than a preset number threshold, a preset proportion of third network card queues are selected from the network card queues corresponding to any network port;
[0100] According to the correspondence table, the network ports are sorted in descending order according to the queue numbers of the corresponding network card queues;
[0101] The network port corresponding to the third network card queue is changed to the fourth network port at the last position.
[0102] Specifically, the number of queues is greater than the preset number threshold, which can be understood as the number of queues of the network card queue corresponding to the network port is large, and an imbalance has occurred. It is necessary to balance the queues of the network card queues of the network port, then a preset proportion (such as 10%, 20%, etc.) of network card queues (i.e., the third network card queue) is screened out from the network card queues corresponding to the network card. In actual applications, a preset screening rule (such as random screening or according to the size of the queue identifier of the network card queue) can be used to screen out the third network card queue.
[0103] Furthermore, according to the correspondence table, each network port is sorted from large to small according to the queue number of the corresponding network card queue, in order to determine the network port with the least number of queues (i.e., the fourth network port from the bottom), and the network card queue is modified from the network port with an excessive number of queues to the network port with the least number of queues, thereby achieving queue balancing of the network card queue from the network port with a high number of queues to the network port with the lowest number of queues, and improving the efficiency of queue balancing.
[0104] Further, after the network port corresponding to the network card queue is modified to the second network port, the network port corresponding to the network card queue may be modified back to the first network port corresponding to the previous network port to avoid an imbalance in the number of network card queues corresponding to each network port. In an optional implementation manner provided in the embodiment of this specification, after the network port corresponding to the network card queue is modified to the second network port, the method further includes:
[0105] Receiving a recovery completion instruction for the first network port;
[0106] Based on the recovery completion instruction, the network port corresponding to the network card queue is modified to the first network port.
[0107] Among them, the recovery completion instruction can be understood as a recovery completion instruction for the fault path corresponding to the first network port, that is, a repair completion instruction for the fault that caused the above-mentioned transmission failure. Since the network port corresponding to the network card queue is modified after the fault occurs, it may cause an imbalance in the number of network card queues corresponding to each network port. Therefore, after the fault is repaired, the modifications made to the network card queue are restored, which avoids an imbalance in the number of network card queues corresponding to each network port.
[0108] The present specification provides a data transmission method, including: receiving a transmission request for target data; determining a corresponding network card queue based on the transmission request, and transmitting the target data from a first network port corresponding to the network card queue; if no reception response for the target data is received through the network card queue within a preset time, modifying the network port corresponding to the network card queue to a second network port, and transmitting the target data from the second network port corresponding to the network card queue, so that when the target data transmission times out, the network port corresponding to the network card queue (i.e., the network port where a transmission failure occurs) is dynamically switched to an available network port, and the target data can be transmitted from the available network port through the network card queue, thereby avoiding data transmission from the fault path corresponding to the first network port, and there is no need to create a new network card queue, thereby improving fault recovery efficiency.
[0109] In summary, the present specification provides a data transmission method, including: receiving a transmission request for target data; determining a corresponding network card queue based on the transmission request, and transmitting the target data from a first network port corresponding to the network card queue; if no reception response for the target data is received through the network card queue within a preset time, modifying the network port corresponding to the network card queue to a second network port, and transmitting the target data from the second network port corresponding to the network card queue, thereby achieving that when the target data transmission times out, the network port corresponding to the network card queue (i.e., the network port where a transmission failure occurs) is dynamically switched to an available network port, and the target data can be transmitted from the available network port through the network card queue, thereby avoiding data transmission from the fault path corresponding to the first network port, and there is no need to create a new network card queue, thereby improving fault recovery efficiency.
[0110] The following combination Figure 3 , taking the application of the data transmission method provided in this specification in the RDMA network transmission scenario as an example, the data transmission method is further described. Figure 3 A processing flow chart of a data transmission method applied to an RDMA network transmission scenario provided by an embodiment of the present specification is shown, which specifically includes the following steps:
[0111] Step 302: Receive an RDMA queue creation request, wherein the RDMA queue creation request carries queue address information and queue port information.
[0112] Specifically, the RDMA queue creation request refers to a creation request for requesting to create an RDMA network card queue, wherein the RDMA network card queue refers to a transmission queue that supports the RDMA protocol.
[0113] In practical applications, in order to accelerate data access and computing, data center networks can use RDMA to provide high-performance network transmission services for distributed storage and distributed computing.
[0114] Step 304: Create an RDMA network card queue corresponding to the RDMA queue creation request based on the queue address information and the queue port information.
[0115] Step 306: determine the first network port corresponding to the RDMA network card queue, and allocate the first network port to the network card queue.
[0116] Specifically, the first network port corresponding to the RDMA network card queue can be directly specified in the RDMA queue creation request. In addition, the first network port can also be selected according to a preset selection rule. For example, there are two network ports Port0 and Port1. If the network port Port0 was allocated to the newly created RDMA network card queue last time, then this time, network port Port1 is selected as the network port corresponding to the RDMA network card queue created this time.
[0117] Step 308: Record the correspondence between the RDMA network card queue and the first network port in a preset correspondence table.
[0118] Step 310: Receive a transmission request for target data.
[0119] Step 312: determine a corresponding RDMA network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the RDMA network card queue.
[0120] Step 314: if no reception response for the target data is received through the RDMA network card queue within a preset time, the network port corresponding to the RDMA network card queue is modified to a second network port, and the target data is transmitted from the second network port corresponding to the RDMA network card queue.
[0121] Step 316: Update the correspondence between the RDMA network card queue and the first network port in the correspondence table to the correspondence between the RDMA network card queue and the second network port.
[0122] Step 318: Receive a queue balancing instruction for the network port.
[0123] Step 320: Based on the queue balancing instruction, determine the total number of queues of the RDMA network card queues, the number of network ports, and the number of queues of the RDMA network card queues corresponding to each network port in the corresponding relationship table.
[0124] Step 322: Determine the number of balanced queues corresponding to each network port according to the total number of queues and the number of network ports.
[0125] Step 324: Based on the number of queues and the number of balanced queues, queue balancing is performed on the RDMA network card queues corresponding to the respective network ports.
[0126] In summary, the present specification provides a data transmission method, including: receiving a transmission request for target data; determining a corresponding RDMA network card queue based on the transmission request, and transmitting the target data from a first network port corresponding to the RDMA network card queue; if no reception response for the target data is received through the RDMA network card queue within a preset time, modifying the network port corresponding to the RDMA network card queue to a second network port, and transmitting the target data from the second network port corresponding to the RDMA network card queue, so that when the target data transmission times out, the network port corresponding to the RDMA network card queue (i.e., the network port where the transmission failure occurs) is dynamically switched to an available network port, and the target data can be transmitted from the available network port through the RDMA network card queue, thereby avoiding data transmission from the fault path corresponding to the first network port, and there is no need to create a new RDMA network card queue, thereby improving fault recovery efficiency.
[0127] An embodiment of a data transmission device provided in this specification is as follows:
[0128] Corresponding to the above method embodiment, this specification also provides a data transmission device embodiment, Figure 4 FIG. 1 is a schematic diagram of a data transmission device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises:
[0129] A first receiving module 402 is configured to receive a transmission request for target data;
[0130] The transmission module 404 is configured to determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0131] The first modification module 406 is configured to modify the network port corresponding to the network card queue to a second network port and transmit the target data from the second network port corresponding to the network card queue if no reception response for the target data is received through the network card queue within a preset time.
[0132] Optionally, the transmission module 404 is further configured to:
[0133] Determining the network card queue according to the queue information carried in the transmission request;
[0134] Convert the transmission request into a queue element and add it to the corresponding network card queue;
[0135] Parsing the queue elements to determine the target data;
[0136] The target data is transmitted from the first network port corresponding to the network card queue.
[0137] Optionally, the data transmission device further includes:
[0138] The recording module is configured to record the correspondence between the network card queue and the first network port in a preset correspondence table.
[0139] Optionally, the data transmission device further includes:
[0140] The updating module is configured to update the correspondence between the network card queue and the first network port in the correspondence table to the correspondence between the network card queue and the second network port.
[0141] Optionally, the data transmission device further includes:
[0142] A first instruction receiving module is configured to receive a queue balancing instruction for a network port;
[0143] A first quantity determination module is configured to determine the total queue amount of the network card queue, the number of network ports, and the queue amount of the network card queue corresponding to each network port in the corresponding relationship table based on the queue balancing instruction;
[0144] A second quantity determination module is configured to determine the number of balanced queues corresponding to each network port according to the total number of queues and the number of network ports;
[0145] The queue balancing module is configured to balance the network card queues corresponding to the respective network ports based on the number of queues and the number of balanced queues.
[0146] Optionally, the queue balancing module is further configured to:
[0147] Determine a first number of queues in the number of queues that is greater than the balanced number of queues, and determine a second number of queues in the number of queues that is less than the balanced number of queues;
[0148] Calculating a first quantity difference between the number of the first queues and the number of the balanced queues, and calculating a second quantity difference between the number of the balanced queues and the number of the second queues;
[0149] In the first network card queues corresponding to the first queue quantity, a target network card queue having the same number as the difference between the first number and the first number is selected according to a preset rule;
[0150] According to the second quantity difference and the third network port corresponding to the second quantity difference, the network port corresponding to the target network card queue is modified to the third network port, and the corresponding relationship table is updated according to the modification result.
[0151] Optionally, the data transmission device further includes:
[0152] a screening module configured to screen a preset proportion of third network card queues from the network card queues corresponding to any network port when detecting that the number of queues of the network card queues corresponding to any network port is greater than a preset number threshold;
[0153] A sorting module is configured to sort the network ports in descending order according to the queue quantity of the corresponding network card queue according to the corresponding relationship table;
[0154] The second modification module is configured to modify the network port corresponding to the third network card queue to the fourth network port at the last position.
[0155] Optionally, the data transmission device further includes:
[0156] A second instruction receiving module is configured to receive a recovery completion instruction for the first network port;
[0157] The third modification module is configured to modify the network port corresponding to the network card queue to the first network port based on the recovery completion instruction.
[0158] Optionally, the data transmission device further includes:
[0159] A second receiving module is configured to receive a queue creation request, wherein the queue creation request carries queue address information and queue port information;
[0160] A creation module, configured to create a network card queue corresponding to the queue creation request based on the queue address information and the queue port information;
[0161] The allocation module is configured to determine a first network port corresponding to the network card queue and allocate the first network port to the network card queue.
[0162] The present specification provides a data transmission device, comprising: receiving a transmission request for target data; determining a corresponding network card queue based on the transmission request, and transmitting the target data from a first network port corresponding to the network card queue; if no reception response for the target data is received through the network card queue within a preset time, modifying the network port corresponding to the network card queue to a second network port, and transmitting the target data from the second network port corresponding to the network card queue, thereby achieving that in the case of a target data transmission timeout, the network port corresponding to the network card queue (i.e., the network port where a transmission failure occurs) is dynamically switched to an available network port, and the target data can be transmitted from the available network port through the network card queue, thereby avoiding data transmission from the fault path corresponding to the first network port, and there is no need to create a new network card queue, thereby improving fault recovery efficiency.
[0163] The above is a schematic scheme of a data transmission device of this embodiment. It should be noted that the technical scheme of the data transmission device and the technical scheme of the above data transmission method belong to the same concept, and the details of the technical scheme of the data transmission device that are not described in detail can all be referred to the description of the technical scheme of the above data transmission method.
[0164] An embodiment of a computing device provided in this specification is as follows:
[0165] Figure 5 The structure block diagram of a computing device 500 provided according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0166] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0167] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0168] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.
[0169] The processor 520 is used to execute the following computer executable instructions:
[0170] receiving a transmission request for target data;
[0171] Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0172] When no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is modified to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue.
[0173] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data transmission method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data transmission method.
[0174] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0175] This specification provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used to:
[0176] receiving a transmission request for target data;
[0177] Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue;
[0178] When no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is modified to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue.
[0179] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned data transmission method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned data transmission method.
[0180] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0181] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0182] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0183] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0184] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A data transmission method, comprising: receiving a transmission request for target data; Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue; If no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is changed to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue, wherein the second network port is any network port in the network device except the first network port; When the fault of the first network port is recovered, the network card queues corresponding to the network ports are dynamically switched without disconnecting the current connection and re-establishing a new connection, so as to achieve queue balancing of the network ports.
2. The data transmission method according to claim 1, wherein determining the corresponding network card queue based on the transmission request and transmitting the target data from the first network port corresponding to the network card queue comprises: Determining the network card queue according to the queue information carried in the transmission request; Convert the transmission request into a queue element and add the queue element to the corresponding network card queue; Parsing the queue elements to determine the target data; The target data is transmitted from the first network port corresponding to the network card queue.
3. The data transmission method according to claim 1, before receiving the transmission request for the target data, further comprising: The correspondence between the network card queue and the first network port is recorded in a preset correspondence table.
4. The data transmission method according to claim 3, after modifying the network port corresponding to the network card queue to the second network port, further comprising: The correspondence between the network card queue and the first network port in the correspondence table is updated to the correspondence between the network card queue and the second network port.
5. The data transmission method according to claim 3, further comprising: Receive queue balancing instructions for network ports; Based on the queue balancing instruction, determine the total number of queues of the network card queues, the number of network ports, and the number of queues of the network card queues corresponding to each network port in the corresponding relationship table; Determine the number of balanced queues corresponding to each network port according to the total number of queues and the number of network ports; Based on the number of queues and the number of balanced queues, the network card queues corresponding to the respective network ports are queue balanced.
6. The data transmission method according to claim 5, wherein the balancing of the network card queues corresponding to the respective network ports based on the number of queues and the number of balanced queues comprises: Determine a first number of queues in the number of queues that is greater than the balanced number of queues, and determine a second number of queues in the number of queues that is less than the balanced number of queues; Calculating a first quantity difference between the number of the first queues and the number of the balanced queues, and calculating a second quantity difference between the number of the balanced queues and the number of the second queues; In the first network card queues corresponding to the first queue quantity, a target network card queue having the same number as the difference between the first number and the first number is selected according to a preset rule; According to the second quantity difference and the third network port corresponding to the second quantity difference, the network port corresponding to the target network card queue is modified to the third network port, and the corresponding relationship table is updated according to the modification result.
7. The data transmission method according to claim 3, further comprising: When it is detected that the number of queues of the network card queue corresponding to any network port is greater than a preset number threshold, a preset proportion of third network card queues are selected from the network card queues corresponding to any network port; According to the correspondence table, the network ports are sorted in descending order according to the queue numbers of the corresponding network card queues; The network port corresponding to the third network card queue is changed to the fourth network port at the last position.
8. The data transmission method according to claim 1, after modifying the network port corresponding to the network card queue to the second network port, further comprising: Receiving a recovery completion instruction for the first network port; Based on the recovery completion instruction, the network port corresponding to the network card queue is modified to the first network port.
9. The data transmission method according to claim 1, before determining the corresponding network card queue based on the transmission request and transmitting the target data from the first network port corresponding to the network card queue, further comprising: Receive a queue creation request, wherein the queue creation request carries queue address information and queue port information; Based on the queue address information and the queue port information, create a network card queue corresponding to the queue creation request; Determine a first network port corresponding to the network card queue, and assign the first network port to the network card queue.
10. A data transmission device, comprising: A first receiving module is configured to receive a transmission request for target data; A transmission module, configured to determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue; A first modification module is configured to modify the network port corresponding to the network card queue to a second network port when no reception response for the target data is received through the network card queue within a preset time, and transmit the target data from the second network port corresponding to the network card queue, wherein the second network port is any network port in the network device except the first network port; When the fault of the first network port is recovered, the network card queues corresponding to the network ports are dynamically switched without disconnecting the current connection and re-establishing a new connection, so as to achieve queue balancing of the network ports.
11. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the following method: receiving a transmission request for target data; Determine a corresponding network card queue based on the transmission request, and transmit the target data from a first network port corresponding to the network card queue; If no reception response for the target data is received through the network card queue within a preset time, the network port corresponding to the network card queue is changed to a second network port, and the target data is transmitted from the second network port corresponding to the network card queue, wherein the second network port is any network port in the network device except the first network port; When the fault of the first network port is recovered, the network card queues corresponding to the network ports are dynamically switched without disconnecting the current connection and re-establishing a new connection, so as to achieve queue balancing of the network ports.
12. A computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the data transmission method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method, equipment and system for switching main interface and standby interface
CN102006268A
Communication data processing method, device and equipment
CN110022269A
Data storage method and device based on multiple internet accesses
CN111880932A
