Data transmission method and device, equipment, storage medium and program product
By obtaining network resource information in real time at the sending node, dynamically compute the MTU value and performing slice processing on the data, the problem of pre-setting of MTU value in the prior art is solved, and the data transmission quality is improved.
Patent Information
- Application Number
- CN202411720242.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-27
AI Technical Summary
In the data transmission process, due to the unstable network environment, the preset maximum transmission unit (MTU) is not suitable for the slice size after data packet segmentation, affecting the quality of data transmission.
By obtaining network resource information in real time at the sending node, dynamically calculate the MTU value adapted to the current network environment, and slice the data to be transmitted. The specific steps include obtaining network resource information according to the preset sampling frequency, calculating the target sampling frequency, calculating the MTU value based on the network resource information, and slicing the data according to the MTU value.
It realizes dynamic adjustment of MTU values according to the real-time network environment to ensure that the data slice size is adapted to the current network environment, thereby improving data transmission quality and reducing transmission delay and packet loss rate.
Smart Images

Figure CN119520425A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data transmission, and in particular, relates to a method, apparatus, device, storage medium and program product for data transmission. Background Art
[0002] During data transmission, in order to reduce transmission delay and packet loss rate, the sending node in the communication network can split a larger data packet into multiple smaller data slices and transmit the split slices.
[0003] Specifically, the sending node can segment the data packet according to the pre-configured Maximum Transmission Unit (MTU). However, since the network environment changes in real time, the network quality is unstable. If the pre-set MTU is used to segment the data packet, the resulting segmented slices may be too large or too small relative to the real-time network environment, resulting in poor data transmission quality. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device, storage medium and program product for data transmission, which can adjust the MTU value in real time to improve the quality of data transmission.
[0005] In a first aspect, an embodiment of the present application provides a method for data transmission, which is applied to a sending node, and the method includes:
[0006] Acquire network resource information of the sending node according to a preset sampling frequency, where the network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node according to the historical network resource information of the sending node;
[0007] Calculate the maximum transmission unit (MTU) value corresponding to the sending node according to the network resource information;
[0008] Slice the data to be transmitted according to the MTU to obtain a first data slice;
[0009] Send the first data slice to a receiving node.
[0010] In a possible implementation manner, after acquiring the network resource information of the sending node according to the preset sampling frequency, the method further includes:
[0011] According to the network resource information, calculating the target sampling frequency corresponding to the sending node;
[0012] The target sampling frequency is used as the preset sampling frequency.
[0013] In a possible implementation, the network resource information includes a packet loss rate and a central processing unit (CPU) usage rate; and calculating the target sampling frequency corresponding to the sending node according to the network resource information includes:
[0014] Calculate a reference sampling function according to the packet loss rate;
[0015] Calculating a sampling discount function according to the CPU usage;
[0016] The product of the reference sampling function and the sampling discount function is calculated to obtain the target sampling frequency.
[0017] In a possible implementation manner, calculating a reference sampling function according to the packet loss rate includes:
[0018] The reference sampling function is calculated according to the following formula:
[0019]
[0020] in, or,
[0021] Among them, T 1 (r) is the reference sampling function, r is the packet loss rate, t l is the lower limit threshold of the target sampling frequency, t u is the upper threshold of the target sampling frequency, It is the preset packet loss rate threshold.
[0022] In a possible implementation manner, calculating a sampling discount function according to the CPU usage rate includes:
[0023] The sampling discount function is calculated according to the following formula:
[0024]
[0025] Among them, T 2 (c) is the sampling discount function, c is the CPU usage rate, λ is the preset parameter, Indicates the preset CPU usage threshold.
[0026] In a possible implementation, the network resource information includes a packet loss rate, a central processing unit CPU usage rate, and a transmission delay; and calculating the maximum transmission unit MTU value corresponding to the sending node according to the network resource information includes:
[0027] Calculate a benchmark function according to the packet loss rate;
[0028] Calculating a first discount function according to the CPU usage rate;
[0029] Calculating a second discount function according to the transmission delay;
[0030] The product of the reference sampling function, the first discount function, and the second discount function is calculated to obtain the MTU value.
[0031] In a possible implementation manner, calculating a reference function according to the packet loss rate includes:
[0032] The benchmark function is calculated according to the following formula:
[0033]
[0034] Among them, M 1 (r) is the reference function, L represents the preset threshold, is the preset packet loss rate threshold, r is the packet loss rate, and U is the size of the data to be transmitted.
[0035] In a possible implementation manner, calculating the first discount function according to the CPU usage rate includes:
[0036] The first discount function is calculated according to the following formula:
[0037]
[0038] in, or
[0039] Among them, M 2 (c) is the first discount function, is the preset CPU usage threshold, and c is the CPU usage.
[0040] In a possible implementation manner, calculating the second discount function according to the transmission delay includes:
[0041] The second discount function is calculated according to the following formula:
[0042]
[0043]
[0044] Among them, M 3 (t) is the second discount function, and t is the transmission delay.
[0045] In a possible implementation, the number of the first data slices is multiple; after slicing the data to be transmitted according to the MTU to obtain data slices, the method further includes:
[0046] receiving a retransmission instruction fed back by the receiving node, wherein the retransmission instruction includes a target data slice identifier;
[0047] When the target data corresponding to the target data slice identifier is greater than the MTU value, slicing the target data corresponding to the target data slice identifier according to the MTU value to obtain a retransmitted data slice;
[0048] Sending the retransmitted data slice to the receiving node.
[0049] In a possible implementation, the method further includes:
[0050] Receiving multiple second data slices sent by other nodes other than the sending node in the network to which the sending node belongs;
[0051] Obtaining a data block identifier in each second data slice;
[0052] For each data block identifier, construct a storage queue and an aggregation queue corresponding to the data block identifier;
[0053] According to the data block identifier of each second data slice, storing the second data slice in a storage queue corresponding to the data block identifier;
[0054] For each storage queue, obtaining a slice identifier in each second data slice in the storage queue;
[0055] For each storage queue, storing the second data slices in the storage queue into the aggregation queue according to the order of the slice identifiers in each second data slice;
[0056] For each aggregation queue, obtaining information about the number of slices in the second data slice in the aggregation queue;
[0057] For each aggregation queue, when the slice quantity information is the same as the maximum value of the slice identifiers in the aggregation queue, the second data slices in the aggregation queue are aggregated to obtain transmission data.
[0058] In a second aspect, an embodiment of the present application provides a data transmission device, which is applied to a sending node, and the device includes:
[0059] an acquisition module, configured to acquire network resource information of the sending node according to a preset sampling frequency, wherein the network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node according to the historical network resource information of the sending node;
[0060] A calculation module, used to calculate the maximum transmission unit MTU value corresponding to the sending node according to the network resource information;
[0061] A slicing module, configured to slice the data to be transmitted according to the MTU to obtain a first data slice;
[0062] A sending module is used to send the first data slice to a receiving node.
[0063] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0064] When the processor executes the computer program instructions, it implements the method for data transmission as described in any one of the first aspects.
[0065] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method for data transmission as described in any one of the first aspects is implemented.
[0066] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the data transmission method as described in any one of the first aspects.
[0067] In a method, apparatus, device, storage medium and program product for data transmission according to an embodiment of the present application, a sending node obtains network resource information of the sending node according to a preset sampling frequency, wherein the network resource information can reflect the network quality corresponding to the network where the sending node is located, and then based on the network resource information, the MTU value corresponding to the sending node can be calculated. In this way, since the preset sampling frequency is calculated by the sending node based on historical network resource information, that is, the sending node dynamically updates the MTU value of the sending node according to the network resource information according to the preset sampling frequency. This ensures that the dynamically updated MTU value can meet the current network environment of the sending node. The sending node slices the data to be transmitted according to the calculated MTU value, and the size of the first data slice obtained meets the network environment where the current sending node is located, thereby improving the data transmission quality of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0069] Figure 1 It is a flowchart of a method for data transmission provided by an embodiment of the present application;
[0070] Figure 2 It is a flowchart of a method for calculating a preset sampling frequency provided by an embodiment of the present application;
[0071] Figure 3 is a function diagram of a benchmark sampling function provided in an embodiment of the present application;
[0072] Figure 4 is a function diagram of a sampling discount function provided in an embodiment of the present application;
[0073] Figure 5 is a function diagram of a benchmark function provided in an embodiment of the present application;
[0074] Figure 6 is a function diagram of a first discount function provided in an embodiment of the present application;
[0075] Figure 7 is a function diagram of a second discount function provided in an embodiment of the present application;
[0076] Figure 8 is an exemplary schematic diagram of a data slice provided in an embodiment of the present application;
[0077] Fig. 9 It is a flowchart of a method for data retransmission provided in an embodiment of the present application;
[0078] Fig.10 is an exemplary schematic diagram of a retransmitted data slice provided in an embodiment of the present application;
[0079] Fig.11 It is a flowchart of a method for data aggregation provided in an embodiment of the present application;
[0080] Fig.12 is an exemplary schematic diagram of a data aggregation method provided in an embodiment of the present application;
[0081] Fig.13 is an exemplary schematic diagram of another data aggregation method provided in an embodiment of the present application;
[0082] Fig.14 is an exemplary schematic diagram of a data transmission method provided in an embodiment of the present application;
[0083] Fig.15 This is a schematic diagram of a data transmission device provided in an embodiment of the present application.
[0084] Fig.16 It is a structural schematic diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0085] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0086] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0087] Currently, researchers pre-set the MTU value based on the network environment and device characteristics. The nodes in the communication network divide the large data packets according to the set MTU value, obtain data slices, and send the data slices through sequential transmission.
[0088] However, the transmission efficiency of sequential transmission is low, and the network environment of the communication network changes in real time. The fixed MTU value cannot be applied to the real-time changing network environment. When the network environment is unstable, the size of the data slice will be too large or too small compared to the current network environment. When the data slice is too small, the number of bytes occupied by the header information in the data slice accounts for a large proportion. When transmitting the same amount of data, the header information will occupy more network overhead, limiting the network throughput. When the data slice is too large, the number of data slices is small, which will lead to an increase in the retransmission rate of the data slice.
[0089] In order to solve the problems existing in the prior art, the embodiments of the present application provide a method, apparatus, device, storage medium and program product for data transmission. Figure 1 A data transmission method provided in an embodiment of the present application is introduced, and the method is applied to a sending node, such as Figure 1 As shown, the method includes:
[0090] S101. Acquire network resource information of a sending node according to a preset sampling frequency.
[0091] The network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node based on the historical network resource information of the sending node. The preset sampling frequency is used to represent the time interval for the sending node to obtain the network resource information.
[0092] Specifically, each time the sending node obtains network resource information, it calculates a preset sampling frequency according to the network resource information obtained this time, and then obtains the next network resource information according to the preset sampling frequency calculated this time. That is, each time the sending node obtains network resource information, it calculates the time interval for obtaining the next network resource information according to the network resource information obtained this time.
[0093] It should be noted that each node in the communication network is pre-set with a dynamic information collection module, and the dynamic information collection module can obtain network resource information according to a preset sampling frequency.
[0094] S102: Calculate the maximum transmission unit MTU value corresponding to the sending node according to the network resource information.
[0095] It can be understood that network resource information can characterize the network quality corresponding to the network to which the sending node belongs. Therefore, the MTU value calculated according to the currently acquired network resource information is suitable for the network environment in which the current sending node is located. Subsequent sending nodes transmit data according to the calculated MTU value, which can effectively improve the network transmission quality.
[0096] S103: Slice the data to be transmitted according to the MTU to obtain a first data slice.
[0097] S104. Send a first data slice to a receiving node.
[0098] Using the above method, the sending node obtains the network resource information of the sending node according to the preset sampling frequency, wherein the network resource information can reflect the network quality corresponding to the network where the sending node is located, and then according to the network resource information, the MTU value corresponding to the sending node can be calculated. In this way, since the preset sampling frequency is calculated by the sending node based on the historical network resource information, that is, the sending node dynamically updates the MTU value of the sending node according to the network resource information according to the preset sampling frequency. This ensures that the dynamically updated MTU value can meet the current network environment of the sending node. The sending node slices the data to be transmitted according to the calculated MTU value, and the size of the first data slice obtained meets the network environment where the current sending node is located, thereby improving the data transmission quality of the network.
[0099] With respect to the above S101, the network resource information of the sending node is obtained according to the preset sampling frequency. The dynamic information collection module can monitor the network devices in the network, obtain the parameters of each network device, and then calculate the network resource information according to the parameters.
[0100] In one example, the dynamic information collection module detects the total number of data packets sent by the sending node, the number of retransmitted data packets, the data packet sending time, and the data packet receiving time carried in the information returned by the receiving node, and the dynamic information collection module calculates the packet loss rate based on the total number of data packets and the number of retransmitted data packets. Specifically, Where a represents the number of retransmitted packets, and b represents the total number of packets sent by the sending node. The dynamic information collection module calculates the transmission delay through the packet sending time and the packet receiving time carried in the information returned by the receiving node. Specifically, transmission delay = cd, where c represents the packet receiving time and d represents the packet sending time.
[0101] It should be noted that the above preset sampling frequency is updated in real time by the sending node according to the acquired network resource information. Figure 2 Introduce the update method of preset sampling frequency, such as Figure 2 As shown, the method includes:
[0102] S201. Calculate the target sampling frequency corresponding to the sending node according to the network resource information.
[0103] S202: Use the target sampling frequency as the preset sampling frequency.
[0104] By adopting the method provided in the embodiment of the present application, the target sampling frequency is calculated based on the network resource information collected in real time, and then the preset sampling frequency is updated using the target sampling frequency. The preset sampling frequency can be adjusted in time to facilitate the subsequent timely collection of network resource information according to the preset sampling frequency, thereby realizing timely adjustment of the MTU value.
[0105] In some embodiments of the present application, the network resource information includes a packet loss rate and a central processing unit (CPU) usage rate. For the above S201, according to the network resource information, the target sampling frequency corresponding to the sending node is calculated, which can be specifically implemented as follows:
[0106] Step 1: Calculate the benchmark sampling function according to the packet loss rate.
[0107] It is understandable that the packet loss rate is an important indicator for measuring the quality of network transmission. When the packet loss rate increases, in order to ensure the quality of network transmission, the sampling frequency should be adjusted in time, network resource information should be collected, and the MTU value should be adjusted. When the packet loss rate increases, the sampling frequency should be reduced and the time interval for collecting network resource information should be shortened to ensure that the MTU value is adjusted in time, that is, the preset sampling frequency should be reduced as the packet loss rate increases, thereby reducing the time it takes for the sending node to restore a higher transmission throughput.
[0108] The benchmark sampling function is a monotonically non-increasing function of the packet loss rate, and the packet loss rate preferentially determines the time interval for the sending node to collect network resource information. Therefore, in order to ensure that the target sampling frequency fluctuates within a reasonable range, an upper threshold and a lower threshold are set for the benchmark sampling function. Specifically, when the packet loss rate is 0, the value of the benchmark sampling function is the preset upper threshold, and when the packet loss rate is 1, the value of the benchmark sampling function is the preset lower threshold.
[0109] In actual implementation, when the packet loss rate is higher than a certain threshold, it is considered a high packet loss rate. In order to ensure the quality of network transmission, the preset sampling frequency can be directly set to the preset lower limit threshold, so as to adjust the MTU value as soon as possible and improve the network transmission quality in time. In addition, the larger the threshold, the higher the tolerance of the network to the packet loss rate.
[0110] Specifically, the benchmark sampling function can be calculated according to the following formula:
[0111]
[0112] in, or,
[0113] Among them, T 1 (r) is the benchmark sampling function, r is the packet loss rate, t l is the lower threshold of the target sampling frequency, t u is the upper threshold of the target sampling frequency, It is the preset packet loss rate threshold.
[0114] It should be noted that the above two The function form can be determined according to actual business needs.
[0115] Specifically, the function graph of the above benchmark sampling function is as follows: Figure 3 As shown. Among them, the dotted line function graph is the above In the case of
[0116] The number of images is as above In the case of , the function graph of the benchmark sampling function. The value of the benchmark sampling function decreases as the packet loss rate increases. And, in the case where the packet loss rate is greater than the preset packet loss rate threshold, the sending node directly sets the benchmark sampling function to the lower limit threshold.
[0117] Step 2: Calculate the sampling discount function based on the CPU usage.
[0118] It is understandable that the preset sampling frequency is mainly affected by the packet loss rate, and in actual implementation, as the preset sampling frequency increases, the CPU usage of the sending node also increases, which will cause the CPU load to be too high. Therefore, after the benchmark sampling function is obtained by the above calculation, the sampling discount function is calculated based on the CPU usage to calibrate the benchmark sampling function.
[0119] The domain of the sampling discount function is the value range of CPU usage [0, 1], and the range is Furthermore, when the CPU usage is 1, the sampling discount function takes a value of 1; when the CPU usage is 0, the sampling discount function takes a value of When the CPU usage of the sending node is high, the value of the sampling discount function should be kept high. In this way, as the CPU usage of the sending node decreases, the sampling time interval can be appropriately reduced based on the time interval calculated by the benchmark sampling function.
[0120] Specifically, the sampling discount function can be calculated according to the following formula:
[0121]
[0122] Among them, T 2 (c) is the sampling discount function, c is the CPU usage, λ is the preset parameter, Indicates the preset CPU usage threshold.
[0123] It should be noted that the function graph of the sampling discount function is centrally symmetrical, and the central symmetrical point is the preset CPU usage threshold. When the CPU usage is less than the preset CPU usage threshold, the function graph shows a marginal decreasing trend; when the CPU usage is greater than the preset CPU usage threshold, the function graph shows a marginal decreasing growth trend.
[0124] In addition, the value of λ determines the steepness of the function graph of the sampling discount function, and the value of λ reflects the user's tolerance for the transmission task occupying the CPU resources of the sending node. That is, as λ gradually increases, the CPU usage rate approaches the threshold boundary, and the user's tolerance shows a trend of slowly decreasing to sharply decreasing, which leads to the discount effect increasing from slowly to sharply.
[0125] In actual implementation, users can calculate the value of λ according to actual needs, for example, by reversely solving the sampling discount function to obtain λ. In an example, The default value is 0.55. Set it to 0.3, set q to 0.3, and bring it into the above sampling discount function to solve for the value of λ. The specific calculation formula is as follows:
[0126]
[0127] In addition, the user may also calculate the value of λ by other solution methods, which is not limited in the embodiments of the present application.
[0128] Specifically, for different values of λ, the function graph of the calculated sampling discount function is as follows: Figure 4 As shown by Figure 4 It can be seen that as the value of λ increases, the steepness of the trend of the sampling discount function increases accordingly.
[0129] Step 3: Calculate the product of the benchmark sampling function and the sampling discount function to obtain the target sampling frequency.
[0130] Specifically, in Figure 3 and Figure 4 Based on the embodiment shown, the target sampling frequency is calculated as follows:
[0131] T(r,c)=T 1 (r)T 2 (c)
[0132] Among them, T(r,c) is the above target sampling frequency.
[0133] By using the method provided in the embodiment of the present application, the packet loss rate can reflect the data transmission quality between the sending node and the receiving node, and the CPU usage rate can reflect the computing performance of the sending node itself. And because the packet loss rate is the main indicator for measuring the quality of network transmission, the benchmark sampling function calculated by the packet loss rate can accurately reflect the data transmission performance in the current network environment, and then the sampling discount function calculated by the CPU usage rate can accurately reflect the optimal performance of the current sending node. Finally, by calculating the product of the benchmark sampling function and the sampling discount function, the target sampling frequency is obtained, which improves the accuracy of the calculation result.
[0134] In addition, when the dynamic information collection module collects network resource information, the collected network resource information is cached in time. In this way, in the event of a sudden network failure or subsequent network resource information collection failure, the sending node can use historical network resource information to calculate the target sampling frequency and subsequent MTU value.
[0135] In an example, the sending node may obtain historical network resource information in a preset time window, and then calculate the average of the historical network resource information, and use the average to calculate a preset sampling frequency and an MTU value.
[0136] In some embodiments of the present application, due to the limitation of the transport protocol layer, when the User Datagram Protocol (UDP) is used for data transmission, the number of bytes actually used to carry data in the protocol is 65507 bytes, and the upper limit of the MTU value is 65507. In addition, due to the limitation of the data link layer, when the size of the Internet Protocol (IP) data packet is larger than the maximum transmission unit of the link, the data packet is sliced into multiple smaller data segments at the IP layer, wherein the IP data packet of the sliced data segment is at most 1500 bytes of the maximum transmission unit of Ethernet, including a 20-byte IP header, so the number of bytes used by the IP data packet to carry data is 1480 bytes, and the lower limit of the MTU value is 1490. Therefore, the sending node can adjust between the upper and lower limits of the MTU value, and by adjusting the MTU value, it is suitable for the current network environment, thereby ensuring the quality of data transmission.
[0137] The network resource information includes packet loss rate, CPU usage rate and transmission delay. The above S102, based on the network resource information, calculates the maximum transmission unit MTU value corresponding to the sending node, which can be specifically implemented as follows:
[0138] Step A: Calculate the benchmark function according to the packet loss rate.
[0139] It should be noted that in the embodiment of the present application, the impact of packet loss rate, CPU usage rate and transmission delay on the MTU value is gradually reduced. Therefore, the sending node mainly determines the MTU value based on the packet loss rate.
[0140] It is understandable that in order to optimize the transmission throughput, when the packet loss rate is too large, the size of the transmitted data packet should be reduced, that is, the MTU value should be reduced. When the packet loss rate is too small, the MTU value should be increased.
[0141] When the MTU value is M 1 (r), the number of data slices obtained by the sending node after it splits the data according to the MTU value is Indicates rounding up.
[0142] For size M 1 (r), after the sending node slices the data packet, the transmission success rate of any data slice is 1-r, then the transmission success rate of the data packet without packet loss is Correspondingly, the expected packet loss rate of the sending node can be expressed as: Among them, r is the actual packet loss rate obtained.
[0143] In order to ensure the transmission throughput, the packet loss rate calculated above should be less than or equal to the preset packet loss rate threshold. In the case of f Greater than or equal to The sending node can directly adjust the MTU value to the lower limit threshold L, that is, M 1 (r) = L; when r ≤ r′, the packet size is U and the maximum number of slices is ), expected packet loss rate p f Less than or equal to The sending node can directly adjust the MTU value to the upper threshold, that is, 1 (r) = U. r' should satisfy:
[0144]
[0145] but In the case where the packet loss rate of the sending node is less than r′, the packet loss rate of the sending node is always less than the preset packet loss rate threshold.
[0146] In the present When M 1 (r) satisfies the following expression:
[0147]
[0148] The specific push process is as follows:
[0149]
[0150] in is the floor rounding function. To improve data transmission efficiency, let
[0151] Specifically, based on the above derivation process, the benchmark function can be expressed as:
[0152]
[0153] Among them, M 1 (r) is the benchmark function, L represents the MTU lower limit threshold, is the preset packet loss rate threshold, r is the packet loss rate, and U is the size of the data to be transmitted.
[0154] Specifically, the function graph of the above benchmark function is as follows: Figure 5 shown.
[0155] Step B: Calculate the first discount function according to the CPU usage.
[0156] The first discount function is a monotonically non-increasing function of CPU usage, with a domain of [0, 1] and a range of When the CPU usage is 0, the value of the first discount function is 1, and when the CPU usage is 1, the value of the first discount function is
[0157] Moreover, when the CPU usage is less than the preset CPU usage threshold, it indicates that the current sending node has sufficient computing resources, and the sending node can temporarily ignore the impact of the CPU usage on the MTU value. When the CPU usage is greater than or equal to the preset CPU usage threshold, and when the CPU usage initially increases, the MTU value is maintained at a high level to ensure network transmission throughput. When the CPU usage is high, the sending node quickly reduces the MTU value to reduce the resource occupation of other processes by data transmission.
[0158] Specifically, the first discount function can be calculated according to the following formula:
[0159]
[0160] in, or
[0161] Among them, M 2 (c) is the first discount function, is the preset CPU usage threshold, and c is the CPU usage.
[0162] Specifically, the above two The function form can be determined by the user according to actual business needs. Figure 6 As shown, Figure 6 The above two examples show The function graph of the first discount function in the case of the functional form of . Among them, the solid line function graph is In the case of , the function graph of the first discount function, the dotted function graph is Function graph of the first discount function in the case of .
[0163] Step C: Calculate a second discount function based on the transmission delay.
[0164] It can be understood that the second discount function is a monotone non-increasing function of the transmission delay, and its domain is the value range of the transmission delay [0, +∞], and its range is Since the instantaneous delay of message transmission is volatile, the sending node can determine the impact on the MTU value based on the relationship between the instantaneous delay and the average delay.
[0165] Specifically, the second discount function can be calculated according to the following formula:
[0166]
[0167] Among them, M 3 (t) is the second discount function, t is the transmission delay, is the average delay, clip is the clipping function, The value of is limited to to 1.
[0168] Specifically, the function graph of the second discount function is as follows Figure 7 shown.
[0169] Step D: Calculate the product of the reference sampling function, the first discount function, and the second discount function to obtain the MTU value.
[0170] Specifically, the formula for calculating the MTU value of the sending node is as follows:
[0171] M(r,c,t)=M 1 (r)M 2 (c)M 3 (t)
[0172] It can be understood that after obtaining the network resource information, that is, after obtaining the above-mentioned packet loss rate, CPU usage rate and transmission delay, the sending node adaptively and dynamically calculates the MTU value according to the network resource information.
[0173] By using the method provided in the embodiment of the present application, the packet loss rate can accurately reflect the quality of network transmission. Therefore, the benchmark function calculated by the packet loss rate can accurately reflect the optimal MTU value supported by the current network environment. The CPU usage rate can accurately reflect the computing performance of the sending node. Therefore, the first discount function calculated by the CPU usage rate can accurately reflect the optimal MTU value supported by the current sending node. The transmission delay can reflect the quality of network transmission to a certain extent. Therefore, the second discount function can reflect the impact of the transmission delay on the quality of network transmission in the current network environment. In this way, by calculating the product of the benchmark sampling function, the first discount function and the second discount function, the MTU value is obtained, which improves the accuracy of the calculation result.
[0174] For the above S103, the data to be transmitted is sliced according to the MTU to obtain the first data slice. The sending node divides the data packet of the data to be transmitted into multiple data slices, and each data slice is a Frame, wherein the protocol header information in the Frame occupies 8 bytes. Therefore, the transmission data actually effectively carried in each Frame is (MTU value - 8) bytes.
[0175] It should be noted that the header information of the above Frame includes the data packet identifier (BlockID), the number of data slices (TotalNumber), the data slice sequence number (FrameID), the data slice data volume (FrameSize) and the type information (maxSliceIndex).
[0176] After the sending node slices the data to be transmitted according to the MTU value, the first data slice obtained by slicing is sent to the receiving node through the sending queue. Figure 8 As shown, Figure 8 Three data packets are shown as an example, namely Block 1, Block 2 and Block 3. After the sending node slices Block 1, data slices 1:1, 1:2 and 1:3 are obtained, wherein data slice 1:1 represents the first data slice of Block 1, data slice 1:2 represents the second data slice of Block 1, and data slice 1:3 represents the third data slice of Block 1.
[0177] After the sending node slices Block2, data slices 2:1, data slices 2:2 and data slices 2:3 are obtained; after the sending node slices Block3, data slices 3:1, data slices 3:2 and data slices 3:3 are obtained.
[0178] in, Figure 8The information included in the data slice 1 is exemplarily shown. The BlockID of the data slice 1 is 1, the FrameID is 1, the FrameSize is xxx, the TotalNumber is xxx, the FrameHeader and the FrameBody.
[0179] After the sending node obtains the data slice through the slicing process, the sending node pushes the data slice into the sending queue, and transmits the data slice in parallel through multiple sending queues to ensure data transmission efficiency. In this way, the parallel transmission mechanism can also be used to transmit multiple data packets at the same time, thereby effectively improving transmission flexibility and transmission efficiency. New data packets can also be added to the sending node according to actual business needs, thereby improving system resource utilization and reducing thread waiting time.
[0180] It should be noted that the number of data slices obtained by the sending node according to the calculated MTU value slice processing is multiple. During the data slice transmission process, packet loss may occur, and the sending node needs to retransmit the lost data slice. Fig. 9 As shown, after the above S104, sending the first data slice to the receiving node, the method further includes:
[0181] S901: Receive a retransmission instruction fed back by a receiving node.
[0182] The retransmission instruction includes a target data slice identifier.
[0183] Specifically, after receiving the data slice, the receiving node extracts the header information of the data slice, uses the header information to verify the data carried in the data slice, and stores the target data slice identifier of the data slice in the retransmission instruction for the data slice that fails the verification. For the data slice that passes the verification, it is stored locally, and after waiting for the subsequent reception of the full data slice corresponding to the data packet, data aggregation is performed to obtain the data to be transmitted.
[0184] It should be noted that the embodiment of the present application does not limit the method for verifying data slices.
[0185] S902: When the target data corresponding to the target data slice identifier is larger than the MTU value, the target data corresponding to the target data slice identifier is sliced according to the MTU value to obtain a retransmitted data slice.
[0186] Specifically, the method of slicing the target data is as follows: Fig.10 As shown, the sending node obtains the total amount of data in the Frame from the packet header information of the target data, and then determines the size of the total amount of data and the MTU value. When the total amount of data is greater than the MTU value, the Frame is sliced according to the MTU value to obtain the following Fig.10The multiple SliceBodys shown in the figure are assigned a SliceID to each Slice in the slicing order.
[0187] The amount of data in each SliceBody is (MTU value - 8), and the calculated amount of data in each SliceBody is 10,000 bytes. The amount of data in the last SliceBody is 1,168 bytes. The header information of each Slice includes the FrameID to which the data slice belongs, the data size SliceSize, and the sequence number SliceID.
[0188] In another embodiment of the present application, when the target data corresponding to the target data slice identifier is smaller than the MTU value, the sending node directly sends the target data to the receiving node.
[0189] It is understandable that the MTU value in the sending node changes in real time. Therefore, when the target data is retransmitted, the MTU value of the current sending node may have changed, and the target data is sliced and retransmitted according to the MTU value of the current sending node.
[0190] S903. Send the retransmitted data slice to the receiving node.
[0191] Using the method provided in the embodiment of the present application, after receiving the retransmission instruction, the sending node obtains the corresponding target data according to the target data slice identifier in the retransmission instruction. Then, when the target data is larger than the MTU value, the sending node cannot directly transmit the target data, so the target data is sliced according to the MTU value, thereby sending the retransmitted data slice to the receiving node. In this way, the integrity of the data packet received by the receiving node is guaranteed, so that the receiving node can obtain the original data packet by aggregating the received data slices, thereby ensuring the accuracy of data transmission.
[0192] In some embodiments of the present application, other nodes in the communication network to which the sending node belongs can send data to the sending node. Fig.11 This paper introduces the process of aggregating data to obtain the original data packet after the sending node receives the data. Fig.11 As shown, the method includes:
[0193] S1101. Receive multiple second data slices sent by other nodes except the sending node in the network to which the sending node belongs.
[0194] It should be noted that any node in the network can serve as a sending node or a receiving node, that is, any node in the network can send data to other nodes or receive data sent by other nodes.
[0195] S1102: Obtain a data block identifier in each second data slice.
[0196] Among them, the header information in the data slice includes a data block identifier.
[0197] S1103: For each data block identifier, construct a storage queue and an aggregation queue corresponding to the data block identifier.
[0198] After receiving the second data slice, the sending node extracts the packet header information in the second data slice to obtain the data block identifier, and traverses the locally stored storage queues and aggregation queues, wherein each storage queue and aggregation queue corresponds to a data block identifier. If the data block identifier of the second data slice is not found in the data block identifiers corresponding to the locally stored storage queues, a storage queue and aggregation queue corresponding to the data block identifier of the second data slice are constructed.
[0199] When the data block identifier of the second data slice is found in the data block identifiers corresponding to the locally stored storage queue, the second data slice is stored in the corresponding storage queue.
[0200] S1104. According to the data block identifier of each second data slice, store the second data slice in a storage queue corresponding to the data block identifier.
[0201] S1105. For each storage queue, obtain a slice identifier in each second data slice in the storage queue.
[0202] It should be noted that, since other nodes in the network transmit the second data slices using a parallel transmission method, the sending node stores multiple second data slices in the storage queue in the time sequence of receiving the second data slices.
[0203] S1106. For each storage queue, store the second data slices in the storage queue into the aggregation queue according to the order of the slice identifiers in each second data slice.
[0204] Wherein, the second data slices are sequentially stored in the aggregation queue.
[0205] S1107. For each aggregation queue, obtain information about the number of slices in the second data slice in the aggregation queue.
[0206] Specifically, Fig.12 As shown, Fig.12 An exemplary schematic diagram of a storage queue and an aggregation queue provided in an embodiment of the present application.
[0207] After acquiring the second data slice, the sending node stores the second data slice in a storage queue corresponding to the data block identifier according to the data block identifier in the data slice. If the current sending node has not constructed a storage queue corresponding to the data block identifier, the sending node constructs a storage queue and an aggregation queue corresponding to the data block identifier, and stores the second data slice in the storage queue.
[0208] Furthermore, the sending node obtains the slice identifier of each data slice in the storage queue, and then compares the slice identifier with the expected identifier of the aggregation queue. When the slice identifier and the expected identifier of the storage queue are the same, the data slice corresponding to the slice identifier is stored in the aggregation queue.
[0209] The expected identifier of the aggregation queue is the slice identifier of the data slice at the top of the current queue plus one. When no data slice has been stored in the aggregation queue, the expected identifier of the storage queue is 1.
[0210] like Fig.12 As shown, the storage queue stores multiple data slices in the order in which the sending node receives the second data slice, wherein: Fig.12 The example shows that the order of the data slices stored in the storage queue is data slice 1: 1, data slice 1: 2, data slice 1: 5, data slice 1: 6, data slice 1: 8, data slice 1: 3, data slice 1: 4 and data slice 1: 7. The data slices are stored in the aggregation queue in the order of the slice identifiers, and the order from the head to the end of the queue is data slice 1: 1 to data slice 1: 8.
[0211] S1108. For each aggregation queue, when the slice quantity information and the maximum value of the slice identifiers in the aggregation queue are the same, aggregate the second data slices in the aggregation queue to obtain transmission data.
[0212] like Fig.13 As shown, the sending node follows Fig.12 The method provided in the embodiment stores the data slices in the storage queue into the aggregation queue. When the slice identifier of the aggregation queue and the slice quantity information in the second data slice are the same, it means that the aggregation queue stores the full data slices of the data packet. The sending node aggregates each aggregation queue to obtain the original transmission data.
[0213] Specifically, Fig.13 Three storage queues and three aggregation queues are exemplarily shown.
[0214] When the slice identifiers of the data slices in the aggregation queue and the slice quantity information in the slice identifiers are the same, the data slices in the aggregation queue are aggregated.
[0215] Using the method provided in the embodiment of the present application, the sending node constructs a storage queue and an aggregation queue for each data block identifier, and after receiving the second data slice, the data slice is stored in the corresponding storage queue according to the data block identifier of the second data slice, and then stored in the aggregation queue in sequence according to the order of the slice identifiers in the data slice. In this way, the aggregation queue stores data slices arranged in the order of slice identifiers, and then the sending node traverses the slice identifiers in the aggregation queue. When the maximum value of the slice identifier and the number of slices are the same, it means that the sending node has received the full amount of data slices corresponding to the data block identifier, so that the data slices in the aggregation queue are finally aggregated to obtain the transmission data sent by other nodes, thereby ensuring the integrity of the data.
[0216] It should be noted that, when the second data slice is retransmitted data, and the retransmitted data is obtained after being sliced and processed by other nodes according to the current MTU value, the slice identifier of the retransmitted data includes FrameID and SliceID. Among them, the data packet corresponding to SliceID is a sub-data packet of the data packet corresponding to FrameID. The sending node constructs a storage queue and an aggregation queue for each SliceID, and then aggregates the data packet corresponding to FrameID based on the aggregation method in the above embodiment, and then stores the data packet corresponding to FrameID as a data slice in the storage queue corresponding to FrameID, and then aggregates the transmission data using the aggregation method in the above embodiment.
[0217] The following combination Fig.14 Introduces the complete process of slicing and parallel transmission of big data, such as Fig.14 As shown, the method includes:
[0218] S1401. Configure the initial MTU value.
[0219] The user sets the MTU value to the maximum value under the current network quality in advance according to the current network quality and device parameters to reduce network transmission overhead.
[0220] Specifically, the theoretical upper limit of the data volume of a UDP data packet is 65535 bytes. Since the message header of a data packet occupies 8 bytes and the message header of an IP packet occupies 20 bytes, the initial MTU value can be set to (65535-8-20=65507) bytes. In this way, the transmission throughput can be maximized.
[0221] S1402. Configure the MTU value of the transport protocol layer.
[0222] S1403: Collect network and resource information.
[0223] The network and resource information refers to the network resource information in the above-mentioned embodiment.
[0224] S1404. Calculate the MTU value for different network environments.
[0225] Specifically, the method for calculating the MTU value refers to the relevant description in the above embodiment, which will not be repeated here.
[0226] S1405. The sending node configures the data packet size.
[0227] The data packet is the data slice in the above embodiment.
[0228] S1406: Is it the first time to send?
[0229] If yes, execute S1407, if no, execute S1408.
[0230] S1407: Divide the data packet into Frames according to the MTU value.
[0231] S1408: Is the frame larger than the MTU value?
[0232] If yes, execute S1409, if no, execute S1410.
[0233] S1409: Divide the frame into slices according to the MTU value.
[0234] S1410, adding the data packet to the sending queue.
[0235] S1411. Send data packets in parallel.
[0236] S1412: The receiving node receives the data packet.
[0237] Specifically, the packet header information of the data packet includes maxSliceIndex, and the receiving node determines the type of the data packet according to the value of maxSliceIndex. When the value of maxSliceIndex is 0, it indicates that the type of the data packet is Frame, and when the value of maxSliceIndex is not 0, it indicates that the type of the data packet is Slice.
[0238] S1413: Check whether the data packet is successfully verified.
[0239] If yes, execute S1414, if no, execute S1415.
[0240] S1414: Process sub-data packets.
[0241] Specifically, when the receiving node successfully verifies the data packet, the receiving node stores the received data packet in a corresponding storage queue.
[0242] S1415. Return information if the build fails.
[0243] When the receiving node fails to verify the data packet, the receiving node constructs an acknowledgment (ACK) message including the FrameID and SliceID, so that the sending node can retransmit the corresponding data packet according to the FrameID and SliceID in the ACK message.
[0244] S1416: Whether the sub-packet is lost.
[0245] If yes, execute S1415, if no, execute S1417.
[0246] S1417: Aggregate sub-data packets.
[0247] Specifically, the method of aggregating data slices using the storage queue and the aggregation queue refers to the relevant description in the above embodiment, which will not be repeated here.
[0248] S1418. The sending node obtains the corresponding sub-data packet according to the failure return information.
[0249] The sub-data packet is the target data in the above embodiment.
[0250] Using the method provided in the embodiment of the present application, the sending node collects network resource information and promptly modifies the MTU value based on the collected network resource information so that the modified MTU value is more suitable for the current network environment. Then the sending node divides the data packet according to the modified MTU value to obtain multiple data slices, and sends the data slices to the receiving node through parallel transmission, thereby improving the data transmission efficiency. After receiving the data slices, the receiving node verifies the data slices, and if the verification passes, aggregates the data slices to obtain complete transmission data. In this way, the reliability and accuracy of data transmission are improved.
[0251] Based on the same concept, a data transmission device is applied to a sending node, such as Fig.15 As shown, the device comprises:
[0252] An acquisition module 1501 is used to acquire network resource information of the sending node according to a preset sampling frequency, where the network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node according to the historical network resource information of the sending node;
[0253] A calculation module 1502 is used to calculate the maximum transmission unit MTU value corresponding to the sending node according to the network resource information;
[0254] A slicing module 1503, configured to slice the data to be transmitted according to the MTU to obtain a first data slice;
[0255] The sending module 1504 is used to send the first data slice to a receiving node.
[0256] In a possible implementation, the device further includes:
[0257] A calculation module 1502 is used to calculate a target sampling frequency corresponding to the sending node according to the network resource information;
[0258] A determination module is used to use the target sampling frequency as the preset sampling frequency.
[0259] In a possible implementation, the network resource information includes a packet loss rate and a central processing unit CPU usage rate; the calculation module 1502 is specifically used to:
[0260] Calculate a reference sampling function according to the packet loss rate;
[0261] Calculating a sampling discount function according to the CPU usage;
[0262] The product of the reference sampling function and the sampling discount function is calculated to obtain the target sampling frequency.
[0263] In a possible implementation, the calculation module 1502 is specifically configured to:
[0264] The reference sampling function is calculated according to the following formula:
[0265]
[0266] in, or,
[0267] Among them, T 1 (r) is the reference sampling function, r is the packet loss rate, t l is the lower limit threshold of the target sampling frequency, t u is the upper threshold of the target sampling frequency, It is the preset packet loss rate threshold.
[0268] In a possible implementation, the calculation module 1502 is specifically configured to:
[0269] The sampling discount function is calculated according to the following formula:
[0270]
[0271] Among them, T 2 (c) is the sampling discount function, c is the CPU usage rate, λ is the preset parameter, Indicates the preset CPU usage threshold.
[0272] In a possible implementation, the network resource information includes a packet loss rate, a CPU usage rate, and a transmission delay; the calculation module 1502 is specifically configured to:
[0273] Calculate a benchmark function according to the packet loss rate;
[0274] Calculating a first discount function according to the CPU usage rate;
[0275] Calculating a second discount function according to the transmission delay;
[0276] The product of the reference sampling function, the first discount function, and the second discount function is calculated to obtain the MTU value.
[0277] In a possible implementation, the calculation module 1502 is specifically configured to:
[0278] The benchmark function is calculated according to the following formula:
[0279]
[0280] Among them, M 1 (r) is the benchmark function, L represents the MTU lower limit threshold, is the preset packet loss rate threshold, r is the packet loss rate, and U is the size of the data to be transmitted.
[0281] In a possible implementation, the calculation module 1502 is specifically configured to:
[0282] The first discount function is calculated according to the following formula:
[0283]
[0284] in, or
[0285] Among them, M 2 (c) is the first discount function, is the preset CPU usage threshold, and c is the CPU usage.
[0286] In a possible implementation, the calculation module 1502 is specifically configured to:
[0287] The second discount function is calculated according to the following formula:
[0288]
[0289] Among them, M 3 (t) is the second discount function, and t is the transmission delay.
[0290] In a possible implementation manner, the number of the first data slices is multiple; and the device further includes:
[0291] A receiving module, configured to receive a retransmission instruction fed back by the receiving node, wherein the retransmission instruction includes a target data slice identifier;
[0292] The slicing module 1503 is further configured to, when the target data corresponding to the target data slice identifier is larger than the MTU value, slice the target data corresponding to the target data slice identifier according to the MTU value to obtain a retransmitted data slice;
[0293] The sending module 1504 is further configured to send the retransmitted data slice to the receiving node.
[0294] In a possible implementation, the device further includes:
[0295] A receiving module, used to receive multiple second data slices sent by other nodes other than the sending node in the network to which the sending node belongs;
[0296] The acquisition module 1501 is further used to acquire a data block identifier in each second data slice;
[0297] A construction module, used for constructing a storage queue and an aggregation queue corresponding to each data block identifier;
[0298] A storage module, configured to store the second data slice in a storage queue corresponding to the data block identifier of each second data slice according to the data block identifier of the second data slice;
[0299] The acquisition module 1501 is further configured to acquire, for each storage queue, a slice identifier in each second data slice in the storage queue;
[0300] The storage module is further configured to store, for each storage queue, the second data slices in the storage queue into the aggregation queue according to the order of the slice identifiers in each second data slice;
[0301] The acquisition module 1501 is further configured to acquire, for each aggregation queue, information about the number of slices in the second data slice in the aggregation queue;
[0302] The aggregation module is used to aggregate the second data slices in each aggregation queue to obtain transmission data when the slice quantity information is the same as the maximum value of the slice identifier in the aggregation queue.
[0303] It should be noted that the data transmission device is a device corresponding to the above-mentioned method for data transmission applied to the sending node. All implementation methods in the above-mentioned method embodiments are applicable to the embodiments of the device and can achieve the same technical effects.
[0304] Fig.16 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0305] The electronic device may include a processor 1601 and a memory 1602 storing computer program instructions.
[0306] Specifically, the processor 1601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0307] Memory 1602 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 1602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 1602 may include removable or non-removable (or fixed) media. In appropriate cases, memory 1602 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, memory 1602 is a non-volatile solid-state memory.
[0308] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0309] The processor 1601 implements any one of the data transmission methods in the above embodiments by reading and executing computer program instructions stored in the memory 1602 .
[0310] In one example, the electronic device may further include a communication interface 1603 and a bus 1604. Fig.16 As shown, the processor 1601, the memory 1602, and the communication interface 1603 are connected via a bus 1604 and communicate with each other.
[0311] The communication interface 1603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0312] Bus 1604 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1604 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0313] In addition, in combination with the data transmission method in the above embodiment, the embodiment of the present application can provide a computer storage medium to implement. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the data transmission methods in the above embodiment is implemented.
[0314] In combination with the data transmission method in the above embodiments, an embodiment of the present application may provide a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any data transmission method in the above embodiments.
[0315] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0316] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0317] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0318] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0319] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for data transmission, characterized in that: Applied to a sending node, the method comprises: Acquire network resource information of the sending node according to a preset sampling frequency, where the network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node according to the historical network resource information of the sending node; Calculate the maximum transmission unit (MTU) value corresponding to the sending node according to the network resource information; Slice the data to be transmitted according to the MTU to obtain a first data slice; Send the first data slice to a receiving node.
2. The method according to claim 1, characterized in that After acquiring the network resource information of the sending node according to the preset sampling frequency, the method further includes: According to the network resource information, calculating the target sampling frequency corresponding to the sending node; The target sampling frequency is used as the preset sampling frequency.
3. The method according to claim 2, characterized in that The network resource information includes a packet loss rate and a central processing unit CPU usage rate; the calculating the target sampling frequency corresponding to the sending node according to the network resource information includes: Calculate a reference sampling function according to the packet loss rate; Calculating a sampling discount function according to the CPU usage; The product of the reference sampling function and the sampling discount function is calculated to obtain the target sampling frequency.
4. The method according to claim 3, characterized in that The calculating a reference sampling function according to the packet loss rate comprises: The reference sampling function is calculated according to the following formula: in, or, Wherein, T1(r) is the reference sampling function, r is the packet loss rate, t l is the lower limit threshold of the target sampling frequency, t u is the upper threshold of the target sampling frequency, It is the preset packet loss rate threshold.
5. The method according to claim 3, characterized in that: The calculating of the sampling discount function according to the CPU usage rate comprises: The sampling discount function is calculated according to the following formula: Wherein, T2(c) is the sampling discount function, c is the CPU usage rate, λ is the preset parameter, Indicates the preset CPU usage threshold.
6. The method according to claim 1, characterized in that The network resource information includes a packet loss rate, a CPU usage rate, and a transmission delay; and the calculating, based on the network resource information, a maximum transmission unit MTU value corresponding to the sending node includes: Calculate a benchmark function according to the packet loss rate; Calculating a first discount function according to the CPU usage rate; Calculating a second discount function according to the transmission delay; The product of the reference function, the first discount function, and the second discount function is calculated to obtain the MTU value.
7. The method according to claim 6, characterized in that The calculating a reference function according to the packet loss rate comprises: The benchmark function is calculated according to the following formula: Wherein, M1(r) is the reference function, L represents the MTU lower limit threshold, is the preset packet loss rate threshold, r is the packet loss rate, and U is the size of the data to be transmitted.
8. The method according to claim 6, characterized in that The calculating a first discount function according to the CPU usage rate comprises: The first discount function is calculated according to the following formula: in, or Wherein, M2(c) is the first discount function, is the preset CPU usage threshold, and c is the CPU usage.
9. The method according to claim 6, characterized in that The calculating a second discount function according to the transmission delay comprises: The second discount function is calculated according to the following formula: Among them, M3(t) is the second discount function, and t is the transmission delay.
10. The method according to claim 1, characterized in that The number of the first data slices is multiple; after slicing the transmission data according to the MTU to obtain data slices, the method further includes: receiving a retransmission instruction fed back by the receiving node, wherein the retransmission instruction includes a target data slice identifier; When the target data corresponding to the target data slice identifier is greater than the MTU value, slicing the target data corresponding to the target data slice identifier according to the MTU value to obtain a retransmitted data slice; Sending the retransmitted data slice to the receiving node.
11. The method according to claim 1, characterized in that: The method further comprises: Receiving multiple second data slices sent by other nodes other than the sending node in the network to which the sending node belongs; Obtaining a data block identifier in each second data slice; For each data block identifier, construct a storage queue and an aggregation queue corresponding to the data block identifier; According to the data block identifier of each second data slice, storing the second data slice in a storage queue corresponding to the data block identifier; For each storage queue, obtaining a slice identifier in each second data slice in the storage queue; For each storage queue, storing the second data slices in the storage queue into the aggregation queue according to the order of the slice identifiers in each second data slice; For each aggregation queue, obtaining information about the number of slices in the second data slice in the aggregation queue; For each aggregation queue, when the slice quantity information is the same as the maximum value of the slice identifiers in the aggregation queue, the second data slices in the aggregation queue are aggregated to obtain transmission data.
12. A data transmission device, characterized in that: Applied to a sending node, the device comprises: an acquisition module, configured to acquire network resource information of the sending node according to a preset sampling frequency, wherein the network resource information is used to characterize the network quality corresponding to the network to which the sending node belongs, and the preset sampling frequency is calculated by the sending node according to the historical network resource information of the sending node; A calculation module, used to calculate the maximum transmission unit MTU value corresponding to the sending node according to the network resource information; A slicing module, configured to slice the data to be transmitted according to the MTU to obtain a first data slice; A sending module is used to send the first data slice to a receiving node.
13. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for data transmission according to any one of claims 1 to 11 is implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for data transmission according to any one of claims 1 to 11 is implemented.
15. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the data transmission method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Traffic sampling method, device and equipment and readable storage medium
CN114285773A
Data transmission method and equipment
CN117834549A
Method and apparatus for controlling data transmission, and storage medium
WO2021042831A1
Machine learning and rule matching integrated security detection method and device
WO2021082339A1