Bandwidth detection method, device, electronic device and storage medium
By dynamically adjusting the target bandwidth value and detection period, and flexibly detecting the bandwidth status of the network link, the problem of single bandwidth detection method in the prior art is solved, and network link bandwidth and data transmission efficiency are improved.
Patent Information
- Application Number
- CN202210939753.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-05
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-08-05
AI Technical Summary
The bandwidth detection method of existing network links is relatively single, and it cannot adapt to network link changes, resulting in an increase in unnecessary bandwidth detection and affecting data transmission efficiency.
A flexible detection strategy is adopted to dynamically detect the network link bandwidth status by adjusting the target bandwidth value and detection period to reduce unnecessary bandwidth detection.
It achieves rapid improvement of network link bandwidth, reduces unnecessary bandwidth detection, and improves data transmission efficiency.
Smart Images

Figure CN115348196B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of data transmission, and in particular to a bandwidth detection method, device, electronic device and storage medium. Background Art
[0002] With the advancement of technology, watching online videos through various applications and digital TV is a common phenomenon in today's society. To play online videos, the sender must first complete the encoding, package the data, and then send it to the receiver at a certain bit rate. The receiver then unpacks the data, frames and decodes it before playing it.
[0003] The rate of transmitting video data is closely related to the bandwidth of the network link. Generally, it is necessary to detect the bandwidth of the network link, and then the congestion control algorithm adjusts the bandwidth of the network link based on the result of the bandwidth detection to improve the data transmission capacity of the network link. GCC (Google Congest Control) is a congestion control algorithm commonly used in video data transmission, which is used to control the data transmission rate and avoid network link congestion.
[0004] The inventors have found that the existing bandwidth detection method of network links is relatively simple and cannot adapt to changes in network links, resulting in unnecessary bandwidth detection. Summary of the invention
[0005] The present invention provides a bandwidth detection method, device, electronic device and storage medium, which adopts a relatively flexible detection strategy to quickly improve the bandwidth of a network link, increase the detection of the bandwidth status in the network link, and can adjust the bandwidth detection period, thereby reducing unnecessary bandwidth detection.
[0006] In a first aspect, an embodiment of the present invention provides a bandwidth detection method, including:
[0007] In the first detection phase, detection data packets are sent to the network link in sequence based on the corresponding first target bandwidth value to detect the first current bandwidth of the network link. The first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained in the previous detection and the initial detection coefficient;
[0008] In the second detection phase, the bandwidth status of the network link is detected;
[0009] The bandwidth detection period of the network link is dynamically adjusted according to the bandwidth status, and a detection data packet is periodically sent to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. The first detection in the second detection phase uses the second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained by the previous detection and the preset detection value.
[0010] In a second aspect, an embodiment of the present invention provides a bandwidth detection device, including:
[0011] A first detection unit is used to send detection data packets to the network link in a first detection phase in sequence based on the corresponding first target bandwidth value to detect a first current bandwidth of the network link, wherein the first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained in the previous detection and the initial detection coefficient;
[0012] A detection unit, used to detect the bandwidth status of the network link in the second detection phase;
[0013] The second detection unit is used to dynamically adjust the bandwidth detection period of the network link according to the bandwidth status, and periodically send a detection data packet to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. The first detection in the second detection phase uses the second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained by the previous detection and the preset detection value.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0015] one or more processors;
[0016] a memory for storing one or more computer programs;
[0017] When one or more computer programs are executed by one or more processors, the electronic device implements the bandwidth detection method of the first aspect.
[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the bandwidth detection method of the first aspect is implemented.
[0019] The above-mentioned bandwidth detection method, device, electronic device and storage medium, in this method, in the first detection stage, the first current bandwidth of the network link is detected based on the first target bandwidth value in sequence, and the first target bandwidth value is adjusted according to the detected first current bandwidth and the initial detection coefficient. Similarly, in the second detection stage, the second current bandwidth of the network link is detected based on the second target bandwidth value in sequence, and the second target bandwidth value is adjusted according to the detected second current bandwidth and the preset detection value. In the present application, the detected target bandwidth value is adjusted according to the current bandwidth of the network link, and a more flexible detection strategy is adopted to achieve a rapid increase in the bandwidth of the network link. Furthermore, by increasing the detection of the bandwidth status in the network link, the bandwidth detection cycle can be adjusted, thereby reducing unnecessary bandwidth detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flow chart of a bandwidth detection method provided by an embodiment of the present invention;
[0021] Figure 2 A flowchart of another bandwidth detection method provided by an embodiment of the present invention;
[0022] Figure 3 A schematic diagram of the structure of a bandwidth detection device provided by an embodiment of the present invention;
[0023] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0025] It should be noted that due to space limitations, this application description does not list all optional implementation methods. After reading this application description, those skilled in the art should be able to understand that as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0026] The following is a detailed description of the various embodiments of the present invention.
[0027] Figure 1 A flow chart of a bandwidth detection method provided by an embodiment of the present invention. Figure 1 As shown, the bandwidth detection method includes:
[0028] Step S101: In the first detection phase, detection data packets are sent to the network link in sequence based on the corresponding first target bandwidth value to detect the first current bandwidth of the network link. The first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained from the previous detection and the initial detection coefficient.
[0029] Generally, video data is encoded by an encoder at the network sending end, and after being packaged, it is sent to the network receiving end at a certain bit rate. The line between the two nodes of the network sending end and the network receiving end is a network link. The network receiving end plays the data after decapsulating and framing. The speed at which the encoder generates data and the speed at which the data is sent depend on the bandwidth estimation of the network link by the congestion control algorithm. Among them, GCC is a congestion control algorithm commonly used in video data transmission, which is used to control the rate of data transmission and avoid network link congestion. GCC usually needs to be combined with a bandwidth detection algorithm to regularly detect the bandwidth of the network link to send data according to the optimal bandwidth value. It can be understood that bandwidth detection can include multiple detection stages, wherein the process of bandwidth rising from zero to the maximum value is the first detection stage. For example, if the maximum value of the network link is 100M, then the process of gradually rising from the beginning to 100M is the first detection stage. When detecting the bandwidth of the network link in the first detection stage, it is necessary to set a first target bandwidth value, and send a detection data packet to the network link based on the first target bandwidth value to detect the first current bandwidth of the network link. Specifically, since the first detection does not have the first current bandwidth of the previous detection as the basis for adjustment, during the first detection, the network sending end can send a group of detection data packets to the network link with the first preset value as the first target bandwidth value, and record the number and sending time of sending the group of detection data packets, so as to calculate the average sending rate according to the number and sending time of the detection data packets. At the same time, the network receiving end records the number and receiving time of receiving the group of detection data packets, and feeds back to the network sending end. The network sending end calculates the average receiving rate according to the number and receiving time of the detection data packets. The smaller value of the average sending rate and the average receiving rate is used as the first current bandwidth detected. Subsequent detections adjust the first target bandwidth value according to the first current bandwidth detected last time and the initial detection coefficient, so as to send the detection data packet to the network link based on the adjusted first target bandwidth value. For example, the maximum bandwidth value of the network link is 100M, and the process of 0-100M before the bandwidth value reaches 100M is the first detection stage. During the first detection, a group of detection data packets can be sent to the network link with the first preset value 5M as the first target bandwidth value. If the detected first current bandwidth is 4M, the first target bandwidth value of the second bandwidth detection can be adjusted according to the first current bandwidth 4M and the initial detection coefficient, and then the second bandwidth detection can be performed according to the adjusted first target bandwidth value, and so on.
[0030] Step S102: In the second detection phase, the bandwidth status of the network link is detected.
[0031] In this embodiment, the second detection stage generally refers to the bandwidth change stage after the bandwidth in the network link is increased to the maximum value. For example, if the maximum bandwidth of the network link is 100M, then the first detection stage is before the bandwidth of the network link is increased to 100M for the first time, and the second detection stage is entered after it is increased to 100M. Generally, after the bandwidth detection in the network link reaches the maximum bandwidth value, the bandwidth change may be relatively stable or unstable. In the prior art, the bandwidth detection of the network link is generally performed regularly, and for the network link with relatively stable bandwidth, unnecessary detection times are increased. Based on this, the present embodiment can detect the bandwidth status of the network link. Specifically, the bandwidth of the network link can be recorded at intervals of time. If the bandwidth detected twice adjacently is the same or relatively close, it means that the bandwidth status of the current network link is relatively stable. For example, the bandwidth in the network link is recorded at T0, T1, T2...Tn. If the bandwidth recorded from T0 to T2 is 5M, it means that the bandwidth status in the network link is relatively stable. If the bandwidth recorded at T0 is 5M and the bandwidth recorded at T1 is 7M, it means that the bandwidth status in the network link is unstable. In addition, in this embodiment, the interval between each moment can be set to any time interval between 5S-20S.
[0032] Step S103: dynamically adjust the bandwidth detection period of the network link according to the bandwidth status, and periodically send a detection data packet to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. The first detection in the second detection phase uses the second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained by the previous detection and the preset detection value.
[0033] It is understandable that the bandwidth status of a network link may be stable or unstable at different times. Therefore, the detection period also needs to be adjusted accordingly for different bandwidth statuses to avoid adding unnecessary bandwidth detection or network congestion caused by the inability to quickly increase the bandwidth due to regular detection. Specifically, the bandwidth in the network link is recorded at regular intervals. If the bandwidths of two adjacent records are the same or close, it means that the bandwidth status of the current network link is relatively stable. At this time, the time interval between the two bandwidth detections can be appropriately extended; if the bandwidths of two adjacent detections are very different, it means that the bandwidth status of the current network link is unstable. At this time, the time interval between the two bandwidth detections can be appropriately shortened, that is, the number of bandwidth detections can be increased.
[0034] After determining the bandwidth detection cycle, a detection data packet can be periodically sent to the network link. That is, in the second detection phase, the bandwidth detection will not be continuously performed, nor will the bandwidth detection be performed regularly, but the bandwidth detection cycle will be dynamically adjusted according to the detected bandwidth status. That is, it may be that the bandwidth detection of the network link is performed once every 10s, or it may be that the bandwidth detection of the network link is performed once every 3s. When detecting the bandwidth of the network link in the second detection phase, it is necessary to set a second target bandwidth value, and send a group of detection data packets to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. It can be understood that since the first detection in the second detection phase does not have the second current bandwidth of the previous detection as an adjustment basis, therefore, during the first detection, the network sending end can send a group of detection data packets to the network link with the second preset value as the second target bandwidth value, and record the number and sending time of sending the group of detection data packets, so as to calculate the average sending rate according to the number and sending time of the detection data packets. At the same time, the network receiving end records the number and receiving time of receiving the group of detection data packets, and feeds back to the network sending end. The network sending end calculates the average receiving rate according to the number and receiving time of the detection data packets. The smaller value of the average sending rate and the average receiving rate is used as the detected second current bandwidth. Subsequent detections adjust the second target bandwidth value according to the second current bandwidth detected last time and the preset detection value, and then send a detection data packet to the network link based on the adjusted second target bandwidth value. For example, when the bandwidth in the network link reaches the maximum value of 100M for the first time, the second detection phase can be entered to perform bandwidth detection. At this time, a group of detection data packets can be sent to the network link with 90M as the second target bandwidth value. If the detected second current bandwidth is 95M, the second target bandwidth value of the second bandwidth detection can be adjusted according to the second current bandwidth and the preset detection value, and then the second bandwidth detection is performed according to the adjusted second target bandwidth value. In this embodiment, the preset detection value can be set to 2. That is, the second target bandwidth value of each detection is twice the second current bandwidth detected last time.
[0035] In this embodiment, the target bandwidth value of the detection is adjusted according to the current bandwidth of the network link, and a relatively flexible detection strategy is adopted to quickly improve the bandwidth of the network link. Furthermore, by increasing the detection of the bandwidth status in the network link, the bandwidth detection cycle can be adjusted, thereby reducing unnecessary bandwidth detection.
[0036] Figure 2 A flowchart of another bandwidth detection method provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the bandwidth detection method includes:
[0037] Step S201: In the first detection phase, detection data packets are sent to the network link in sequence based on the corresponding first target bandwidth value to detect the first current bandwidth of the network link. The first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained from the previous detection and the initial detection coefficient.
[0038] Step S202: In the second detection phase, the bandwidth status of the network link is detected.
[0039] Step S203: dynamically adjust the bandwidth detection period of the network link according to the bandwidth status, and periodically send a detection data packet to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. The first detection in the second detection phase uses the second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained by the previous detection and the preset detection value.
[0040] The technical contents of steps S201 to S203 are the same as those of steps S101 to S103 and will not be repeated here.
[0041] Step S204: record historical detection data of the network link, where the historical detection data includes the detected target bandwidth value, the detected actual bandwidth value and the detection stage.
[0042] Compared with the first detection stage, the bandwidth status of the second detection stage is generally more stable, but some emergencies may occasionally occur, resulting in an unstable bandwidth status. Based on this, the present embodiment can record the historical detection data of the network link. When an emergency occurs during bandwidth detection, bandwidth detection can also be performed with reference to the historical detection data. In the present embodiment, the historical detection data may include the target bandwidth value, the actual bandwidth value detected, and the stage of detection. For example, at 60 seconds after the start of data transmission, the target bandwidth value for detecting the network link bandwidth is 10M, the actual bandwidth value detected is 11M, and the stage of detection is the first detection stage.
[0043] Step S205: adjusting at least one of a detection time interval, a detection target bandwidth value, and a number of detection data packets according to historical detection data.
[0044] According to the historical detection data, the detection problems that may be encountered in the second detection phase can be understood. For example, the target bandwidth value of the detection is too large, the detection time interval is too long or too short, and the number of detection data packets is insufficient. Generally, if the detection fails due to insufficient detection data packets during the previous bandwidth detection, the number of detection data packets can be increased; if the network link jitters and loses packets during the previous bandwidth detection, the number of detection data packets can be appropriately increased according to the packet loss situation; if the bandwidth state is stable, the detection time interval is extended; if the bandwidth state is unstable, the detection time interval is shortened. Specifically, if the actual bandwidth values detected at time T0, time T1, and time T2 are 5M, 7M, and 8M respectively. It means that the bandwidth state of the network link is relatively unstable. At this time, the bandwidth detection time interval can be appropriately shortened, that is, the number of bandwidth detections can be increased. At the same time, the target bandwidth value of the detection can also be reduced. Of course, only the bandwidth detection time interval can be shortened. If the actual bandwidth values detected at time T0, T1, and T2 are all 5M, it means that the bandwidth state of the network link is relatively stable. At this time, the detection time interval can be extended, that is, the number of detections can be reduced. It is understandable that when the bandwidth state is unstable, the target bandwidth value for detection can be reduced, and when the bandwidth state is relatively stable, detection can be performed according to the target bandwidth value preset in the second detection stage.
[0045] In this embodiment, the historical detection data can be fully utilized, and the bandwidth detection time interval, the detection target bandwidth value and the detection data packet can be adjusted according to the historical detection data to improve the accuracy of bandwidth detection.
[0046] In one embodiment, optionally, the first detection stage includes a first detection segment, a second detection segment and a third detection segment in sequence, and initial detection coefficients corresponding to the first detection segment, the second detection segment and the third detection segment decrease in sequence.
[0047] The first detection stage is the stage in which the bandwidth in the network link continues to increase. When the data is initially transmitted, the bandwidth generally increases gradually from 0Kb to 10M...20M, and then continues to increase to reach the set maximum value of 100M. In this process, the rate of bandwidth increase is sometimes faster and sometimes slower. Therefore, in this embodiment, the first detection stage can be divided into the first detection segment, the second detection segment and the third detection segment in order, and then different initial detection coefficients are set for different detection segments. Generally, the bandwidth increases faster at the beginning, so the acceleration of the increase of the first target bandwidth value corresponding to the first detection segment is relatively large. When approaching the maximum bandwidth, the rate of bandwidth increase is relatively slow, so the acceleration of the increase of the first target bandwidth value corresponding to the second detection segment and the third detection segment is relatively small. Based on this, the initial detection coefficients corresponding to the first detection segment, the second detection segment and the third detection segment in this embodiment decrease successively.
[0048] In one embodiment, optionally, the initial detection coefficient corresponding to the first detection segment increases exponentially.
[0049] In this embodiment, the detection coefficients corresponding to the first detection segment can be 3 and 6 respectively. That is, the first target bandwidth value in the first detection segment is 3 times the first current bandwidth detected last time. The first target bandwidth value of the next detection is 6 times the first current bandwidth detected last time. It can be understood that the initial detection coefficients 3 and 6 grow exponentially with 2 as the base. For example, during the first detection, 2M is used as the first preset value for detection. If the first current bandwidth detected for the first time is 3M, then during the second detection, 3*3M is used as the first target bandwidth value for detection. If the first current bandwidth detected for the second time is 8M, then during the third detection, 6*8M is used as the first target bandwidth value for detection. In the first detection segment, after two bandwidth detections are performed according to the first target bandwidth value obtained by the initial detection coefficients 3 and 6, it is possible to switch to the second detection segment to continue the detection.
[0050] In this embodiment, optionally, in the second detection segment, when the detected actual bandwidth value is less than the first target value, the detection is switched to the third detection segment to continue.
[0051] The initial detection coefficient corresponding to the second detection segment can be 2, that is, the first target bandwidth value in the second detection segment is twice the first current bandwidth detected last time. In other words, the first target bandwidth value of each subsequent detection is twice the first current bandwidth detected last time. For example, if the first current bandwidth detected last time is 40M, then the next detection is performed with 2*40M as the first target bandwidth value. If the first current bandwidth detected at this time is 58M, then the next detection is performed with 2*58M as the first target bandwidth value. In the second detection segment, when the actual bandwidth value detected is greater than the first target value, it means that there is still a lot of room for improvement in the bandwidth of the current network link, so the detection can continue; when the actual bandwidth value detected is less than the first target value, it means that the bandwidth of the current network link has been increased to a larger value. If the first target bandwidth value obtained according to the initial detection coefficient 2 and the first current bandwidth is continued for detection, the detection may fail. At this time, it can be switched to the third detection segment and the first target bandwidth value obtained according to the relatively small initial detection coefficient and the first current bandwidth is used for detection. In this embodiment, the first target value can be set to 70% of the detected first target bandwidth value. For example, the first target bandwidth value is 50M, and the first target value is 70% of 50M, that is, 35M. If the detected actual bandwidth value is 36M, that is, the detected actual bandwidth value is greater than the first target value, it means that there is still a lot of room for improvement in the bandwidth of the current network link, and detection can continue; if the detected actual bandwidth value is 30M, that is, the detected actual bandwidth value is less than the first target value, it means that the bandwidth of the current network link has been increased to a larger value.
[0052] In this embodiment, optionally, in the third detection segment, when the detected actual bandwidth value is less than the second target value, the detection is terminated.
[0053] The initial detection coefficient corresponding to the third detection segment can be 1.25, that is, the first target bandwidth value in the third detection segment is 1.25 times the first current bandwidth detected last time. For example, if the first current bandwidth detected last time is 40M, then the next detection is performed with 1.25*40M as the first target bandwidth value. If the first current bandwidth detected at this time is 52M, then the detection is continued with 1.25*52M as the first target bandwidth value. Since the bandwidth of the network link has reached a larger value, the first target bandwidth value should not be too large, otherwise it will cause detection failure. When the actual bandwidth value detected is less than the second target value, it means that the current bandwidth is close to the bandwidth upper limit, and the detection can be ended at this time. The second target value in this embodiment can be set to 70% of the first target bandwidth value detected. For example, the first target bandwidth value is 60M, and the second target value is 70% of 60M, that is, 42M. If the actual bandwidth value detected is 45M, the detection can continue; if the actual bandwidth value detected is 40M, it means that the current bandwidth is difficult to continue to increase, so the detection can be ended.
[0054] In one embodiment, optionally, step S103 or step S203 includes:
[0055] When the bandwidth status is stable, increase the bandwidth detection period.
[0056] When the bandwidth status is unstable, reduce the bandwidth detection period.
[0057] In this embodiment, in the second detection phase, periodic detection is not performed, but the detection cycle is adjusted accordingly for different bandwidth states to avoid adding unnecessary bandwidth detection or network congestion caused by the inability to quickly increase bandwidth due to periodic detection. Specifically, if the bandwidth state of the network link is relatively stable, the bandwidth detection cycle can be increased, that is, the time interval between two bandwidth detections can be appropriately extended; if the bandwidth state of the network link is unstable, the bandwidth detection cycle can be reduced, that is, the time interval between two bandwidth detections can be appropriately shortened.
[0058] Figure 3 A schematic diagram of a bandwidth detection device provided by an embodiment of the present invention, referring to Figure 3 The bandwidth detection device includes a first detection unit 310, a detection unit 320 and a second detection unit 330.
[0059] Among them, the first detection unit 310 is used to send detection data packets to the network link in sequence based on the corresponding first target bandwidth value in the first detection phase to detect the first current bandwidth of the network link. The first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained from the previous detection and the initial detection coefficient; the detection unit 320 is used to detect the bandwidth status of the network link in the second detection phase; the second detection unit 330 is used to dynamically adjust the bandwidth detection period of the network link according to the bandwidth status, and periodically send detection data packets to the network link based on the second target bandwidth value to detect the second current bandwidth of the network link. The first detection in the second detection phase uses the second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained from the previous detection and the preset detection value.
[0060] Based on the above embodiment, optionally, the method further includes:
[0061] The recording unit is used to record the historical detection data of the network link, where the historical detection data includes the detected target bandwidth value, the detected actual bandwidth value and the stage of the detection.
[0062] The adjusting unit is used to adjust at least one of the detection time interval, the detection target bandwidth value and the number of detection data packets according to the historical detection data.
[0063] On the basis of the above embodiment, optionally, the first detection stage includes a first detection segment, a second detection segment and a third detection segment in sequence, and the initial detection coefficients corresponding to the first detection segment, the second detection segment and the third detection segment decrease in sequence.
[0064] Based on the above embodiment, optionally, the initial detection coefficient corresponding to the first detection segment increases exponentially.
[0065] Based on the above embodiment, optionally, in the second detection segment, when the detected actual bandwidth value is less than the first target value, the detection is switched to the third detection segment to continue.
[0066] Based on the above embodiment, optionally, in the third detection segment, when the detected actual bandwidth value is less than the second target value, the detection is terminated.
[0067] Based on the above embodiment, optionally, the second detection unit 330 includes
[0068] The period reduction unit is used to increase the bandwidth detection period when the bandwidth state is stable.
[0069] The cycle increasing unit is used to reduce the bandwidth detection cycle when the bandwidth state is unstable.
[0070] The bandwidth detection device provided in the embodiment of the present invention is included in an electronic device and can be used to execute the corresponding bandwidth detection method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0071] It is worth noting that in the embodiment of the above-mentioned bandwidth detection device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0072] Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 4 As shown, the electronic device includes a processor 410 and a memory 420, and may also include an input device 430, an output device 440, and a communication device 450; the number of processors 410 in the electronic device may be one or more, Figure 4 A processor 410 is taken as an example; the processor 410, the memory 420, the input device 430, the output device 440 and the communication device 450 in the electronic device can be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0073] The memory 420, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the bandwidth detection method in the embodiment of the present invention. The processor 410 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 420, that is, implements the above-mentioned bandwidth detection method.
[0074] The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0075] The input device 430 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 440 may include a display device such as a display screen.
[0076] The electronic device mentioned above includes a bandwidth detection device, which can be used to execute any bandwidth detection method and has corresponding functions and beneficial effects.
[0077] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it is used to perform relevant operations in the bandwidth detection method provided in any embodiment of the present application and has corresponding functions and beneficial effects.
[0078] Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products.
[0079] Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0080] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0081] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0082] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0083] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A bandwidth detection method, characterized in that: include: In the first detection stage, detection data packets are sent to the network link based on the corresponding first target bandwidth value in sequence to detect the first current bandwidth of the network link. The first detection in the first detection stage uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth obtained in the previous detection and the initial detection coefficient. The first detection stage includes the first detection segment, the second detection segment and the third detection segment in sequence. The initial detection coefficients corresponding to the first detection segment, the second detection segment and the third detection segment decrease in sequence. The first detection stage is before the bandwidth of the network link reaches the maximum bandwidth of the network link for the first time. In the second detection phase, the bandwidth state of the network link is detected, and the second detection phase is entered after the bandwidth of the network link reaches the maximum bandwidth of the network link for the first time; The bandwidth detection period of the network link is dynamically adjusted according to the bandwidth status, and a detection data packet is periodically sent to the network link based on a second target bandwidth value to detect a second current bandwidth of the network link, wherein the first detection in the second detection phase uses a second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained from the previous detection and the preset detection value, wherein an average sending rate is calculated according to the number of detection data packets sent and the sending time, and an average receiving rate is calculated according to the number of detection data packets received and the receiving time, and the smaller value of the average sending rate and the average receiving rate is used as the detected second current bandwidth.
2. The bandwidth detection method according to claim 1, characterized in that: Also includes: Recording historical detection data of the network link, the historical detection data including the detected target bandwidth value, the detected actual bandwidth value and the detection stage; At least one of a detection time interval, a detection target bandwidth value, and a number of detection data packets is adjusted according to the historical detection data.
3. The bandwidth detection method according to claim 1, characterized in that: The initial detection coefficient corresponding to the first detection segment increases exponentially.
4. The bandwidth detection method according to claim 1, characterized in that: In the second detection segment, when the detected actual bandwidth value is less than the first target value, switching to the third detection segment to continue detection.
5. The bandwidth detection method according to claim 1, characterized in that: In the third detection segment, when the detected actual bandwidth value is less than the second target value, the detection is terminated.
6. The bandwidth detection method according to claim 1, characterized in that: The dynamically adjusting the bandwidth detection period of the network link according to the bandwidth status includes: When the bandwidth state is stable, increasing the bandwidth detection period; When the bandwidth state is unstable, the bandwidth detection period is reduced.
7. A bandwidth detection device, characterized in that: include: A first detection unit is used to send detection data packets to the network link in a first detection phase, based on the corresponding first target bandwidth value, to detect the first current bandwidth of the network link. The first detection in the first detection phase uses the first preset value as the first target bandwidth value, and the first target bandwidth value corresponding to the subsequent detection is adjusted according to the first current bandwidth and the initial detection coefficient obtained in the previous detection. The first detection phase includes a first detection segment, a second detection segment, and a third detection segment. The initial detection coefficients corresponding to the first detection segment, the second detection segment, and the third detection segment decrease in sequence. The first detection phase is before the bandwidth of the network link reaches the maximum bandwidth of the network link for the first time; A detection unit, configured to detect the bandwidth status of the network link in the second detection phase, and enter the second detection phase after the bandwidth of the network link reaches the maximum bandwidth of the network link for the first time; A second detection unit is used to dynamically adjust the bandwidth detection period of the network link according to the bandwidth status, and periodically send detection data packets to the network link based on a second target bandwidth value to detect a second current bandwidth of the network link, wherein the first detection in the second detection phase uses a second preset value as the second target bandwidth value, and the second target bandwidth value corresponding to the subsequent detection is adjusted according to the second current bandwidth obtained in the previous detection and the preset detection value, wherein an average sending rate is calculated according to the number of detection data packets sent and the sending time, and an average receiving rate is calculated according to the number of detection data packets received and the receiving time, and the smaller value of the average sending rate and the average receiving rate is used as the detected second current bandwidth.
8. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more computer programs; When the one or more computer programs are executed by the one or more processors, the electronic device implements the bandwidth detection method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the bandwidth detection method as described in any one of claims 1 to 6 is implemented.
