Data transmission method and device, electronic equipment and storage medium
By using the KCP protocol for data transmission between two data centers, the problem of low data transmission efficiency in the wide area network is solved, and faster transmission rates and higher efficiency are achieved in unstable network environments.
Patent Information
- Application Number
- CN202411986001.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-06
AI Technical Summary
When data transmission is carried out in a wide area network, due to long-distance data transmission, the data transmission efficiency is not high, especially in an unstable network environment.
By using the reliable transmission KCP protocol to transmit data between two data centers, the benefits of the KCP protocol are used to quickly respond to packet loss and provide faster transmission rates in unstable network environments.
It realizes faster data transmission rates in an unstable network environment, improves data transmission efficiency, and better adapts to the current network state.
Smart Images

Figure CN119946068A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a data transmission method, device, electronic device and storage medium. Background Art
[0002] When data is transmitted in a wide area network, the data transmission efficiency is not high due to the long distance data transmission. Summary of the invention
[0003] In view of the above problems, the present application proposes a data transmission method, device, electronic device and storage medium.
[0004] In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a first data center and a second data center, wherein business nodes are deployed on both the first data center and the second data center, and the first data center and the second data center are different data centers. The method includes: the business node on the first data center transmits the target data to the business node on the second data center through the current reliable transmission KCP protocol.
[0005] In a second aspect, an embodiment of the present application provides a data transmission device, which is applied to a data center, and the device includes: a data transmission module, which is used for the business node on the first data center to transmit the target data to the business node on the second data center through the current reliable transmission KCP protocol.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the data transmission method provided in the first aspect above.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the data transmission method provided in the first aspect above.
[0008] The solution provided in this application uses the KCP protocol to achieve data transmission between two data centers. By utilizing the advantages of the KCP protocol, it can respond to packet loss more quickly and provide faster transmission rates in unstable network environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A schematic diagram of an application scenario of the data transmission method provided in an embodiment of the present application is shown.
[0011] Figure 2 A schematic diagram of data transmission of the TCP protocol in the related art is shown.
[0012] Figure 3 A flow chart of a data transmission method provided by an embodiment of the present application is shown.
[0013] Figure 4 A schematic diagram of the protocol structure of the KCP protocol is shown.
[0014] Figure 5 A flow chart of a data transmission method provided by another embodiment of the present application is shown.
[0015] Figure 6 A flow chart of a data transmission method provided by yet another embodiment of the present application is shown.
[0016] Figure 7 A structural block diagram of a data transmission device provided in an embodiment of the present application is shown.
[0017] Figure 8 A structural block diagram of an electronic device provided by an embodiment of the present application for executing a data transmission method according to an embodiment of the present application is shown.
[0018] Fig. 9 A storage medium provided by an embodiment of the present application for storing or carrying a program code for implementing a data transmission method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0020] See also Figure 1 , Figure 1A schematic diagram of an application scenario of the data transmission method provided in an embodiment of the present application is shown. The business cluster includes three nodes, namely node 1, node 2 and node 3. The business cluster transmits data through the Transmission Control Protocol (TCP) under the Wide Area Network (WAN). And the distributed consistency algorithm RAFT protocol is used to achieve data synchronization between multiple nodes. Since the TCP protocol provides reliable, connection-oriented, and ordered data transmission services, it is the most commonly used transmission protocol for the RAFT protocol. The TCP protocol can guarantee the order and reliability of data packets, which is very helpful for maintaining the state consistency of distributed systems. However, wide area networks usually have higher delays and packet loss rates. The congestion control mechanism of the TCP protocol will be frequently triggered in this environment, resulting in a decrease in transmission speed. The node can be a data center, which transmits data from different regions through the wide area network, and synchronizes the data of multiple data centers according to the RAFT protocol. And the data relies on the network for transmission to synchronize data between different nodes. Please refer to Figure 2 , Figure 2 A data transmission diagram of the TCP protocol in the related art is shown. During the data transmission process, the receiving end and the sending end both use the TCP protocol to achieve data consistency between the two ends, so that the data of the receiving end and the sending end under the RAFT protocol are consistent.
[0021] Since data transmission depends on the network, when the network is congested, the data synchronization efficiency decreases. However, if the network fluctuates in real time, the network needs to be adjusted in real time to ensure data synchronization efficiency.
[0022] In the related art, when the monitored network status is congested, the protocol parameter value corresponding to the current network status is obtained by looking up the table according to the current network status, and the current protocol parameter of the transmission protocol is replaced by the protocol parameter value to adjust the network and improve the efficiency of data synchronization. However, since the network status changes in real time, it takes time to look up the table to determine the protocol parameters, and the protocol parameters obtained after a certain period of time cannot match the current network status, and thus the efficiency of data transmission cannot be guaranteed.
[0023] In view of the problems in the background technology, the inventors have proposed the data transmission method, device, electronic device and storage medium provided in the embodiments of the present application. The KCP protocol is used to realize data transmission between two data centers. The advantages of the KCP protocol can respond to packet loss more quickly and provide faster transmission rates in unstable network environments.
[0024] The data transmission method, device, electronic device and storage medium provided in the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0025] See also Figure 3 , Figure 3 The flowchart of the data transmission method provided by the embodiment of the present application is shown. The data transmission method is applied to a first data center and a second data center, both of which are deployed with service nodes, and the first data center and the second data center are different data centers. The data transmission method can be applied to Figure 7 The data transmission device 300 and the electronic device 100 ( Figure 8 ).
[0026] The data transmission method may specifically include the following steps:
[0027] Step S110: The service node on the first data center transmits the target data to the service node on the second data center through the current reliable transmission KCP protocol.
[0028] The term data center refers to a device or device set that has data processing and / or data transmission capabilities. A data center can be a computer, a server, or any device or device set that has data processing and / or data transmission capabilities. The data center is not specifically limited here.
[0029] There is at least one service node in the data center, and each service node is used to complete one or more types of data processing and / or data transmission. The service node can be a virtual node or a physical node. When the service node is a virtual node, the service node can be a software program node or a virtual machine node. When the service node is a physical node, the service node can be a computer or a server, and the service node is not specifically limited here.
[0030] Furthermore, the Keep-Alive Control Protocol (KCP) is a protocol that segments data packets in sequence and then ensures reliable data transmission through a confirmation and retransmission mechanism between the sender and the receiver. KCP can respond to packet loss more quickly, reduce waiting time, and provide faster transmission speeds in unstable network environments.
[0031] For example, see Figure 4 , Figure 4 The protocol structure diagram of the KCP protocol is shown. In the KCP protocol, both the receiving end and the sending end perform network data transmission through the User Datagram Protocol (Open Systems Interconnection, UDP) protocol in the KCP protocol to achieve data consistency between the receiving end and the sending end.
[0032] In the embodiment of the present application, the current KCP protocol may be a general KCP protocol, a set KCP protocol, or a real-time adjusted KCP protocol. The current KCP protocol is not specifically limited herein.
[0033] In the solution provided in the embodiment of the present application, the KCP protocol is used to achieve data transmission between two data centers. The advantages of the KCP protocol can respond to packet loss more quickly and provide a faster transmission rate in an unstable network environment.
[0034] See also Figure 5 , Figure 5 A flow chart of another data transmission method provided in an embodiment of the present application is shown.
[0035] Step S210: The business node of the first data center transmits the first data to the business node of the second data center through the current KCP protocol, the target data includes the first data and the second data, and the transmission time of the first data is earlier than the transmission time of the second data.
[0036] Step S220: The service node of the first data center obtains the current network status of the first data during transmission.
[0037] The network status includes but is not limited to the network connection status, network stability status, network performance status, etc. In the embodiment of the present application, the network status refers to the network stability status. The network stability status includes stability and congestion.
[0038] The network status can be obtained by the transmission efficiency between nodes, or by the packet loss rate between nodes, or by the duration of network delay. The method of obtaining the network status is not limited here.
[0039] Step S230: The business node of the first data center optimizes the current KCP protocol according to the current network status, and uses the optimized current KCP protocol as the current KCP protocol, so that the transmission rate of data transmitted by the business nodes on the first data center through the current KCP protocol is adapted to the current network status.
[0040] Step S240: The service node of the first data center transmits the second data to the service node of the second data center through the current KCP protocol.
[0041] Among them, the optimization can be to adjust the protocol parameters of the current KCP protocol according to the current network status, or to adjust the protocol parameters of the current KCP protocol according to preset parameters, so that the optimized current KCP protocol can adapt to the current network status.
[0042] For example, if the current network state is congested, the protocol parameters of the current KCP protocol need to be optimized so that less data is transmitted under the current network state to reduce the packet loss rate.
[0043] The solution provided in this embodiment obtains the current network status of the transmission process in real time during the data transmission process, and determines the target parameters that need to be adjusted and the optimization method corresponding to the target parameters according to the current network status, and then adjusts the target parameters according to the optimization method corresponding to the target parameters, so that the transmission rate when data is transmitted through the KCP protocol of the optimized target parameters can match the current network status, avoiding the situation where the parameters after table optimization do not match the current network status.
[0044] See also Figure 6 , Figure 6 A flow chart of a data transmission method provided by yet another embodiment of the present application is shown.
[0045] Step S310: The service node of the first data center transmits the first data to the service node of the second data center through the current KCP protocol.
[0046] For the detailed description of step S310, please refer to step S210 in the above embodiment, which will not be repeated here.
[0047] Step S320: The service node on the first data center obtains the current packet loss rate and the current network delay during this transmission process, where the current packet loss rate is determined by the average packet loss rate and the standard deviation of the packet loss rate, and the current network delay is determined by the average network delay and the standard deviation of the network delay.
[0048] The packet loss rate refers to the ratio of lost data packets to the sent data packets during data transmission. The average packet loss rate can be determined by the packet loss rate of each unit time within a preset time, or it can be determined by the packet loss rate corresponding to all unit time since the data transmission. The method for determining the average packet loss rate is not specifically limited here. The unit time can be 1s, 1min, or a custom unit time, and the unit time is not specifically limited here.
[0049] The standard deviation is used to describe the degree of dispersion or variation of the packet loss rate. The standard deviation of the packet loss rate is used to describe the degree of dispersion or variation of the packet loss rate within each unit time.
[0050] The calculation formula is:
[0051]
[0052] Where n is the number of data. is the average value, x i It is the packet loss rate per unit time.
[0053] The standard deviation of the packet loss rate can be calculated according to formula (1), and the current packet loss rate can be determined according to the average packet loss rate and the standard deviation of the packet loss rate.
[0054] Network delay refers to the time required for a message or data packet to be transmitted from one end of a network to the other end. The network delay can be the network delay corresponding to each data packet within a preset time length, or it can be the network delay corresponding to a unit time length. If it is the network delay corresponding to a unit time length, it can be the average network delay of multiple data packets within the unit time length, or it can be the sum of the network delays of multiple data packets within the unit time length. The network delay is not specifically limited here. The average network delay can be the average delay corresponding to each data packet within the preset time length, or it can be the network delay corresponding to each unit time length within the preset time length. The method for determining the average network delay is not limited here. The network delay standard deviation can be determined based on the average network delay. The network delay standard deviation can be calculated according to formula (1) to determine the current network delay.
[0055] In some embodiments, the service node on the first data center obtains the current packet loss rate and the current network delay in the current transmission process, including: the service node on the first data center obtains the packet loss rate corresponding to each unit time length within a preset time length during the data transmission of the first data, and the network delay corresponding to a preset number of data packets of the first data during the data transmission process; according to the packet loss rate corresponding to each unit time length within the preset time length, obtains the average packet loss rate and the standard deviation of the packet loss rate within the preset time length; determines the current packet loss rate according to the average packet loss rate and the standard deviation of the packet loss rate; according to the network delay corresponding to the preset number of data packets, obtains the average network delay and the standard deviation of the network delay of the data packets; determines the current network delay according to the average network delay and the standard deviation of the network delay.
[0056] Among them, according to the average packet loss rate and the standard deviation of the packet loss rate, the method for determining the current packet loss rate can be to determine the current packet loss rate according to the quotient of the average packet loss rate and the standard deviation of the packet loss rate, or to determine the current packet loss rate according to the product of the average packet loss rate and the standard deviation of the packet loss rate, or to determine the current packet loss rate according to the sum of the average packet loss rate and the standard deviation of the packet loss rate. The method for determining the current packet loss rate is not limited here. The method for determining the current network delay can be the same as the method for determining the current packet loss rate, or it can be different, and no specific limitation is made here.
[0057] In the implementation mode of the present application, the current packet loss rate and the current network delay are determined by the packet loss rate corresponding to each unit time length within the preset time length and the network delay corresponding to the preset number of data packets, so that the determined current packet loss rate and current network delay are more consistent with the current network state. The preset time length can be 15 minutes or 5 minutes, and the preset number can be 100 data packets or 120 data packets. The preset time length and the preset number are not specifically limited here.
[0058] In an embodiment of the present application, the current network state is determined according to the current packet loss rate and the current network delay. The current network state is determined according to the current packet loss rate and the preset packet loss rate threshold and the current network delay and the preset network delay threshold. If the current packet loss rate is greater than the preset packet loss rate threshold and the current network delay is greater than the preset network delay threshold, the current network state is determined to be congested. If the current packet loss rate is less than the preset packet loss rate threshold and / or the current network delay is less than the preset network delay threshold, the current network state is determined to be stable.
[0059] Step S330: Determine the current network status according to the current packet loss rate and the current network delay.
[0060] Among them, the determination method can also be to comprehensively determine the current network state based on the current packet loss rate and the preset packet loss rate threshold, the average packet loss rate and the preset average packet loss rate threshold, the current network delay and the preset network delay threshold, the average network delay and the preset average network delay threshold. If the current packet loss rate is greater than the preset packet loss rate threshold, the average packet loss rate is greater than the average packet loss rate threshold, the current network delay is greater than the preset network delay threshold, and the average network delay is greater than the preset average network delay, then the current network state is determined to be congested. If at least one of the current packet loss rate, the average packet loss rate, the current network delay, and the average network delay is less than the corresponding threshold, then the current network state is determined to be stable. The preset packet loss rate threshold can be 25% or 30%, and the preset network delay threshold, the preset average packet loss rate threshold, and the preset average network delay threshold can be the same as the preset packet loss rate threshold, or they can be different. The preset packet loss rate threshold, the preset network delay threshold, the preset average packet loss rate threshold, and the preset average network delay threshold are not specifically limited here.
[0061] Exemplarily, when the current packet loss rate is greater than 25%, and the average packet loss rate is less than or equal to (1+30%) of the preset average packet loss rate threshold, it is determined that the packet loss rate has been significantly reduced. When the current network delay is greater than 25%, and the average network delay is less than or equal to (1+30%) of the preset average network delay threshold, it is determined that the network delay has been significantly reduced, and the current network state is determined to be stable. When the current packet loss rate is less than or equal to 25%, and the average packet loss rate is greater than (1+30%) of the preset average packet loss rate threshold, it is determined that the packet loss rate has been significantly increased. When the current network delay is less than or equal to 25%, and the average network delay is greater than (1+30%) of the preset average network delay threshold, it is determined that the network delay has been significantly increased, and the current network state is determined to be congested.
[0062] Step S340: The business node of the first data center determines optimization parameters according to the current network status, where the optimization parameters include target parameters to be adjusted in the protocol parameters of the KCP protocol and the optimization method corresponding to the target parameters.
[0063] Among them, the target parameters can be all protocol parameters of the KCP protocol or part of the protocol parameters. The target parameters can be determined according to actual needs, and the target parameters are not specifically limited here. Different parameters correspond to different optimization methods under different network conditions. The optimization method corresponding to the target parameters is not specifically limited here.
[0064] Specifically, the protocol parameters include, but are not limited to, receiving window parameters, sending window parameters, delayed confirmation mode enabling parameters, sending time interval parameters, fast retransmission mode enabling parameters, flow rate control enabling parameters, and retransmission timeout parameters.
[0065] Furthermore, the optimization method can be to directly optimize the protocol parameters in the current KCP protocol according to the current network state, so that the optimized current KCP protocol adapts to the transmission rate of the current network state. The optimization method can also be multiple adjustments, each target parameter is adjusted at a preset ratio, and the network state after each parameter optimization is obtained. If the network state is the preset state, the parameter value is determined to be the optimized parameter value. If the network state is not the preset state, continue to optimize so that the network state is the preset state. The preset state can be a set state or a stable state. The optimization method and preset state of the target parameter are not specifically limited here.
[0066] In an embodiment of the present application, the target parameters that need to be adjusted and the optimization method corresponding to the target parameters are determined according to the current network status, so that the target parameters are adjusted in an optimized manner, so that the rate of data transmission through the optimized protocol parameters is adapted to the current network status, thereby avoiding waste of network resources and improving data transmission efficiency.
[0067] Exemplarily, the target parameter may be a window parameter and an enablement parameter. When the current network state is stable, the optimization method corresponding to the window parameter may be to adjust the window size. In this case, the window parameter is increased to increase the data transmission efficiency. The method corresponding to the enablement parameter is to change the enablement parameter. In this case, when the network state is stable, the data packet is not easily lost. Therefore, the fast retransmit mode enablement parameter may be changed to a disablement parameter.
[0068] In some implementations, before using the KCP protocol for data transmission, default values may be set for protocol parameters in the KCP protocol to ensure data transmission. The default values may refer to the data in the following table:
[0069]
[0070] Table 1
[0071] The protocol parameters in the KCP protocol can be set according to the parameter values in Table 1, or according to actual needs, and are not specifically limited here.
[0072] In other embodiments, the business node of the first data center determines the optimization parameter according to the current network state, including: if the current network state is stable, the business node of the first data center determines the optimization parameter to be a first optimization parameter, the first optimization parameter includes the target parameter and a first optimization method for increasing transmission efficiency; if the current network state is congested, determines the optimization parameter to be a second optimization parameter, the second optimization parameter includes the target parameter and a second optimization method for reducing transmission efficiency.
[0073] If the current network state is stable, it means that the current network state can provide more data for transmission. Therefore, the optimization parameter is determined as the first optimization parameter for increasing transmission efficiency. If the current network state is congested, it means that the current network has a large load when processing the current data, which is prone to packet loss and other phenomena, affecting data transmission efficiency. Therefore, at this time, the optimization parameter is determined as the second optimization parameter for reducing data transmission efficiency.
[0074] If the current network state is stable, the first optimization parameter includes a first optimization coefficient, a second optimization coefficient, and a first enabling parameter strategy, and the target parameter of the KCP protocol is adjusted according to the target parameter and the first optimization parameter, including: obtaining an increase value corresponding to the first target parameter in the target parameter according to the first optimization coefficient. Determine the optimized first target parameter according to the increase value corresponding to the first target parameter and the first target parameter. Obtain a decrease value corresponding to the second target parameter in the target parameter according to the second optimization coefficient. Determine the optimized second target parameter according to the decrease value corresponding to the second target parameter and the second target parameter. Update the enabling parameter corresponding to the third target parameter in the target parameter according to the first enabling parameter strategy, so that the third target parameter is a closed parameter.
[0075] In the implementation manner of the present application, different parameters in the target parameters correspond to different optimization parameters. Some parameters need to increase parameter values to increase transmission efficiency, some parameters need to decrease parameter values to increase transmission efficiency, and some parameters need to be updated to increase transmission efficiency.
[0076] Exemplarily, the target parameters include a sending window parameter, a receiving window parameter, a sending time interval parameter, a retransmission mode enabling parameter, and a delayed data confirmation enabling parameter. The adjusting of the target parameters of the KCP protocol according to the target parameters and the first optimization parameters includes: determining the increase values corresponding to the sending window parameter and the receiving window parameter respectively according to the first optimization parameter. Determine the optimized sending window parameter and the optimized receiving window parameter according to the increase value corresponding to the sending window parameter, the increase value corresponding to the receiving window parameter, the sending window parameter, and the receiving window parameter. Determine the decrease value corresponding to the sending time interval parameter according to the second optimization coefficient. Determine the optimized sending time interval parameter according to the decrease value corresponding to the sending time interval parameter and the sending time interval parameter. Update the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the first enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is a closed parameter.
[0077] Among them, the sending window parameter and the receiving window parameter are used to control the value of data packets sent and the value of data packets received at the same time. Increasing the sending window parameter and the receiving window parameter can increase the value of data packets sent and the value of data packets received at the same time, thereby increasing the value of data packets transmitted.
[0078] Further, the first optimization parameter may be a preset ratio, and the increase value corresponding to the sending window parameter and the receiving window parameter is determined according to the product of the preset ratio and the current parameters of the sending window parameter and the receiving window parameter, and the optimized sending window parameter and the optimized receiving window parameter are determined according to the sum of the current parameters of the sending window parameter and the receiving window parameter and the increase value. The preset ratio may be 15% or 30%, and the preset ratio is not specifically limited herein.
[0079] The first optimization parameter may also be a preset increase value, which may correspond to the network state or may be a user-defined value. The determination of the preset increase value is not specifically limited herein.
[0080] The sending time interval parameter is used to control the sending interval of each data packet. Reducing the sending time interval can enable the next data packet to be transmitted in time after the transmission of one data packet is completed, thereby increasing the amount of data packets transmitted per unit time and thus improving transmission efficiency.
[0081] Further, the second optimization parameter can be a preset ratio or a preset reduction value. The setting method of the preset ratio and the preset reduction value can refer to the first optimization parameter, which will not be repeated here. The reduction value of the sending time interval parameter is determined according to the second optimization parameter, and then the optimized sending time interval parameter is determined according to the difference between the current parameter of the sending time interval parameter and the reduction value.
[0082] The retransmission mode is used to re-upload lost data packets, and the retransmission mode enable parameter is used to enable or disable the retransmission mode. The delayed data confirmation enable parameter means that in the case of network congestion, the delayed data confirmation enable parameter is set to enable and the transmitted data is confirmed. When the network status is stable, it indicates that the packet loss rate is low in the current network status, so the retransmission mode enable parameter is set to the closed parameter. And the current network status is stable, there is no need to confirm the delayed data, at this time, the delayed data confirmation enable parameter is set to the closed parameter.
[0083] In the implementation mode of the present application, when the current network state is stable, the sending window parameter and the receiving window parameter are increased to receive or send more data at the same time to improve the transmission rate under the current network state. The sending time interval parameter is reduced to improve the data transmission efficiency, thereby improving the transmission rate under the current network state. And setting the retransmission mode enabling parameter and the delayed data confirmation enabling parameter to the off parameter can reduce data retransmission and data confirmation time, and also improve data transmission efficiency.
[0084] If the current network state is congested, the second optimization parameter includes a third optimization coefficient, a fourth optimization coefficient and a second enabling parameter strategy, and if the current network state is congested, the service node of the first data center optimizes the target parameter of the current KCP protocol according to the target parameter and the second optimization parameter, including: if the current network state is congested, the service node of the first data center determines the reduction value corresponding to the sending window parameter and the receiving window parameter according to the third optimization parameter; the service node of the first data center determines the optimized sending window parameter and the optimized receiving window parameter according to the reduction value corresponding to the sending window parameter, the reduction value corresponding to the receiving window parameter, the sending window parameter and the receiving window parameter; the service node of the first data center determines the increase value corresponding to the sending time interval parameter according to the fourth optimization coefficient; the service node of the first data center determines the optimized sending time interval parameter according to the increase value corresponding to the sending time interval parameter and the sending time interval parameter; the service node of the first data center updates the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the second enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is an enabling parameter.
[0085] In the implementation manner of the present application, different parameters in the target parameters correspond to different optimization methods. Some parameters need to increase the parameter value to increase the transmission efficiency, some parameters need to reduce the parameter value to increase the transmission efficiency, and some parameters need to be set as an enabled parameter to reduce the transmission efficiency.
[0086] Exemplarily, the target parameters include a sending window parameter, a receiving window parameter, a sending time interval parameter, a retransmission mode enabling parameter, and a delayed data confirmation enabling parameter. The adjusting of the target parameters of the KCP protocol according to the target parameters and the second optimization parameters includes: determining the reduction values corresponding to the sending window parameter and the receiving window parameter respectively according to the third optimization parameter. Determine the optimized sending window parameter and the optimized receiving window parameter according to the reduction value corresponding to the sending window parameter, the reduction value corresponding to the receiving window parameter, the sending window parameter, and the receiving window parameter. Determine the increase value corresponding to the sending time interval parameter according to the fourth optimization coefficient. Determine the optimized sending time interval parameter according to the increase value corresponding to the sending time interval parameter and the sending time interval parameter. Update the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the second enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is an enabling parameter.
[0087] The detailed description of the third optimization parameter can refer to the second optimization parameter, and the detailed description of the fourth optimization parameter can also refer to the first optimization parameter, and the optimization method of the third optimization parameter on the parameter can be the same as or different from the optimization method of the second optimization parameter on the parameter. The optimization method of the fourth optimization parameter on the parameter can be the same as or different from the optimization method of the first optimization parameter on the parameter, and the optimization methods of the third optimization parameter and the fourth optimization parameter are specifically defined herein.
[0088] When the network status is congested, the packet loss rate increases and the retransmission mode needs to be enabled to retransmit the lost data packets in time. Therefore, the retransmission mode enable parameter needs to be set to the enable parameter. When the network status is congested, the delayed data needs to be confirmed multiple times. At this time, the delayed data confirmation enable parameter should also be determined as the enable parameter.
[0089] In the implementation mode of the present application, when the current network state is congested, the sending window parameter and the receiving window parameter are reduced so that less data is received or sent at the same time to reduce the transmission rate in the current network state. The sending time interval parameter is increased to reduce the data transmission efficiency, thereby reducing the transmission rate in the current network state. And the retransmission mode enabling parameter and the delayed data confirmation enabling parameter are set to the enabling parameter, so that the data packets lost during the data transmission process can be uploaded in time, and the data confirmation time can be increased, thereby reducing the data transmission efficiency.
[0090] Step S350: The business node of the first data center optimizes the target parameters of the current KCP protocol according to the optimization method corresponding to the target parameters, and uses the optimized current KCP protocol as the current KCP protocol.
[0091] In the embodiment of the present application, the transmission efficiency can be reduced by reducing the data packets received or sent at the same time. The reduction method can be to reduce the receiving window and / or the sending window so that the receiving window and the sending window can accommodate fewer data packets. The reduction method can also be to increase the time interval for data transmission, so that the number of data transmissions within the preset time length is reduced, thereby reducing the data packets. The method of reducing the data packets is not specifically limited here.
[0092] Step S360: The service node of the first data center transmits the second data to the service node of the second data center through the current KCP protocol.
[0093] For the detailed description of step S360, please refer to the detailed description of step S240 in the above embodiment, which will not be repeated here.
[0094] The solution provided in this embodiment determines the protocol parameters that need to be adjusted and the optimization methods corresponding to the protocol parameters according to the current network status, and adjusts the protocol parameters through the optimization methods corresponding to the protocol parameters, so that the rate of data transmission through the optimized protocol parameters is adapted to the current network status, avoiding the waste of network resources and improving the data transmission efficiency. Moreover, the current network status is determined based on the average packet loss rate, the standard deviation of the packet loss rate, the average network delay and the standard deviation of the network delay, which improves the accuracy of the current network status determination, and uses the optimized KCP protocol for data transmission between data centers, which can improve the data transmission efficiency between data centers.
[0095] See also Figure 8 , which shows a structural block diagram of a data transmission device 300 provided in an embodiment of the present application. The data transmission device 300 is applied to the electronic device 100, and the data transmission device 300 includes: a data transmission module 310, which is used for the service node on the first data center to transmit the target data to the service node on the second data center through the current reliable transmission KCP protocol.
[0096] In some embodiments of the present application, the target data includes first data and second data, and the transmission time of the first data is earlier than the transmission time of the second data, and the data transmission module 310 includes: a first data transmission submodule, which is used for the business node of the first data center to transmit the first data to the business node of the second data center through the current KCP protocol; a current network status acquisition submodule, which is used for the business node of the first data center to obtain the current network status of the first data during the transmission process; an optimization submodule, which is used for the business node of the first data center to optimize the current KCP protocol according to the current network status, and use the optimized current KCP protocol as the current KCP protocol, so that the transmission rate of the business node on the first data center for data transmission through the current KCP protocol is adapted to the current network status; a second data transmission submodule, which is used for the business node of the first data center to transmit the second data to the business node of the second data center through the current KCP protocol.
[0097] In some embodiments of the present application, the optimization submodule includes: an optimization parameter determination unit, which is used for the business node of the first data center, and determines the optimization parameters according to the current network status, wherein the optimization parameters include the target parameters to be adjusted in the protocol parameters of the KCP protocol and the optimization method corresponding to the target parameters; an optimization unit, which is used for the business node of the first data center, and optimizes the target parameters of the current KCP protocol according to the optimization method corresponding to the target parameters, and uses the optimized current KCP protocol as the current KCP protocol.
[0098] In some embodiments of the present application, the current network status determination submodule includes: a data acquisition unit, which is used for the service node on the first data center to obtain the current packet loss rate and the current network delay during this transmission process, the current packet loss rate is determined by the average packet loss rate and the standard deviation of the packet loss rate, and the current network delay is determined by the average network delay and the standard deviation of the network delay; a current network status determination unit, which is used to determine the current network status based on the current packet loss rate and the current network delay.
[0099] In some embodiments of the present application, the data acquisition unit includes: a data acquisition subunit, which is used for a business node on the first data center to obtain the packet loss rate corresponding to each unit time length within a preset time length during the data transmission of the first data, and the network delay corresponding to a preset number of data packets of the first data during the data transmission process; a packet loss data acquisition subunit, which is used to obtain the average packet loss rate and the standard deviation of the packet loss rate within the preset time length according to the packet loss rate corresponding to each unit time length within the preset time length; a current packet loss data determination subunit, which is used to determine the current packet loss rate according to the average packet loss rate and the standard deviation of the packet loss rate; a network delay data acquisition subunit, which is used to obtain the average network delay and the standard deviation of the network delay of the data packets according to the network delay corresponding to the preset number of data packets; a current network delay data determination subunit, which is used to determine the current network delay according to the average network delay and the standard deviation of the network delay.
[0100] In some embodiments of the present application, the optimization parameter determination unit includes: a first optimization parameter determination subunit, which is used for, if the current network state is stable, the service node of the first data center, to determine that the optimization parameter is a first optimization parameter, the first optimization parameter includes the target parameter and a first optimization method for increasing transmission efficiency; a second optimization parameter determination subunit, which is used for, if the current network state is congested, to determine that the optimization parameter is a second optimization parameter, the second optimization parameter includes the target parameter and a second optimization method for reducing transmission efficiency.
[0101] In some embodiments of the present application, the optimization unit includes: a first optimization subunit, which is used for, if the current network state is stable, the business node of the first data center, to optimize the target parameters of the current KCP protocol according to the target parameters and the first optimization parameters, and use the optimized current KCP protocol as the current KCP protocol; a second optimization subunit, which is used for, if the current network state is congested, the business node of the first data center, to optimize the target parameters of the current KCP protocol according to the target parameters and the second optimization parameters, and use the optimized current KCP protocol as the current KCP protocol.
[0102] In some embodiments of the present application, the first optimization parameter includes a first optimization coefficient, a second optimization coefficient and a first enabling parameter strategy, the target parameter includes a sending window parameter, a receiving window parameter, a sending time interval parameter, a retransmission mode enabling parameter and a delayed data confirmation enabling parameter, and the first optimization subunit includes a first added value determination component, which is used for the service node of the first data center to determine the added values corresponding to the sending window parameter and the receiving window parameter according to the first optimization parameter if the current network state is stable; the first window parameter optimization component is used for the service node of the first data center to determine the added values corresponding to the sending window parameter, the added values corresponding to the receiving window parameter, the sending window parameter and the receiving window parameter according to the added value corresponding to the sending window parameter, the added value corresponding to the receiving window parameter, the sending window parameter and the receiving window parameter. The optimized sending window parameter and the optimized receiving window parameter are determined; a first reduction value determination component is used for the business node of the first data center, and determines the reduction value corresponding to the sending time interval parameter according to the second optimization coefficient; a first time parameter optimization component is used for the business node of the first data center, and determines the optimized sending time interval parameter according to the reduction value corresponding to the sending time interval parameter and the sending time interval parameter; a first enabling parameter updating component is used for the business node of the first data center, and updates the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the first enabling parameter policy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is a closed parameter.
[0103] In some embodiments of the present application, the second optimization parameter includes a third optimization coefficient, a fourth optimization coefficient and a second enabling parameter strategy, and the second optimization subunit includes: a second reduction value determination unit, which is used for, if the current network state is congested, the service node of the first data center, respectively determines the reduction values corresponding to the sending window parameter and the receiving window parameter according to the third optimization parameter; a second window parameter optimization component, which is used for the service node of the first data center, to determine the optimized sending window parameter and the optimized receiving window parameter according to the reduction value corresponding to the sending window parameter, the reduction value corresponding to the receiving window parameter, the sending window parameter and the receiving window parameter; a second increase value determination component, which is used for the service node of the first data center, to determine the increase value corresponding to the sending time interval parameter according to the fourth optimization coefficient; a second time parameter optimization component, which is used for the service node of the first data center, to determine the optimized sending time interval parameter according to the increase value corresponding to the sending time interval parameter and the sending time interval parameter; a second enabling parameter updating component, which is used for the service node of the first data center, to update the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the second enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is an enabling parameter.
[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0105] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0106] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0107] A structural block diagram of an electronic device provided in an embodiment of the present application. Please refer to Figure 8, which shows a structural block diagram of an electronic device provided in an embodiment of the present application. The electronic device 100 can be an electronic device such as a computer, a server, etc. that can run an application. The electronic device 100 in the present application may include one or more of the following components: a processor 101, a memory 102, and one or more applications, wherein the one or more applications may be stored in the memory 102 and configured to be executed by one or more processors 101, and the one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0108] The processor 101 may include one or more processing cores. The processor 101 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 102, and calling data stored in the memory 102. Optionally, the processor 101 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 101 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless data transmission. It can be understood that the above-mentioned modem may not be integrated into the processor 101, and it can be implemented separately through a data transmission chip.
[0109] The memory 102 may include a random access memory (RAM) or a read-only memory (ROM). The memory 102 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 102 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0110] Please refer to Fig. 9, which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 200 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0111] The computer-readable storage medium 200 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 200 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 200 has storage space for program code 210 that performs any method steps of the above method. These program codes can be read from or written to one or more computer program products. The program code 210 can be compressed, for example, in an appropriate form.
[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data transmission method, characterized in that: Applied to a first data center and a second data center, both the first data center and the second data center are deployed with service nodes, and the first data center and the second data center are different data centers, the method includes: The service node on the first data center transmits the target data to the service node on the second data center through the current reliable transmission KCP protocol.
2. The method according to claim 1, characterized in that The target data includes first data and second data, and the transmission time of the first data is earlier than the transmission time of the second data, and the service node on the first data center transmits the target data to the service node on the second data center through the current reliable transmission KCP protocol, including: The service node of the first data center transmits the first data to the service node of the second data center through the current KCP protocol; The service node of the first data center obtains a current network status of the first data during transmission; The service node of the first data center optimizes the current KCP protocol according to the current network state, and uses the optimized current KCP protocol as the current KCP protocol, so that the transmission rate of data transmission by the service node on the first data center through the current KCP protocol is adapted to the current network state; The service node of the first data center transmits the second data to the service node of the second data center through the current KCP protocol.
3. The method according to claim 2, characterized in that The service node of the first data center optimizes the current KCP protocol according to the network state, and uses the optimized current KCP protocol as the current KCP protocol, including: The service node of the first data center determines, according to the current network state, an optimization parameter, where the optimization parameter includes a target parameter to be adjusted in the protocol parameters of the KCP protocol and an optimization method corresponding to the target parameter; The business node of the first data center optimizes the target parameters of the current KCP protocol according to the optimization method corresponding to the target parameters, and uses the optimized current KCP protocol as the current KCP protocol.
4. The method according to claim 2, characterized in that: The service node of the first data center obtains a current network status of the first data during transmission, including: The service node on the first data center obtains a current packet loss rate and a current network delay in the current transmission process, where the current packet loss rate is determined by an average packet loss rate and a standard deviation of the packet loss rate, and the current network delay is determined by an average network delay and a standard deviation of the network delay; The current network state is determined according to the current packet loss rate and the current network delay.
5. The method according to claim 4, characterized in that The service node on the first data center obtains the current packet loss rate and the current network delay during the current transmission process, including: The service node on the first data center obtains a packet loss rate corresponding to each unit time length within a preset time length during data transmission of the first data, and a network delay corresponding to a preset number of data packets of the first data during data transmission; According to the packet loss rate corresponding to each unit time length within the preset time length, an average packet loss rate and a standard deviation of the packet loss rate within the preset time length are obtained; Determine the current packet loss rate according to the average packet loss rate and the packet loss rate standard deviation; According to the network delays corresponding to the preset number of data packets, obtaining the average network delay and the network delay standard deviation of the data packets; The current network delay is determined according to the average network delay and the network delay standard deviation.
6. The method according to claim 3, characterized in that The service node of the first data center determines, according to the current network state, an optimization parameter, including: If the current network state is stable, the service node of the first data center determines that the optimization parameter is a first optimization parameter, where the first optimization parameter includes the target parameter and a first optimization method for increasing transmission efficiency; If the current network state is congested, the optimization parameter is determined to be a second optimization parameter, where the second optimization parameter includes a target parameter and a second optimization method for reducing transmission efficiency.
7. The method according to claim 6, characterized in that The service node of the first data center optimizes the target parameter of the current KCP protocol according to the optimization method corresponding to the target parameter, and uses the optimized current KCP protocol as the current KCP protocol, including: If the current network state is stable, the service node of the first data center optimizes the target parameter of the current KCP protocol according to the target parameter and the first optimization parameter, and uses the optimized current KCP protocol as the current KCP protocol; If the current network status is congested, the business node of the first data center optimizes the target parameters of the current KCP protocol according to the target parameters and the second optimization parameters, and uses the optimized current KCP protocol as the current KCP protocol.
8. The method according to claim 7, characterized in that The first optimization parameter includes a first optimization coefficient, a second optimization coefficient and a first enabling parameter strategy, the target parameter includes a sending window parameter, a receiving window parameter, a sending time interval parameter, a retransmission mode enabling parameter and a delayed data confirmation enabling parameter, and if the current network state is stable, the service node of the first data center optimizes the target parameters of the current KCP protocol according to the target parameters and the first optimization parameters, including: If the current network state is stable, the service node of the first data center determines, according to the first optimization parameter, the increase values corresponding to the sending window parameter and the receiving window parameter respectively; The service node of the first data center determines an optimized sending window parameter and an optimized receiving window parameter according to the increased value corresponding to the sending window parameter, the increased value corresponding to the receiving window parameter, the sending window parameter, and the receiving window parameter; The service node of the first data center determines, according to the second optimization coefficient, a reduction value corresponding to the sending time interval parameter; The service node of the first data center determines an optimized sending time interval parameter according to the reduction value corresponding to the sending time interval parameter and the sending time interval parameter; The business node of the first data center updates the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the first enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is a closed parameter.
9. The method according to claim 7, characterized in that: The second optimization parameter includes a third optimization coefficient, a fourth optimization coefficient, and a second enabling parameter strategy. If the current network state is congested, the service node of the first data center optimizes the target parameters of the current KCP protocol according to the target parameters and the second optimization parameters, including: If the current network state is congested, the service node of the first data center determines, according to the third optimization parameter, reduction values corresponding to the sending window parameter and the receiving window parameter respectively; The service node of the first data center determines an optimized sending window parameter and an optimized receiving window parameter according to the reduction value corresponding to the sending window parameter, the reduction value corresponding to the receiving window parameter, the sending window parameter, and the receiving window parameter; The service node of the first data center determines, according to the fourth optimization coefficient, an increase value corresponding to the sending time interval parameter; The service node of the first data center determines an optimized sending time interval parameter according to the increased value corresponding to the sending time interval parameter and the sending time interval parameter; The business node of the first data center updates the enabling parameters corresponding to the retransmission mode enabling parameter and the delayed data confirmation enabling parameter according to the second enabling parameter strategy, so that the retransmission mode enabling parameter is a closed parameter and the delayed data confirmation enabling parameter is an enabled parameter.
10. A data transmission device, characterized in that: Applied to a data center, the device comprises: A data transmission module is used for the service node on the first data center to transmit the target data to the service node on the second data center through the current reliable transmission KCP protocol.
11. An electronic device, characterized in that: The electronic device comprises: one or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 9.