Bandwidth prediction method and routing forwarding equipment
By implementing a bandwidth prediction method in the routing forwarding device, using periodic transmission of data streams and analyzing packet lengths, the problem of inaccurate traffic reflecting network conditions in the prior art is solved, and more accurate network bandwidth prediction and reflection are achieved.
Patent Information
- Application Number
- CN202311345868.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-16
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-10-16
AI Technical Summary
The prior art reflects network conditions through traffic, resulting in differences from the actual use of the network. Especially when network interference and coverage environment abnormalities, terminal equipment may experience packet loss and retransmission problems.
A bandwidth prediction method is provided, through the routing forwarding device to transmit multiple data streams in the first cycle, obtain the message length of each data stream, determine the initial bandwidth when transmitting the data stream, and determine the target bandwidth based on these bandwidths to more accurately reflect the current network condition.
By periodically predicting bandwidth, routing forwarding devices can more accurately reflect the actual use of the current network and reduce network problems caused by bandwidth prediction errors.
Smart Images

Figure CN119892659A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a bandwidth prediction method and a routing forwarding device. Background Art
[0002] With the development of wireless communication technology, routers have been widely used, and terminal devices can transmit data through routers in wireless communication systems. In related technologies, during the process of data transmission between terminal devices and routers, the router can feedback the current Internet traffic and reflect the network status through the traffic.
[0003] Traffic refers to the amount of data sent and received by a terminal device at a certain point in time (i.e., the total amount of data), and does not represent the actual usage of the current network. In addition, in scenarios such as network interference and abnormal network coverage, packet loss and retransmission may occur during data transmission by the terminal device through the router. Based on this scenario, the network status reflected by traffic may differ from the actual usage of the network. Summary of the invention
[0004] The embodiments of the present application provide a bandwidth prediction method and a routing forwarding device, which are used to solve the problem in the related art that the network status is reflected by traffic, resulting in a difference from the actual usage of the network.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, a bandwidth prediction method is provided, which is applied to a routing and forwarding device, wherein the routing and forwarding device establishes a communication connection with a terminal device and is used to forward a data stream sent by the terminal device, or forward a data volume received by the terminal device; the method comprises: the routing and forwarding device transmits N data streams within a first period, obtains the message length of multiple messages included in the data stream for each of the N data streams, and determines a first bandwidth when transmitting the data stream according to the message length; then, the routing and forwarding device determines the first bandwidth and the sum of the N data streams when transmitting the N data streams within the first period based on the first bandwidth corresponding to each of the N data streams; finally, the routing and forwarding device determines the target bandwidth, that is, determines the maximum bandwidth when the routing and forwarding device transmits the N data streams according to at least the first bandwidth and the sum.
[0007] Based on the first aspect, when the routing and forwarding device transmits N data streams in the first cycle, the routing and forwarding device determines the first bandwidth corresponding to each data stream in the N data streams, thereby determining the first bandwidth sum when the N data streams are transmitted in the first cycle, and determining the maximum bandwidth when the routing and forwarding device transmits the N data streams based on the first bandwidth sum. In this way, the maximum bandwidth when the routing and forwarding device is currently transmitting the data stream can be predicted by the routing and forwarding device, which can more accurately reflect the current network status, that is, reflect the actual usage of the network.
[0008] In a possible implementation manner of the first aspect, the method includes: the routing and forwarding device transmits M data streams within a second period; the routing and forwarding device obtains, for each of the M data streams, a message length of multiple messages included in the data stream, and determines a second bandwidth corresponding to the data stream according to the message length; then, the routing and forwarding device determines the second bandwidth sum when transmitting the M data streams within the second period based on the second bandwidth corresponding to each of the M data streams; finally, the routing and forwarding device determines the target bandwidth according to the first bandwidth sum and the second bandwidth sum.
[0009] In this implementation, the routing and forwarding device can continue to predict the second bandwidth when transmitting M data streams in the second period, thereby determining the target bandwidth based on the first bandwidth sum and the second bandwidth sum. In other words, the routing and forwarding device can periodically predict the bandwidth of the current transmission data stream, thereby being able to more accurately reflect the current network status, that is, reflect the actual usage of the network, by periodically predicting the bandwidth.
[0010] Optionally, the second cycle is the next cycle of the first cycle.
[0011] In a possible implementation of the first aspect, the target bandwidth is determined according to the first bandwidth sum and the second bandwidth sum, including: if the second bandwidth sum is greater than the first bandwidth sum, the target bandwidth is determined to be the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum, the target bandwidth is determined to be the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum and the bandwidth increase ratio is greater than the retransmission ratio, the target bandwidth is determined to be the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum and the bandwidth increase ratio is less than the retransmission ratio, the target bandwidth is retained as the first bandwidth sum. The bandwidth increase ratio is used to indicate the bandwidth increase rate of the second period compared to the first period; and the retransmission ratio is used to indicate the ratio of retransmissions occurring in the first period.
[0012] In this implementation, taking into account the impact of retransmission on bandwidth, in this application, the routing forwarding device periodically determines the bandwidth and of all data streams transmitted in each cycle, and dynamically adjusts the target bandwidth based on the bandwidth increase ratio and the retransmission ratio, so that the predicted bandwidth of the current transmission data stream is more accurate, and thus can more accurately reflect the current network status, that is, reflect the actual usage of the network.
[0013] Optionally, the bandwidth increase ratio satisfies the following expression:
[0014] ΔB=(Bt2-Bt1) / Bt1;
[0015] Wherein, ΔB represents the bandwidth increase ratio, Bt2 represents the second bandwidth sum, and Bt1 represents the first bandwidth sum.
[0016] Optionally, the retransmission ratio satisfies the following expression:
[0017]
[0018] Among them, Rt represents the retransmission ratio, represents the data volume of the retransmitted message transmitted in the first period, Indicates the data volume of all messages transmitted in the first cycle.
[0019] In a possible implementation of the first aspect, determining the first bandwidth for data flow comparison based on the message length includes: the routing and forwarding device determines the data volume of the data flow transmitted in the first period based on the message lengths of multiple messages; the routing and forwarding device determines the first bandwidth corresponding to the data flow based on the data volume of the data flow transmitted in the first period and the first period.
[0020] Optionally, if the data stream does not include a retransmission message, the first bandwidth is a ratio of a data volume of the data stream transmitted in the first period to the first period.
[0021] In a possible implementation manner of the first aspect, the first period includes a first duration and a second duration of a pre-device, the second duration is related to a retransmission timeout RTO, and the first duration is a difference between the first period and the second duration; the routing and forwarding device determines a first bandwidth corresponding to the data stream according to a data volume of the data stream transmitted in the first period and the first period, including: the routing and forwarding device determines a data volume of normal messages transmitted in the first duration, a data volume of retransmitted messages transmitted in the second duration, and a data volume of all messages transmitted in the second duration; the routing and forwarding device determines a first bandwidth corresponding to the data stream according to a data volume of normal messages transmitted in the first duration, a data volume of retransmitted messages transmitted in the second duration, a data volume of all messages transmitted in the second duration, the first duration, and the second duration.
[0022] In this implementation, the first bandwidth is the ratio of the data volume of the normal message transmitted in the first period to the time. The time is related to the detection time included in the first time period and the proportion of the retransmitted message transmitted in the second time period. Therefore, by adopting the solution of the present application, taking into account the proportion of the retransmitted message transmitted in the first period, the determined first bandwidth can be made more accurate.
[0023] Optionally, the first bandwidth corresponding to the data stream satisfies the following expression:
[0024]
[0025] Wherein, Bi represents the first bandwidth corresponding to the data stream, represents the data volume of normal messages transmitted within the first time period, The data volume of the retransmitted message transmitted within the second time period; It represents the data volume of all messages transmitted within the second time period, t1 represents the first time period, and t2 represents the second time period.
[0026] In a possible implementation manner of the first aspect, the method further includes: the routing forwarding device displays the target bandwidth; or the routing forwarding device sends indication information to the terminal device, the indication information includes the target bandwidth, and the indication information is used to instruct the terminal device to display the target bandwidth.
[0027] In this implementation, the target bandwidth is displayed by the routing and forwarding device, or the target bandwidth is displayed by the terminal device, so that users can more accurately measure the network status, confirm whether the bandwidth is overloaded or whether the bandwidth package purchased by the user meets the actual needs, etc. Furthermore, for the problem of slow network speed caused by network congestion due to the home environment (such as too many terminal devices accessing the communication network through the routing and forwarding device, etc.), the routing and forwarding device displays the target bandwidth, or the terminal device displays the target bandwidth, so that users can easily confirm whether it is caused by too small bandwidth or excessive bandwidth, which is convenient for users to troubleshoot and improve the user experience.
[0028] In a possible implementation manner of the first aspect, the method further includes: the routing and forwarding device allocating a target bandwidth to the terminal device based on an application scenario of the terminal device.
[0029] In this implementation, the routing and forwarding device allocates different bandwidths to terminal devices in different application scenarios based on the predicted target bandwidth, thereby increasing the network rate of the terminal device in the application scenario and improving the user experience.
[0030] Optionally, if the application scenario of the terminal device is the first application scenario, the routing and forwarding device allocates a first target bandwidth to the terminal device; if the application scenario of the terminal device is the second application scenario, the routing and forwarding device allocates a second target bandwidth to the terminal device; wherein the bandwidth required for the first application scenario is greater than the bandwidth required for the second application scenario, and the first target bandwidth is greater than the second target bandwidth.
[0031] In a second aspect, a routing and forwarding device is provided, which has the function of implementing any one of the functions in the first aspect, and the function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0032] According to a third aspect, a routing and forwarding device is provided, which includes a memory and one or more processors; wherein the memory is used to store computer instructions, and when the routing and forwarding device is running, the processor executes the computer instructions of the memory to enable the routing and forwarding device to perform any of the methods described in the first aspect.
[0033] In a fourth aspect, a chip system is provided, which includes: at least one processor and an interface, the interface being used to receive instructions and transmit them to at least one processor; at least one processor executes instructions so that the routing and forwarding device executes the method described in any one of the first aspects above.
[0034] In a fifth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer can execute any of the methods described in the first aspect.
[0035] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect.
[0036] Among them, the technical effects brought about by any implementation method in the above-mentioned second to sixth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of the composition of a communication device provided in an embodiment of the present application;
[0039] Figure 3 A schematic diagram of a three-way handshake process provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of a TCP transmission process provided in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of a timeout retransmission provided in an embodiment of the present application;
[0042] Figure 6 A schematic diagram of the structure of a netfilter framework provided in an embodiment of the present application;
[0043] Figure 7 A schematic diagram of a bandwidth prediction process provided in an embodiment of the present application;
[0044] Figure 8 A schematic diagram of the composition of a data stream provided in an embodiment of the present application;
[0045] Fig. 9 A schematic diagram of another bandwidth prediction process provided in an embodiment of the present application;
[0046] Fig.10 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] For ease of understanding, first, the technical terms and related technologies involved in the embodiments of the present application are introduced.
[0048] The Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol defined by IETF RFC793. Connection-oriented means that the two parties communicating using the TCP protocol, such as the client and the server, must first establish a TCP connection before using the TCP protocol to transmit TCP packets through data streams.
[0049] Each data stream transmitted by the client and the server includes multiple TCP packets. After the client and the server establish a connection, the client and the server can transmit the data stream through the data stream channel, that is, transmit the TCP packet. Among the multiple TCP packets transmitted by the client and the server, the TCP packets with the same source port number, the same destination port number, and the same protocol type are called a data stream. In other words, in the same data stream, the TCP packets transmitted by the client and the server have the same port number and the same protocol type.
[0050] It should be noted that, among the multiple TCP messages transmitted by the client and the server, each TCP message includes two parts: a header and data. The header may include the source port number, the destination port number, the sequence number, the TCP flag bit (or message control flag), and the acknowledgment number (ACK number).
[0051] The source port number is used to find the application process of the sender. The destination port number is used to find the application process of the receiver. The sequence number (or message number) is used to identify the order of the data part in the TCP message in the data stream sent from the sender to the receiver. In the process of using the TCP protocol to transmit data streams, the data parts in multiple TCP messages sent by the sender are numbered in sequence. The receiver can correctly reassemble the data based on the sequence number to ensure the order of the data. The confirmation number indicates that the receiver confirms the received data. Among them, the confirmation number = the sequence number in the previous TCP message + 1.
[0052] Of course, the header may also include other content, for example, the header may also include header length, reserved bits, window size, optional items, etc. For specific explanations, please refer to the relevant technology, which will not be repeated here.
[0053] The TCP flag bits may include: acknowledgment (ACK), reset (RST), synchronization (SYN), finish (FIN), etc.
[0054] Among them, ACK is used to indicate whether the confirmation number is valid. The TCP protocol stipulates that after the client and the server establish a TCP connection, ACK must be 1, that is, when ACK=1, it means that the confirmation number is valid.
[0055] RST is used to indicate whether the client and server have reset the connection. For example, if RST = 1, it means that a serious error has occurred in the TCP connection between the client and the server (such as a host crash). At this time, the previous TCP connection needs to be released and then a TCP connection needs to be reestablished. That is, RST = 1 means that the client and the server need to reset the connection.
[0056] SYN, a handshake signal used when the client and server establish a TCP connection, is used to request synchronization.
[0057] FIN is used to mark whether the data has been sent. If FIN = 1, it means that the data has been sent and the TCP connection can be released.
[0058] Of course, other flags may also be included, such as nonce sum (NS), congestion window reduce (CWR), ENC echo (ECN echo), urgent (URG), push (PSH) and other flags. For specific explanations, please refer to the relevant technology and will not be repeated here.
[0059] Generally, a router can provide traffic statistics and display the traffic statistics results to users through the user interface to reflect the current network status to users. In some scenarios, the current network status reflected by traffic may be different from the actual bandwidth used by the network.
[0060] For example, after a terminal device (such as a mobile phone or tablet computer) accesses a communication network through the wireless fidelity (Wi-Fi) network provided by a router, the traffic cannot reflect the actual status of the current network due to the influence of network environmental factors. The influence of network environmental factors includes: signal interference leading to a decrease in signal-to-noise ratio; poor signal coverage leading to extended data transmission time; roaming switching leading to data packet loss or retransmission; unstable Wi-Fi link; unstable external environment leading to data packet loss or retransmission and other network environmental factors.
[0061] Among them, the instability of the external environment may include: uplink network abnormalities (such as between the optical modem and the router); access network and backbone network abnormalities; server abnormalities, etc.
[0062] In order to solve the above technical problems, an embodiment of the present application provides a bandwidth prediction method, which is applied to a routing forwarding device, and the routing forwarding device establishes a communication connection with a terminal device, and is used to forward a data stream sent by the terminal device, or forward a data stream received by the terminal device. The method includes: when the routing forwarding device transmits N data streams in the first cycle, for each of the N data streams, the message length of multiple messages included in the data stream is obtained, and the first bandwidth when the data stream is transmitted is determined according to the message length. Then, the routing forwarding device determines the first bandwidth and the sum of the N data streams transmitted in the first cycle based on the first bandwidth corresponding to each data stream, and determines the maximum bandwidth of the routing forwarding device when transmitting the N data streams according to the first bandwidth. In this way, by predicting the maximum bandwidth of the current transmission data stream through the routing forwarding device, the current network status can be more accurately reflected, that is, the actual usage of the network can be reflected.
[0063] The technical solution provided by the embodiments of the present application is described in detail below in conjunction with the accompanying drawings.
[0064] The method provided in the embodiment of the present application is applied to Figure 1 In the communication system shown in FIG. Figure 1 As shown, the communication system includes a terminal device 101, a routing and forwarding device 102, and a core network device 103. The terminal device 101 can be a wireless Internet access device or a wired Internet access device; the wireless Internet access device can access the routing and forwarding device 102 by wireless means (for example, Wi-Fi), and the wired Internet access device can access the routing and forwarding device 102 by wired means (for example, data transmission line). The routing and forwarding device 102 is used to transmit the data stream sent by the terminal device 101.
[0065] Optional, such as Figure 1 As shown, the communication system may also include an optical modem (e.g., an optical modem). The optical modem is used to realize the conversion of optical and electrical signals and the conversion of interface protocols in the communication network, and connect the core network device 103 and the routing and forwarding device 102. The routing and forwarding device 102 connects the terminal device 101 to the optical modem to achieve the purpose of connecting the terminal device 101 to the communication network. For example, the communication network may be an internet network.
[0066] Optionally, the above communication system may further include connecting the terminal device 101 to a broadband access server, a core router, etc. in the communication network. For example, the routing forwarding device 102 connects the terminal device 101 to an optical modem, and the optical modem connects the terminal device 101 to a core network device 103 through a broadband access server, a core router, etc., to achieve the need to access the terminal device 101 to the communication network.
[0067] For example, the terminal device 101 can be a user device that can be connected to the Internet, such as a computer, a tablet computer, a desktop, a laptop, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), a mobile phone, a set-top box, a smart TV, a smart wearable device, or an Internet of Things node in the Internet of Things, or an in-vehicle communication device in the Internet of Vehicles, or an entertainment device, a game device or system, a global positioning system device, etc. The terminal device 101 can also be a chip or processing system in the above-mentioned devices. The terminal device 101 can also be a wireless communication chip, a wireless sensor, or a wireless communication terminal, etc.
[0068] For example, the routing and forwarding device 102 may be a device with routing and forwarding functions. For example, the routing and forwarding device 102 may be a router, a layer three switch, etc. The routing and forwarding device 102 may also be a chip or a processing system in the above devices.
[0069] When implementing it specifically, Figure 1 As shown: the terminal device 101 and the routing forwarding device 102 can use Figure 2 The structure shown, or including Figure 2 Parts shown. Figure 2 The following is a schematic diagram of the composition of a communication device 200 provided in an embodiment of the present application. Figure 2 As shown, the communication device 200 may include a processor 201 , a transceiver 202 , and a communication line 203 .
[0070] Furthermore, the communication device 200 may further include a memory 204. The processor 201, the memory 204 and the transceiver 202 may be connected via a communication line 203.
[0071] The processor 201 is a central processing unit (CPU), a general-purpose processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 201 may also be other devices with processing functions, such as circuits, devices, or software modules, without limitation.
[0072] The transceiver 202 is used to communicate with other devices or other communication networks. The other communication networks may be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The transceiver 202 may be a module, a circuit, a transceiver or any device capable of achieving communication.
[0073] The communication line 203 is used to transmit information between the components included in the communication device 200.
[0074] The memory 204 is used to store instructions, wherein the instructions may be machine programs.
[0075] The memory 204 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, etc., without limitation.
[0076] It should be noted that the memory 204 can exist independently of the processor 201, or can be integrated with the processor 201. The memory 204 can be used to store instructions or program codes or some data, etc. The memory 204 can be located in the communication device 200, or can be located outside the communication device 200, without limitation. The processor 201 is used to execute the instructions stored in the memory 204 to implement the method provided in the following embodiments of the present application.
[0077] In one example, the processor 201 may include one or more CPUs, such as Figure 2 CPU0 and CPU1 in.
[0078] As an optional implementation, the communication device 200 includes multiple processors, for example, Figure 2 In addition to the processor 201, a processor 207 may also be included.
[0079] As an optional implementation, the communication device 200 further includes an output device 205 and an input device 206. Exemplarily, the input device 206 is a device such as a keyboard, a mouse, a microphone or a joystick, and the output device 205 is a device such as a display screen and a speaker.
[0080] It should be pointed out that Figure 2 The structure shown in the figure does not constitute a limitation on the communication device, except Figure 2 In addition to the components shown, the communication device may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0081] In the embodiment of the present application, the chip system may be composed of a chip, or may include a chip and other discrete devices.
[0082] In addition, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiments of the present application is only an example, and other names can also be used in the specific implementation without limitation.
[0083] Combination Figure 1 In the communication system shown, the terminal device 101 can use the communication protocol to establish a connection with other devices (such as other terminal devices) through the routing forwarding device 102 and the core network device 103. Among them, the communication protocol can be the TCP protocol or the user datagram protocol (UDP). In the following embodiments, the technical solution of the embodiments of the present application is introduced by taking the communication protocol as the TCP protocol as an example.
[0084] Typically, when the terminal device 101 establishes a TCP connection with another device, the device that actively initiates the TCP connection establishment can be called a TCP client, and the device that passively waits for the TCP connection to be established can be called a TCP server. Exemplarily, the TCP client and the TCP server can establish a TCP connection through a three-way handshake.
[0085] Figure 3 A schematic diagram of establishing a TCP connection through a three-way handshake is shown. Figure 3 As shown, the handshake process for establishing a TCP connection includes the following steps.
[0086] Step 301: The TCP client sends a TCP connection request message to the TCP server. The TCP connection request message may be a first handshake message for establishing a TCP connection.
[0087] The SYN flag in the TCP connection request message header is set to 1 (i.e., SYN=1). SYN=1 indicates that the message is used to establish a TCP connection. The sequence number in the TCP connection request message header is set to an initial value x (i.e., sequence number=x), which is the initial sequence number selected by the TCP client, and x is randomly generated by the TCP client.
[0088] Step 302: After receiving the TCP connection request message, if the TCP server agrees to establish a connection, it sends a TCP connection request confirmation message to the TCP client. The TCP connection request confirmation message may be a second handshake message for establishing a TCP connection.
[0089] Among them, the SYN flag and ACK flag in the TCP connection request confirmation message header are both set to 1 (i.e., SYN=1, ACK=1). SYN=1 indicates that the message is used to establish a TCP connection, and ACK=1 indicates confirmation of receipt of the TCP connection request message sent by the TCP client in step 301. The sequence number in the TCP connection request confirmation message header is set to the initial value y (i.e., sequence number=y), which is the initial sequence number selected by the TCP server, and y is randomly generated by the TCP server. The confirmation number in the TCP connection request confirmation message header is set to x+1 (i.e., confirmation number=x+1), indicating confirmation of the initial sequence number selected by the TCP client.
[0090] After receiving the TCP connection request confirmation message (i.e., the second handshake message), the TCP client may enter the connection established state.
[0091] Step 303: After receiving the TCP connection request confirmation message, the TCP client may also send a TCP confirmation message to the TCP server. The TCP confirmation message may be a third handshake message for establishing a TCP connection.
[0092] Among them, the ACK flag in the header of the TCP confirmation message is set to 1 (i.e. ACK=1), indicating that this is a TCP confirmation message. The sequence number in the TCP confirmation message header is set to x+1 (i.e. sequence number=x+1). This is because the sequence number of the previous TCP message (i.e. TCP connection request message) sent by the TCP client is x, so the sequence number of the TCP confirmation message is x+1 (i.e. sequence number=x+1). The confirmation number in the TCP confirmation message header is set to y+1 (i.e. confirmation number=y+1), which is a confirmation of the initial sequence number selected by the TCP server process.
[0093] After receiving the TCP confirmation message (the third handshake message), the TCP server also enters the connection established state.
[0094] Optionally, in the above handshake process, the TCP client mainly completes the work of the TCP client reporting the sending capability to the TCP server, and the TCP client confirms the receiving capability of the TCP server. In the above handshake process, the TCP server mainly completes the work of the TCP server reporting the sending capability to the TCP client, and the TCP server confirms the receiving capability of the TCP client. After the communicating parties confirm the sending capability and receiving capability of each other, the TCP client and the TCP server can negotiate to determine the maximum amount of data transmitted by the TCP client and the TCP server.
[0095] based on Figure 3In the handshake process shown, both the TCP client and the TCP server have entered the connection established state. After the TCP client and the TCP server negotiate and determine the maximum amount of data to be transmitted, data streams can be transmitted based on the established TCP connection.
[0096] Figure 4 A schematic diagram of communication between a TCP client and a TCP server provided in an embodiment of the present application. For example, Figure 4 As shown, the communication process between the TCP client and the TCP server may include: a three-way handshake process, a TCP data transmission process, and a four-way handshake process. Figure 4 The TCP data transmission process is the normal data transmission process.
[0097] Combination Figure 4 As shown, the TCP data transmission process and the four-way handshake process are illustrated here by way of example. For an example of the three-way handshake process, reference may be made to the above embodiment, which will not be described in detail here.
[0098] Taking the TCP client as the sender and the TCP server as the receiver as an example, after both the TCP client and the TCP server enter the connection established state, the two can perform data transmission. For example, the TCP client can send the first data to the TCP server. When the TCP server receives the first data sent by the TCP client, the TCP server will return a confirmation response (ie, ACK) to the TCP client, indicating that it expects to receive the second data. For example, Figure 4 As shown, the TCP client sends TCP message 1 to the TCP server, and the TCP message 1 carries data corresponding to the sequence number (e.g., seq=1), and seq=1 represents data with sequence number 1. When the TCP server receives the data corresponding to seq=1, the TCP server returns a TCP confirmation message to the TCP client, and the TCP confirmation message carries a confirmation response (e.g., ACK=2), and ACK=2 represents the expectation to receive the second data.
[0099] Correspondingly, after receiving the TCP confirmation message, the TCP client sends TCP message 2 to the TCP server. The TCP message 2 carries the data corresponding to the sequence number (e.g., seq=2). seq=2 indicates the data with sequence number 2. When the TCP server receives the data corresponding to seq=2, the TCP server returns a TCP confirmation message to the TCP client. The TCP confirmation message carries a confirmation response (e.g., ACK=3). ACK=3 indicates that the third piece of data is expected to be received. And so on. Figure 4As shown, until the TCP client sends all data to the TCP server, such as the sixth data (seq=6), seq=6 represents data with sequence number 6.
[0100] It is understandable that after the TCP client and the TCP server establish a TCP connection through the three-way handshake process, the TCP client and the TCP server will negotiate to determine the maximum amount of data to be transmitted this time. For example, the TCP client and the TCP server negotiate that the maximum amount of data to be transmitted this time is 6, so after the TCP client sends the sixth piece of data to the TCP server, it indicates that the data transmission is over. Then, the TCP client and the TCP server disconnect the TCP connection through the four-way handshake process.
[0101] For example, Figure 4 As shown, the four-wave process may include: the TCP client sends a disconnect TCP connection request message to the TCP server. For example, the FIN field in the disconnect TCP connection request message is set to 1 (which can be expressed as FIN=1), indicating that the TCP connection needs to be disconnected. The seq field in the disconnect TCP connection request message is set to x (which can be expressed as seq=x), where x is randomly generated by the TCP client.
[0102] The TCP server can reply to the TCP disconnect request message sent by the TCP client. For example, the FIN field in the message is set to 1 (which can be expressed as FIN=1), indicating that the TCP connection needs to be disconnected; the ACK field in the message is set to x+1 (which can be expressed as ACK=x+1), indicating that the TCP disconnect request sent by the TCP client has been verified; the seq field in the message is set to y (which can be expressed as seq=y), and y is randomly generated by the TCP server.
[0103] After the TCP server responds to the TCP disconnect request message sent by the TCP client, the TCP server will not disconnect the TCP connection immediately. The TCP server can first confirm whether the data to be transmitted has been transmitted to ensure that the data transmission is completed before disconnection. After confirming that the data to be transmitted has been transmitted, the TCP server sends a TCP disconnect request message to the TCP client. For example, the FIN field in the TCP disconnect request message is set to 1 (which can be expressed as FIN=1), indicating that the TCP connection needs to be disconnected. The ACK field in the TCP disconnect request message is set to y+1 (which can be expressed as ACK=y+1), indicating that the TCP connection disconnect request sent by the TCP client has been verified; the seq field in the TCP disconnect request message is set to z (which can be expressed as seq=z), and z is randomly generated by the TCP client.
[0104] After the TCP client receives the TCP disconnect request message sent by the TCP server, the TCP client can reply to the TCP disconnect request message sent by the TCP server. For example, the FIN field in the message is set to 1 (which can be expressed as FIN=1), indicating that the TCP connection needs to be disconnected; the ACK field in the message is set to z+1 (which can be expressed as ACK=z+1), indicating that the TCP disconnect request sent by the TCP client has been verified; the seq field in the message is set to h (which can be expressed as seq=h), and h is randomly generated by the TCP server. At this point, the four-wave process between the TCP client and the TCP server has been completed, and the TCP client and the TCP server disconnect the TCP connection.
[0105] based on Figure 3 and Figure 4 In the illustrated embodiment, it can be understood that the SYN flag is a message field used to identify three waved messages, and the FIN flag is a message field used to identify four waved messages.
[0106] Figure 5 A schematic diagram of another communication between a TCP client and a TCP server provided in an embodiment of the present application. For example, Figure 5 As shown, the communication process between the TCP client and the TCP server may include: a three-way handshake process, a TCP data transmission process, and a four-way handshake process. Figure 5 The TCP data transmission process includes a retransmission mechanism.
[0107] Combination Figure 5 As shown, the TCP data transmission process (including the retransmission mechanism) is illustrated here by way of example. For the three-way handshake process and the four-way handshake process, reference may be made to the above embodiments, which will not be described in detail here.
[0108] Among them, the retransmission mechanism may include: timeout retransmission, fast retransmission, selective acknowledgment (SACK), etc. Among them, timeout retransmission means that the sender sets a timer when sending a message. When the timer exceeds the timeout retransmission time (retransmission timeout, RTO), if the sender does not receive the acknowledgment (ACK) from the receiver, the sender retransmits the data. Usually, timeout retransmission is performed when data is lost or acknowledgment is lost.
[0109] Fast retransmit means that when the sender receives three identical ACKs, it retransmits the lost message. SACK means that the header of the TCP message sent by the receiver includes the SACK flag. After the sender receives the TCP message including the SACK flag, it can determine the lost data and retransmit the lost data. It should be noted that Figure 5 The TCP data transmission process is described by taking the retransmission mechanism of timeout retransmission as an example.
[0110] Still take the TCP client as the sender and the TCP server as the receiver as an example. Figure 5 As shown, after the TCP client sends a message to the TCP server (for example, message 1, in which the seq field is set to 1, indicating data with sequence number 1), when the timer exceeds the RTO, if the TCP client does not receive a confirmation response from the TCP server (the ACK field in the confirmation response is set to 2, indicating that the second data is expected to be received), the TCP client retransmits message 1.
[0111] Among them, TCP will time out and retransmit when the message is lost or the confirmation response is lost. For example, in the case of message loss, such as Figure 5 As shown, message 1 (the seq field in message 1 is set to 1, which can be expressed as seq=1) sent by the TCP client to the TCP server is lost, that is, the TCP server has not received message 1, so the TCP server will not return a confirmation response to the TCP client. Then, when the timer duration exceeds RTO, if the TCP client does not receive a confirmation response from the TCP server, the TCP client retransmits message 1. After the TCP server receives message 1, the TCP server returns a confirmation response to the TCP client. The ACK field in the confirmation response is set to 2, indicating that the second copy of the data is expected to be received.
[0112] As another example, in the case where the confirmation response is lost, Figure 5 As shown in the figure, the TCP client sends message 1 to the TCP server. After receiving message 1, the TCP server returns a confirmation response to the TCP client. Figure 5 As shown in the figure, the confirmation response returned by the TCP server to the TCP client is lost, that is, the TCP client does not receive the confirmation response. In this way, when the timer exceeds the RTO, if the TCP client does not receive the confirmation response from the TCP server, the TCP client retransmits message 1. After the TCP server receives message 1, the TCP server returns a confirmation response to the TCP client. The ACK field in the confirmation response is set to 2, indicating that the second data is expected to be received.
[0113] The above embodiment mainly introduces the process of establishing a TCP connection and disconnecting a TCP connection between a TCP client and a TCP server. Among them, the TCP client and the TCP server mainly establish a TCP connection, transmit data, and disconnect the TCP connection by transmitting TCP messages. In addition, in the related art, when the TCP client is used as a sender and the TCP server is used as a receiver, the transmission of TCP messages is realized through a router, that is, the router is used as an intermediate forwarding device, which is mainly used to forward TCP messages transmitted between the TCP client and the TCP server.
[0114] Among them, multiple TCP messages transmitted through the same port can be called a data stream. In other words, the router can forward the data stream transmitted between the TCP client and the TCP server. Based on this, in an embodiment of the present application, the bandwidth of the current transmission data stream can be predicted by the router to more accurately reflect the current network status, that is, reflect the actual usage of the network.
[0115] In addition, since the router in the related technology acts as an intermediate forwarding device with the function of forwarding TCP messages, the bandwidth of the current transmission data stream can be predicted by the router, and the bandwidth of the current transmission data stream can also be predicted without affecting the network performance of the TCP client and TCP server.
[0116] The following embodiments illustrate the specific implementation process of a router predicting the bandwidth of a current transmission data stream.
[0117] Exemplarily, in a scenario where the router is in an operating system kernel (Linux), TCP packets are transmitted at protocol layers (such as network layer, link layer, physical layer, forwarding layer, and transport layer). Figure 6 A schematic diagram of the structure of the netfilter framework of a router in a Linux scenario is provided. Among them, the Linux IP protocol stack is a four-layer or higher protocol stack (also called a top-level protocol stack). Figure 6 As shown, the netfilter framework includes six key hook points (also called detection points, key points or hook points), which include pre-routing nodes, routing decision nodes, key nodes (forward), post-routing nodes (post-routing), entry nodes (local_in) and exit nodes (local_out). Among them, the pre-routing node mainly handles destination address conversion and adds specific tags to each TCP message in the data stream. The routing decision node is used to decide whether the data stream is forwarded. The post-routing node is mainly used to complete source address conversion.
[0118] Exemplarily, each TCP message in the data stream forwarded by the router will pass through the three hook points of the routing pre-processing node, the key node, and the routing post-processing node. In the embodiment of the present application, the hook interface can be registered at the key node. Optionally, the hook interface can be expressed as: atp_static_netband_process.
[0119] For example, Figure 6 As shown, each TCP message in the data stream passes through the pre-processing node and arrives at the routing decision node. If the routing decision node decides that each TCP message in the data stream is forwarded, then for each TCP message in the data stream that needs to be forwarded, the hook interface is called at the key node to identify the message length of each TCP message in the data stream, identify the sequence number of each TCP message in the data stream, and identify the flag bit of each TCP message in the data stream.
[0120] Among them, the message length of each TCP message in the data stream is identified to determine the amount of data transmitted in the data stream per unit time, so as to predict the bandwidth. The sequence number of each TCP message in the data stream is identified to determine whether there is retransmission data. The flag bit of each TCP message in the data stream is identified to determine whether the transmission of the data stream has ended.
[0121] Exemplarily, the total length field in the TCP message includes the message length. Taking the packet captured by the network packet analysis software (wireshark) as an example, for example, the total length field is: _be16 tot_len; indicating that the message length is 16 bits.
[0122] For another example, the protocol field of each TCP message in the data stream includes a protocol type. For example, the protocol field is: protocol: TCP (6), indicating that the protocol type corresponding to the data stream is the TCP protocol.
[0123] For another example, the header field (or head field) included in the TCP message includes a sequence number and a flag. For example, the header field includes: sequence number: 4342 (relative sequence number); indicating that the sequence number of the TCP message is 4342. For example, the header field includes: FIN = 1; indicating that the data stream has been transmitted.
[0124] As an example, the router can search the stored hash table for the message length, sequence number, and flag of each TCP message in the data stream based on the five-tuple information. Optionally, when forwarding the data stream, the router can parse the IP information of each TCP message in the data stream and convert the IP information into five-tuple information.
[0125] The five-tuple information includes the source IP address, the destination IP address, the source port number, the destination port number, and the protocol type (such as TCP protocol, UDP protocol, etc.). The hash table includes the correspondence between the five-tuple information of the data flow and the data information (i.e., the message length, sequence number, and flag bit of each TCP message in the data flow). It is worth noting that the five-tuple information of the data flow is unique, that is, the data flow and the five-tuple information correspond one to one.
[0126] In some embodiments, the router may store the five-tuple information and data information of the data flow in a key-value format in a hash table, wherein the five-tuple information may be considered as a key and the data information may be considered as a value. After the information is stored in the hash table, the router has the information required to predict the bandwidth.
[0127] In some embodiments, after the router obtains the five-tuple information corresponding to the data flow, the five-tuple information can be used as a key to search for the corresponding data information in the Hash table. If the router does not find the corresponding data information in the Hash table, the router will identify the data information corresponding to the data flow, store the identified data information in the Hash table, and predict the bandwidth based on the data information. If the router finds the corresponding data information in the Hash table, the router obtains the data information and predicts the bandwidth based on the data information.
[0128] In combination with the above embodiments, refer to the following Figure 7 , describes the bandwidth prediction method provided in the embodiment of the present application, wherein the routing and forwarding device may be a router, a three-layer switch, etc. The routing and forwarding device may have Figure 2 The processing performed by a single execution subject (routing and forwarding device) shown in the embodiments of the present application may also be divided into multiple execution subjects, which may be logically and / or physically separated without limitation.
[0129] Figure 7 A flow chart of a bandwidth prediction method provided in an embodiment of the present application is as follows: Figure 7 As shown, the method may include the following steps.
[0130] Step 401: The routing and forwarding device transmits N data streams in the first cycle, where N is a positive integer.
[0131] The first period may be preset by the routing and forwarding device; there is no specific limitation on the first period, which is subject to actual settings. For example, the first period may be 5s, 10s or other suitable periods.
[0132] Combination Figure 1In the communication system shown, the routing and forwarding device may establish communication connections with multiple terminal devices (such as mobile phones, tablet computers, laptops, etc.). Exemplarily, the N data streams may be data streams sent by multiple terminal devices forwarded by the routing and forwarding device in the first cycle, or forwarded data streams received by multiple terminal devices. Alternatively, the N data streams may also be data streams sent by a terminal device forwarded by the routing and forwarding device in the first cycle, or forwarded data streams received by a terminal device.
[0133] Each of the N data flows corresponds to a message of a different port. That is, the ports of the TCP messages in a data flow are the same (such as the same source port number and the same destination port number) and the protocol type is the same (such as both are TCP protocols).
[0134] Step 402: For each data stream in the N data streams, the routing and forwarding device obtains the message length of multiple messages included in the data stream, and determines a first bandwidth corresponding to the data stream according to the message length.
[0135] Bandwidth refers to the rate of data transmission per unit time (in bits per second (bps)), and bandwidth can be determined by the ratio of flow rate to time. Flow rate refers to the amount of data transmitted per unit time (i.e., data length). Therefore, in the embodiment of the present application, the amount of data in the transmitted data stream can be determined based on the message length (i.e., the flow rate is determined), and then the first bandwidth is determined based on the flow rate.
[0136] Exemplarily, the routing forwarding device first determines the data volume of the data flow transmitted in the first period (ie, determines the flow) according to the message length of multiple messages included in the data flow, and then uses the ratio of the flow to the first period as the first bandwidth.
[0137] It should be noted that if the data stream does not include retransmission messages, the routing forwarding device can use the ratio of the above determined flow rate to the first period as the first bandwidth. If the data stream includes retransmission messages, the impact of retransmission on bandwidth needs to be considered.
[0138] For example, Figure 8 As shown, it is assumed that a data stream transmitted by the routing forwarding device in the first cycle includes Figure 8 On this basis, the routing forwarding device can determine the first bandwidth based on a preset timeout retransmission interval, sampling retransmission messages transmitted within the timeout retransmission interval, and normal messages transmitted outside the timeout retransmission interval.
[0139] The timeout retransmission interval can be set based on the duration of the retransmission timer. Exemplarily, the timeout retransmission interval is an integer multiple of the duration of the retransmission timer (or retransmission timeout RTO). For example, the timeout retransmission interval is two, three or four times the duration of the retransmission timer, etc., without limitation.
[0140] It is understandable that TCP monitors the loss status of a message by setting a retransmission timer when sending a message. If the sender has not received a confirmation response when the retransmission timer times out, the sender retransmits the message. Based on this, in an embodiment of the present application, a timeout retransmission interval is set based on the length of the retransmission timer, so that the retransmitted message can be sampled within the timeout retransmission interval as much as possible.
[0141] For example, Figure 8 As shown, the timeout retransmission interval preset by the router is t2 (or the second duration), then the remaining time interval in the first cycle is T-t2 (or the first duration, represented by t1), where T represents the first cycle.
[0142] For example, Figure 8 As shown, in the first period T, the data stream transmitted by the routing and forwarding device includes multiple messages. For example, in the first time length t1, the routing and forwarding device transmits n messages, such as message seq1, message seq2, message seq3, ..., message seqn; the message lengths are respectively: L1, L2, L3, ..., Ln.
[0143] Within the second time length t2, the routing forwarding device transmits message seq(n+1), message seq(n+2), message seq(a), message seq(b), ..., seq(m), ..., message seq(2n); the message lengths are Ln+1, Ln+2, La, Lb, ..., Lm, ..., L2n respectively.
[0144] It should be noted that the retransmission message transmitted within the second time period may be a retransmission message of some messages in the above n messages (message seq1, message seq2, message seq3, ..., message seqn); or, it may be a retransmission message of all messages in the above n messages; or, it may not be a retransmission message of the above n messages, for example, it may be a retransmission message in other messages. No limitation is given.
[0145] based on Figure 8For the data flow shown, the routing and forwarding device can determine the data volume of normal messages transmitted within the first time period, and determine the data volume of retransmitted messages transmitted within the second time period. Then, the routing and forwarding device determines the first bandwidth according to the data volume of normal messages transmitted within the first time period, the data volume of retransmitted messages transmitted within the second time period, the data volume of all messages transmitted within the second time period, and the first time period and the second time period.
[0146] It should be noted that, in the embodiment of the present application, a normal message refers to a message that is sent once by the sender and is sent successfully.
[0147] Optionally, the first bandwidth may satisfy the following expression:
[0148] Wherein, Bi represents the first bandwidth, Indicates the data volume of normal messages transmitted within the first time period. Indicates the data volume of the retransmitted message transmitted within the second time period; It represents the data volume of all messages transmitted in the second time period, t1 represents the first time period, and t2 represents the second time period.
[0149] In the above expression, the first bandwidth is the ratio of the data volume of the normal message transmitted in the first period to the time. The time is related to the time of the normal message transmitted in the first time length and the proportion of the retransmitted message transmitted in the second time length. In this way, when the bandwidth is determined by using the above expression, the proportion of the retransmitted message transmitted in the first period is taken into account, so that the determined first bandwidth can be more accurate.
[0150] It should be noted that, in actual implementation, the message transmitted within the first time length may not include retransmission messages, or may include some retransmission messages, or may be all retransmission messages. Correspondingly, the message transmitted within the second time length may not include retransmission messages, or may include some retransmission messages, or may be all retransmission messages. Based on the above different situations, the first bandwidth determined by the above expression will also be different. The following examples illustrate various different situations of determining the first bandwidth by using the above expression.
[0151] Case 1: the messages transmitted within the first time period do not include retransmitted messages, and the messages transmitted within the second time period include some retransmitted messages.
[0152] Exemplary, combined Figure 8 And the above expression, n first messages are transmitted normally in the first time length, b messages are transmitted normally in the second time length, including a retransmitted messages. Then, the first bandwidth is the ratio of the amount of data transmitted in the first time length to the sum of the time for transmitting the retransmitted messages in the second time length and the first time length.
[0153] Case 2: All the messages transmitted in the first time period are retransmission messages, and all the messages transmitted in the second time period are retransmission messages. In this way, combined with the above expression, due to represents the data volume of the first message normally transmitted within the first time length. Therefore, when all the messages transmitted within the first time length are retransmitted messages, If the value of is 0, the value of the first bandwidth is 0, indicating that the current network of the routing and forwarding device is abnormal, and the terminal device does not send data flow through the routing and forwarding device, that is, no traffic is generated.
[0154] Case 3: The messages transmitted in the first time period include some retransmitted messages, and the messages transmitted in the second time period do not include retransmitted messages. In actual determination, the routing forwarding device uses the messages normally transmitted in the first time period and ignores the retransmitted messages transmitted in the first time period. The value of is 0, and the first bandwidth is the ratio of the data volume of the message normally transmitted within the first time length to the first time length.
[0155] It should be noted that the above step 402 takes one data stream as an example to exemplify the specific implementation process of determining the first bandwidth. For the specific implementation process of the first bandwidth corresponding to other data streams, reference may be made to the above embodiment, which will not be described in detail here.
[0156] Step 403: The routing and forwarding device determines the sum of the first bandwidths for transmitting N data streams in the first period based on the first bandwidth corresponding to each data stream.
[0157] Exemplarily, the first bandwidth and satisfies the following expression:
[0158] Among them, Bt1 represents the first bandwidth, and Bi represents the first bandwidth corresponding to each data stream.
[0159] Step 404: The routing and forwarding device determines a target bandwidth based at least on the first bandwidth and the target bandwidth, wherein the target bandwidth is a maximum bandwidth when transmitting N data streams.
[0160] Optionally, the routing and forwarding device uses the first bandwidth and as the target bandwidth. For example, the target bandwidth B=Bt1. The reason why the first bandwidth and is used as the target bandwidth, that is, as the maximum bandwidth when transmitting N data streams, is that the first bandwidth and is determined in real time in the embodiment of the present application, that is, the first bandwidth and is currently determined is the latest bandwidth of the current routing and forwarding device. Therefore, using the first bandwidth and as the target bandwidth can more accurately reflect the current network status, that is, reflect the actual usage of the current network.
[0161] Optionally, the routing and forwarding device may also use the sum of the first bandwidths determined in the previous cycle as the target bandwidth. Alternatively, the routing and forwarding device may also use the sum of the first bandwidths determined in the next cycle as the target bandwidth. Alternatively, the routing and forwarding device uses the average of the sum of the first bandwidths of two adjacent cycles as the target bandwidth.
[0162] In summary, by adopting the solution of the embodiment of the present application, when the routing and forwarding device transmits N data streams in the first cycle, the routing and forwarding device determines the first bandwidth corresponding to each data stream for each of the N data streams, thereby determining the first bandwidth sum when transmitting the N data streams in the first cycle, and determining the maximum bandwidth when the routing and forwarding device transmits the N data streams based on the first bandwidth sum. In this way, by predicting the maximum bandwidth when the current data stream is transmitted through the routing and forwarding device, the current network status can be more accurately reflected, that is, the actual usage of the network can be reflected.
[0163] As an example, as time goes by, the routing and forwarding device can also determine the sum of the bandwidths of all data streams transmitted in the next period and update the target bandwidth. That is, the routing and forwarding device can periodically determine the sum of the bandwidths of all data streams transmitted in the period and update the target bandwidth in real time. For example, Fig. 9 As shown, the method may also include the following steps:
[0164] Step 501: The routing and forwarding device transmits M data streams in the second period, where M is a positive integer.
[0165] Step 502: For each data stream in the M data streams, the routing and forwarding device obtains the message length of multiple messages included in the data stream, and determines a second bandwidth corresponding to the data stream according to the message length.
[0166] Step 503: The routing and forwarding device determines the sum of the second bandwidths for transmitting the M data streams in the second period based on the second bandwidth corresponding to each data stream.
[0167] For the example description of step 501 to step 503 , reference may be made to step 401 to step 403 in the above embodiment, which will not be described in detail here.
[0168] Step 504: The routing and forwarding device determines a target bandwidth according to the first bandwidth sum and the second bandwidth sum.
[0169] In an embodiment of the present application, the routing forwarding device can periodically predict the bandwidth of the current transmission data stream, so that the periodically predicted bandwidth can more accurately reflect the current network status, that is, reflect the actual usage of the network.
[0170] The second bandwidth sum may be expressed as Bt2. Optionally, if the second bandwidth sum is greater than the first bandwidth sum, the routing and forwarding device updates the second bandwidth sum to the target bandwidth. That is, if Bt2>Bt1, then update B=Bt2.
[0171] Optionally, if the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase ratio is greater than the retransmission ratio, the routing forwarding device updates the target bandwidth to the second bandwidth sum. That is, if Bt2<Bt1, and ΔB>Rt, then update B=Bt2. The bandwidth increase ratio ΔB is used to indicate the bandwidth increase rate of the second period compared to the first period; the retransmission ratio Rt is used to indicate the proportion of retransmissions occurring in the first period.
[0172] Optionally, if the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase ratio is less than the retransmission ratio, the target bandwidth is retained as the first bandwidth sum. That is, if Bt2<Bt1, and ΔB<Rt, then B=Bt1 is retained.
[0173] Exemplarily, the bandwidth increase ratio satisfies the following expression: ΔB=(Bt1-Bt2) / Bt2; wherein ΔB represents the bandwidth increase ratio, Bt2 represents the second bandwidth sum, and Bt1 represents the first bandwidth sum.
[0174] Exemplarily, the retransmission ratio satisfies the following expression: Among them, Rt represents the retransmission ratio, Indicates the amount of data transmitted in the first cycle. Indicates the data volume of all messages transmitted in the first cycle.
[0175] In the embodiment of the present application, if ΔB>Rt, it means that the bandwidth increase rate is greater than the retransmission ratio, so it can be considered that in the case of a retransmission mechanism, the bandwidth weakening effect of retransmission is not as good as the bandwidth enhancement, so the maximum bandwidth B is updated to the second bandwidth and Bt2, that is, B=Bt2. Correspondingly, if ΔB<Rt, it means that the bandwidth increase rate is greater than the retransmission ratio, so it can be considered that in the case of a retransmission mechanism, the bandwidth weakening effect of retransmission is stronger, and the weakening effect of retransmission on bandwidth needs to be considered, so the maximum bandwidth B is retained as the first bandwidth and Bt1, that is, B=Bt1.
[0176] Based on this, taking into account the impact of retransmission on bandwidth, in an embodiment of the present application, the routing forwarding device periodically determines the sum of the bandwidths of all data streams transmitted in each cycle, and dynamically adjusts the target bandwidth based on the bandwidth increase ratio and the retransmission ratio, so that the predicted maximum bandwidth of the current transmission data stream is more accurate, and can more accurately reflect the current network status, that is, reflect the actual usage of the network.
[0177] In some embodiments, the method may further include: the routing forwarding device displays the target bandwidth; or, the routing forwarding device sends indication information to the terminal device; wherein the indication information includes the target bandwidth, and the indication information is used to instruct the terminal device to display the target bandwidth.
[0178] In this embodiment, the target bandwidth is displayed by the routing and forwarding device, or the target bandwidth is displayed by the terminal device, so that the user can more accurately measure the network status, confirm whether the bandwidth is overloaded or whether the bandwidth package purchased by the user meets the actual needs, etc. Further, for the problem of slow network speed caused by network congestion due to the home environment (such as too many terminal devices accessing the communication network through the routing and forwarding device, etc.), the routing and forwarding device displays the target bandwidth, or the terminal device displays the target bandwidth, so that the user can easily confirm whether it is caused by too small bandwidth or excessive bandwidth, which is convenient for the user to troubleshoot and improve the user experience.
[0179] In some embodiments, the method may further include: the routing and forwarding device allocates a target bandwidth to the terminal device based on an application scenario of the terminal device.
[0180] Optionally, the routing and forwarding device can obtain the media access control address (MAC) of the terminal device and determine the application scenario of the terminal device according to the media access address of the terminal device. Optionally, the routing and forwarding device can also allocate corresponding bandwidth to the terminal device based on the Internet protocol address (IP) corresponding to the terminal device.
[0181] Exemplarily, if the application scenario of the terminal device is the first application scenario, the routing and forwarding device allocates a first target bandwidth to the terminal device; if the application scenario of the terminal device is the second application scenario, the routing and forwarding device allocates a second target bandwidth to the terminal device; wherein the bandwidth required for the first application scenario is greater than the bandwidth required for the second application scenario, and the first target bandwidth is greater than the second target bandwidth.
[0182] Assuming the target bandwidth is 10 bps, for example, if the application scenario of the terminal device is a game scenario, the routing forwarding device allocates a first target bandwidth (such as 8 bps) to the terminal device. If the application scenario of the terminal device is a video scenario, the routing forwarding device allocates a second target bandwidth (such as 2 bps) to the terminal device.
[0183] In this embodiment, the routing and forwarding device allocates different bandwidths to terminal devices in different application scenarios based on the predicted target bandwidth, thereby increasing the network rate of the terminal device in the application scenario and improving the user experience.
[0184] It should be noted that the contents recorded in each embodiment of the present application can explain and illustrate the technical solutions in other embodiments of the present application, and the technical features recorded in each embodiment can also be applied in other embodiments and combined with the technical features in other embodiments to form a new solution. The present application only exemplarily lists several embodiments for illustration, and does not mean that the present application is limited to this.
[0185] An embodiment of the present application further provides a communication device, which includes a processor, and is used to implement the method in any of the above method embodiments.
[0186] Optionally, the communication device further includes a memory. The memory is used to store necessary program instructions and data, and the processor can call the program code and instructions stored in the memory to enable the communication device to execute the method in any of the above method embodiments. Of course, the memory may not be in the communication device.
[0187] Optionally, the communication device also includes an interface circuit, which is a code / data reading and writing circuit, and the interface circuit is used to receive the determination machine execution instruction (the determination machine execution instruction is stored in the memory, may be read directly from the memory, or may pass through other devices) and transmit it to the processor.
[0188] Optionally, the communication device further includes a communication interface, and the communication interface is used to communicate with a module outside the communication device.
[0189] It can be understood that the communication device can be a chip or a chip system. When the communication device is a chip system, it can be composed of chips, or it can include chips and other discrete devices. The embodiments of the present application do not specifically limit this.
[0190] The embodiment of the present application also provides a routing forwarding device, which includes: a memory and one or more processors. The memory is used to store determination machine instructions, and when the routing forwarding device is running, the processor executes the determination machine instructions in the memory to enable the routing forwarding device to perform various functions or steps performed by the above-mentioned site device.
[0191] The present application also provides a chip system for use in a communication device. Fig.10 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 may be Figure 2 The processor 201 is shown. The interface circuit 1102 may be, for example, an interface circuit between the processor 1101 and other devices (such as the transceiver 102).
[0192] The processor 1101 and the interface circuit 1102 may be interconnected via lines. For example, the interface circuit 1102 may be used to receive signals from other devices (e.g., the processor 1101). For another example, the interface circuit 1102 may be used to send signals to other devices (e.g., the processor 1101). Exemplarily, the interface circuit 1102 may read instructions stored in a memory and send the instructions to the processor 1101. When the instructions are executed by the processor 1101, the site device may perform the various functions or steps performed by the site device in the above-mentioned embodiment. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0193] An embodiment of the present application further provides a determination machine readable storage medium, which includes a determination machine instruction. When the determination machine instruction is executed on a site device, the site device executes any one of the methods in the above method embodiments.
[0194] The embodiment of the present application also provides a determination machine program product. When the determination machine program product runs on a determination machine, the determination machine executes any one of the methods in the above method embodiments.
[0195] It should be noted that the terms "first" and "second" in the specification, claims and drawings of this application are used to distinguish different objects rather than to describe a specific order. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "multiple" means two or more.
[0196] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0197] It should be understood that in the present application, "at least one (item)" refers to one or more. "Multiple" refers to two or more. "At least two (items)" refers to two or three and more than three. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple. “When” and “if” both mean that corresponding measures will be taken under certain objective circumstances. It does not limit the time, nor does it require any judgment when it is implemented, nor does it mean that there are other limitations.
[0198] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.
[0199] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules according to the system, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0200] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0201] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0202] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0203] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0204] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A bandwidth prediction method, characterized in that: Applied in a routing forwarding device, the routing forwarding device establishes a communication connection with a terminal device, and is used to forward a data stream sent by the terminal device, or forward a data stream received by the terminal device; the method comprises: In the first cycle, N data streams are transmitted, where N is a positive integer; For each of the N data streams, obtaining a message length of a plurality of messages included in the data stream, and determining a first bandwidth corresponding to the data stream according to the message length; Determine, based on the first bandwidth corresponding to each of the N data streams, a sum of first bandwidths when transmitting the N data streams in the first period; A target bandwidth is determined based at least on the first bandwidth and the target bandwidth being a maximum bandwidth when transmitting the N data streams.
2. The method according to claim 1, characterized in that The method further comprises: In the second cycle, M data streams are transmitted; M is a positive integer; For each data stream of the M data streams, obtaining a message length of a plurality of messages included in the data stream, and determining a second bandwidth corresponding to the data stream according to the message length; Determine, based on the second bandwidth corresponding to each of the M data streams, a second sum of bandwidths for transmitting the M data streams within the second period; The step of determining the target bandwidth at least based on the first bandwidth and includes: The target bandwidth is determined according to the first bandwidth sum and the second bandwidth sum.
3. The method according to claim 2, characterized in that The determining the target bandwidth according to the first bandwidth sum and the second bandwidth sum includes: If the second bandwidth sum is greater than the first bandwidth sum, determining the target bandwidth to be the second bandwidth sum; or, If the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase ratio is greater than the retransmission ratio, the target bandwidth is determined to be the second bandwidth sum; wherein the bandwidth increase ratio is used to indicate the bandwidth increase rate of the second period compared with the first period; and the retransmission ratio is used to indicate the ratio of retransmissions occurring in the first period; or, If the second bandwidth sum is smaller than the first bandwidth sum, and the bandwidth increase ratio is smaller than the retransmission ratio, the target bandwidth is retained as the first bandwidth sum.
4. The method according to any one of claims 1 to 3, characterized in that The determining, according to the message length, a first bandwidth corresponding to the data flow includes: Determining, according to the message lengths of the multiple messages, a data volume of the data stream transmitted in a first period; A first bandwidth corresponding to the data stream is determined according to the data volume of the data stream transmitted in the first period and the first period.
5. The method according to claim 4, characterized in that The first cycle includes a preset first duration and a second duration, the second duration is related to a retransmission timeout RTO, and the first duration is a difference between the first cycle and the second duration; The determining, according to the amount of data of the data stream transmitted in the first period and the first period, a first bandwidth corresponding to the data stream includes: Determine the data volume of normal messages transmitted within the first time length, the data volume of retransmitted messages transmitted within the second time length, and the data volume of all messages transmitted within the second time length; The first bandwidth corresponding to the data stream is determined based on the data volume of normal messages transmitted within the first time period, the data volume of retransmitted messages transmitted within the second time period, the data volume of all messages transmitted within the second time period, the first time period and the second time period.
6. The method according to claim 5, characterized in that The determining a first bandwidth corresponding to the data stream includes: The first bandwidth corresponding to the data stream satisfies the following expression: Wherein, Bi represents the first bandwidth corresponding to the data stream, represents the data volume of normal messages transmitted within the first time period, The data volume of the retransmitted message transmitted within the second time period; It represents the data volume of all messages transmitted within the second time period, t1 represents the first time period, and t2 represents the second time period.
7. The method according to any one of claims 3 to 6, characterized in that: The bandwidth increase ratio satisfies the following expression: ΔB=(Bt2-Bt1) / Bt1; Wherein, ΔB represents the bandwidth increase ratio, Bt2 represents the second bandwidth sum, and Bt1 represents the first bandwidth sum.
8. The method according to any one of claims 3 to 7, characterized in that: The retransmission ratio satisfies the following expression: Among them, Rt represents the retransmission ratio, represents the data volume of the retransmitted message transmitted in the first period, Indicates the data volume of all messages transmitted in the first cycle.
9. The method according to any one of claims 1 to 8, characterized in that The method further includes: The routing and forwarding device displays the target bandwidth; or, The routing and forwarding device sends indication information to the terminal device; the indication information includes the target bandwidth, and the indication information is used to instruct the terminal device to display the target bandwidth.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: The routing and forwarding device allocates the target bandwidth to the terminal device based on the application scenario of the terminal device.
11. The method according to claim 10, characterized in that The routing and forwarding device allocates the target bandwidth to the terminal device based on the application scenario of the terminal device, including: If the application scenario of the terminal device is the first application scenario, the routing and forwarding device allocates a first target bandwidth to the terminal device; If the application scenario of the terminal device is the second application scenario, the routing and forwarding device allocates a second target bandwidth to the terminal device; The bandwidth required by the first application scenario is greater than the bandwidth required by the second application scenario, and the first target bandwidth is greater than the second target bandwidth.
12. A routing and forwarding device, characterized in that: include: memory and one or more processors; The memory stores a determination machine program code, wherein the determination machine program code includes a determination machine instruction; when the determination machine instruction is executed by the processor, the method according to any one of claims 1 to 11 is executed.
13. A chip system, characterized in that: The chip system includes: at least one processor and an interface; The interface is used to receive instructions and transmit the instructions to the at least one processor; the at least one processor executes the instructions so that the method according to any one of claims 1 to 11 is executed.
14. A machine-readable storage medium, characterized in that: It comprises a determination machine instruction, and when the determination machine instruction is executed on the routing and forwarding device, the method according to any one of claims 1 to 11 is executed.
Citation Information
Patent Citations
Method and apparatus for rate control of single quality media streams in selective forwarding units
CA3244333A1
Apparatus for multi-link data distribution / concentration to aggregate bandwidth in multi-connection wireless network
KR1020110016749A
Controlling packet transmission
US20100150171A1
Facilitating real-time transport of data streams
US20220109717A1
Apparatus for and method of managing bandwidth for a packet based connection
US6493316B1