Bandwidth prediction method and routing forwarding device

By transmitting data streams within a period through routing and forwarding devices, obtaining packet lengths, and adjusting bandwidth, the problem of inaccurate traffic reflection is solved, enabling accurate prediction and optimization of network conditions and improving user experience.

CN119892659BActive Publication Date: 2026-04-28HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2023-10-16
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing technologies, there is a discrepancy between the network status reflected by traffic and the actual network usage, especially under conditions of network interference and coverage anomalies, which leads to inaccurate reflection of network status.

Method used

After establishing a communication connection with the terminal device, the routing and forwarding device obtains the message length of each data stream by transmitting N data streams in the first cycle, calculates the first bandwidth, and then determines the maximum bandwidth. In the second cycle, it adjusts the bandwidth prediction, taking into account the retransmission ratio and the bandwidth increase ratio, and dynamically adjusts the target bandwidth to reflect the actual network usage.

Benefits of technology

By periodically predicting bandwidth, the actual network usage can be reflected more accurately, helping users to identify whether the bandwidth is overloaded or exceeded, improving user experience and optimizing network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892659B_ABST
    Figure CN119892659B_ABST
Patent Text Reader

Abstract

The application provides a bandwidth prediction method and a routing forwarding device, relates to the technical field of communication, and can solve the problem that the network condition is reflected by traffic, thereby causing difference from the actual use of the network. The method is applied to the routing forwarding device, and the method comprises the following steps: a routing forwarding device transmits N data streams in a first period; for each data stream in the N data streams, the packet length of a plurality of packets included in the data stream is acquired, and the first bandwidth when the data stream is transmitted is determined according to the packet length; the routing forwarding device determines the first bandwidth sum when the N data streams are transmitted in the first period based on the first bandwidth corresponding to each data stream in the N data streams; and the routing forwarding device determines a target bandwidth according to at least the first bandwidth sum.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a bandwidth prediction method and a routing and forwarding device. Background Technology

[0002] With the development of wireless communication technology, routers have become widely used, enabling terminal devices to transmit data through routers in wireless communication systems. In related technologies, during data transmission between the terminal device and the router, the router can provide feedback on the current internet traffic, reflecting the network status through this traffic flow.

[0003] Traffic volume refers to the amount of data sent and received by a terminal device at a specific point in time (i.e., the total amount of data), and does not represent the actual network usage at present. Furthermore, in scenarios such as network interference or abnormal network coverage, terminal devices may experience packet loss and retransmission issues during data transmission through routers. Therefore, using traffic volume to reflect network conditions in these scenarios may differ from actual network usage. Summary of the Invention

[0004] This application provides a bandwidth prediction method and a routing and forwarding device to solve the problem in related technologies where network conditions are reflected by traffic, resulting in a discrepancy with the actual network usage.

[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:

[0006] Firstly, a bandwidth prediction method is provided, applied in a routing and forwarding device. This device establishes a communication connection with a terminal device to forward data streams sent by the terminal device or data received by the terminal device. The method includes: the routing and forwarding device transmitting N data streams in a first period; for each of the N data streams, obtaining the message lengths of multiple packets included in the data stream, and determining a first bandwidth for transmitting the data stream based on the message lengths; then, based on the first bandwidth corresponding to each of the N data streams, determining the sum of first bandwidths for transmitting the N data streams in the first period; finally, the routing and forwarding device determining a target bandwidth, i.e., determining the maximum bandwidth for transmitting the N data streams, based at least on the sum of first bandwidths.

[0007] Based on the first aspect, when a routing and forwarding device transmits N data streams in the first cycle, it determines the first bandwidth corresponding to each of the N data streams, thereby determining the sum of the first bandwidths for transmitting N data streams in the first cycle. Based on this sum of first bandwidths, the maximum bandwidth for transmitting N data streams by the routing and forwarding device is determined. Thus, predicting the maximum bandwidth for the current data stream transmission by the routing and forwarding device can more accurately reflect the current network condition, i.e., the actual network usage.

[0008] In one possible implementation of the first aspect, the method includes: a routing and forwarding device transmitting M data streams within a second period; for each of the M data streams, the routing and forwarding device obtaining the message length of multiple packets included in the data stream, and determining a second bandwidth corresponding to the data stream based on the message length; then, based on the second bandwidth corresponding to each of the M data streams, the routing and forwarding device determining a second bandwidth sum when transmitting the M data streams within the second period; finally, the routing and forwarding device determining a target bandwidth based on a first bandwidth sum and a 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, and thus determine the target bandwidth based on the first bandwidth and the second bandwidth. In other words, the routing and forwarding device can periodically predict the bandwidth of the currently transmitted data streams, and by periodically predicting the bandwidth, it can more accurately reflect the current network status, that is, reflect the actual usage of the network.

[0010] Optionally, the second cycle is the cycle following the first cycle.

[0011] In one possible implementation of the first aspect, determining the target bandwidth based on the first bandwidth sum and the second bandwidth sum includes: if the second bandwidth sum is greater than the first bandwidth sum, then determining the target bandwidth as the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum, then determining the target bandwidth as the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase rate is greater than the retransmission rate, then determining the target bandwidth as the second bandwidth sum; or, if the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase rate is less than the retransmission rate, then retaining the target bandwidth as the first bandwidth sum. Wherein, the bandwidth increase rate indicates the bandwidth increase rate of the second period compared to the first period; the retransmission rate indicates the proportion of retransmissions occurring within the first period.

[0012] In this implementation, considering the impact of retransmission on bandwidth, the routing and forwarding device periodically determines the bandwidth of all data streams transmitted in each period, and dynamically adjusts the target bandwidth based on the bandwidth increase ratio and retransmission ratio, so that the predicted bandwidth of the current 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] Where ΔB represents the bandwidth increase rate, Bt2 represents the second bandwidth sum, and Bt1 represents the first bandwidth sum.

[0016] Optionally, the retransmission ratio satisfies the following expression:

[0017]

[0018] Where Rt represents the retransmission ratio. This indicates the amount of data in the retransmitted messages transmitted within the first period. This represents the total data volume of all messages transmitted within the first period.

[0019] In one possible implementation of the first aspect, determining the first bandwidth for data flow comparison based on message length includes: the routing and forwarding device determining the amount of data in the data flow transmitted within a first period based on the message lengths of multiple messages; and the routing and forwarding device determining the first bandwidth corresponding to the data flow based on the amount of data in the data flow transmitted within the first period and the first period.

[0020] Optionally, if the data stream does not include retransmission messages, the first bandwidth is the ratio of the amount of data transmitted in the first period to the amount transmitted in the first period.

[0021] In one possible implementation of the first aspect, the first period includes a first duration and a second duration of the pre-installed device, the second duration being related to the retransmission timeout (RTO), and the first duration being the difference between the first period and the second duration. The routing and forwarding device determines the first bandwidth corresponding to the data stream based on the amount of data transmitted within the first period and the first period, including: the routing and forwarding device determining the amount of data of normal messages transmitted within the first duration, the amount of data of retransmitted messages transmitted within the second duration, and the amount of data of all messages transmitted within the second duration; the routing and forwarding device determines the first bandwidth corresponding to the data stream based on the amount of data of normal messages transmitted within the first duration, the amount of data of retransmitted messages transmitted within the second duration, the amount of data of all messages transmitted within the second duration, the first duration, and the second duration.

[0022] In this implementation, the first bandwidth is the ratio of the amount of data in a normal message transmitted within a first period to the time. This time is related to the detection time transmitted within the first duration and the proportion of retransmitted messages transmitted within the second duration. Therefore, by taking into account the proportion of retransmitted messages transmitted within the first period, the determined first bandwidth can be 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. This represents the amount of data in normal messages transmitted within the first time period. The amount of data in the retransmitted message transmitted within the second time period; t1 represents the data volume of all messages transmitted within the second duration, t2 represents the first duration, and t2 represents the second duration.

[0026] In one possible implementation of the first aspect, the method further includes: the routing and forwarding device displaying the target bandwidth; or, the routing and forwarding device sending indication information to the terminal device, the indication information including the target bandwidth, the indication information being used to instruct the terminal device to display the target bandwidth.

[0027] In this implementation, displaying the target bandwidth by the routing and forwarding device or by the terminal device allows users to more accurately assess network conditions and confirm whether the bandwidth is overloaded or whether the purchased bandwidth package meets their actual needs. Furthermore, for network congestion issues caused by home environments (such as an excessive number of terminal devices accessing the communication network through the routing and forwarding device), leading to slow network speeds, displaying the target bandwidth by either the routing and forwarding device or the terminal device allows users to easily confirm whether the problem is caused by insufficient or excessive bandwidth, facilitating troubleshooting and improving the user experience.

[0028] In one possible implementation of the first aspect, the method further includes: the routing and forwarding device allocating target bandwidth to the terminal device based on the 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 improving the network speed of terminal devices in that application scenario and enhancing the user experience.

[0030] Optionally, if the application scenario of the terminal device is the first application scenario, the routing and forwarding device allocates the 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 the second target bandwidth to the terminal device; wherein, 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.

[0031] Secondly, a routing and forwarding device is provided, which has the functions described in any one of the first aspects above. These functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the aforementioned functions.

[0032] Thirdly, a routing forwarding device is provided, the routing forwarding device including a memory and one or more processors; wherein the memory is used to store computer instructions, and when the routing forwarding device is running, the processor executes the computer instructions in the memory to cause the routing forwarding device to perform the method described in any one of the first aspects.

[0033] Fourthly, a chip system is provided, the chip system comprising: at least one processor and an interface, the interface being used to receive instructions and transmit them to the at least one processor; the at least one processor executing instructions causes a routing and forwarding device to perform the method described in any of the first aspects above.

[0034] Fifthly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, cause the computer to perform the method described in any one of the first aspects.

[0035] In a sixth aspect, a computer program product containing instructions is provided, which, when run on a computer, enables the computer to perform the method described in any one of the first aspects above.

[0036] The technical effects of any of the implementation methods in the second to sixth aspects mentioned above can be found in the technical effects of different implementation methods in the first aspect, and will not be repeated here. Attached Figure Description

[0037] Figure 1 This application provides a schematic diagram of the structure of a communication system according to an embodiment of the present application.

[0038] Figure 2 This is a schematic diagram of the composition of a communication device provided in an embodiment of this application;

[0039] Figure 3 A flowchart illustrating a three-way handshake process provided in an embodiment of this application;

[0040] Figure 4 A schematic diagram of a TCP transmission process provided in an embodiment of this application;

[0041] Figure 5 A schematic diagram illustrating a timeout retransmission provided in an embodiment of this application;

[0042] Figure 6 This is a schematic diagram of the structure of a netfilter framework provided in an embodiment of this application;

[0043] Figure 7 A schematic diagram of a bandwidth prediction process provided in an embodiment of this application;

[0044] Figure 8 A schematic diagram illustrating the composition of a data stream provided in an embodiment of this application;

[0045] Figure 9 A schematic diagram illustrating another bandwidth prediction process provided in an embodiment of this application;

[0046] Figure 10 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation

[0047] To facilitate understanding, the technical terms and related technologies involved in the embodiments of this application will be introduced first.

[0048] Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol defined by IETF RFC 793. Connection-oriented means that both parties communicating using the TCP protocol, such as a client and a server, must establish a TCP connection before transmitting TCP packets via data streams.

[0049] Each data stream transmitted by the client and server consists of multiple TCP packets. After a connection is established between the client and server, they can transmit data streams, i.e., transmit TCP packets, through a data stream channel. Among the multiple TCP packets transmitted by the client and server, those with the same source port number, destination port number, and protocol type are called a single data stream. In other words, within the same data stream, the TCP packets transmitted by the client and server have the same port number and the same protocol type.

[0050] It should be noted that in the multiple TCP packets transmitted between the client and the server, each TCP packet includes a header and data. The header may include the source port number, destination port number, sequence number, TCP flags (or packet control flags), and acknowledgment number (ACK number), etc.

[0051] The source port number is used to locate the sending application process. The destination port number is used to locate the receiving application process. The sequence number (or packet sequence number) is used to identify the order of the data portion in a TCP packet within the data stream sent from the sender to the receiver. During TCP data transmission, the data portions of multiple TCP packets sent by the sender are sequentially numbered. The receiver, based on the sequence numbers, can correctly reassemble the data, ensuring data order. The acknowledgment number indicates the receiver's confirmation of the received data. The acknowledgment number is calculated as: sequence number of the previous TCP packet + 1.

[0052] Of course, the header can also include other content, such as header length, reserved space, window size, options, etc. For specific explanations, please refer to relevant technologies, which will not be elaborated here.

[0053] TCP flags can include: acknowledgment (ACK), reset (RST), synchronize (SYN), finish (FIN), etc.

[0054] ACK is used to indicate whether the acknowledgment number is valid. The TCP protocol stipulates that after the client and server establish a TCP connection, ACK must be 1, that is, when ACK=1, it indicates that the acknowledgment number is valid.

[0055] RST is used to indicate whether the client and server need to reset the connection. For example, if RST=1, it indicates that a serious error has occurred in the TCP connection between the client and server (such as a host crash). In this case, the previous TCP connection needs to be released and then a new TCP connection needs to be established. That is, RST=1 means that the client and server need to reset the connection.

[0056] SYN is a handshake signal used when establishing a TCP connection between a client and a server to request synchronization.

[0057] FIN is used to mark whether data transmission is complete. If FIN=1, it means that data transmission has been completed 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), and push (PSH) flags. For specific explanations, please refer to relevant technologies, which will not be elaborated here.

[0059] Typically, routers provide traffic statistics and display the results to users through a user interface to reflect the current network status. In some scenarios, however, the traffic statistics may not accurately reflect the actual bandwidth used by the network.

[0060] For example, after terminal devices (such as mobile phones and tablets) access a communication network through the wireless fidelity (Wi-Fi) network provided by a router, the actual network status cannot be reflected by the data traffic due to network environmental factors. These factors include: signal interference leading to a reduced signal-to-noise ratio; poor signal coverage leading to prolonged data transmission time; roaming handover causing data packet loss or retransmission; Wi-Fi link instability; and other network environmental factors such as external environmental instability leading to data packet loss or retransmission.

[0061] Unstable external environments can include: uplink network anomalies (such as those between the optical modem and the router); access network and backbone network anomalies; and server anomalies.

[0062] To address the aforementioned technical problems, this application provides a bandwidth prediction method applied in a routing and forwarding device. The routing and forwarding device establishes a communication connection with a terminal device to forward data streams sent by the terminal device or data streams received by the terminal device. The method includes: when the routing and forwarding device transmits N data streams within a first period, for each of the N data streams, obtaining the message lengths of multiple packets included in the data stream, and determining a first bandwidth for transmitting the data stream based on the message lengths. Then, based on the first bandwidth corresponding to each data stream, the routing and forwarding device determines the sum of first bandwidths for transmitting the N data streams within the first period, and determines the maximum bandwidth for transmitting the N data streams based on the sum of first bandwidths. Thus, by predicting the maximum bandwidth for the current transmitted data stream through the routing and forwarding device, the current network condition can be more accurately reflected, i.e., the actual network usage.

[0063] The technical solutions provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0064] The method provided in the embodiments of this application is applied to Figure 1 The communication system shown. For example, such as... 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. Wireless internet access devices can connect to the routing and forwarding device 102 wirelessly (e.g., via Wi-Fi), while wired internet access devices can connect to the routing and forwarding device 102 via a wired connection (e.g., via a data transmission cable). 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 convert photoelectric signals and interface protocols in the communication network, connecting 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, thus connecting the terminal device 101 to the communication network. For example, this communication network can be the Internet.

[0066] Optionally, the aforementioned communication system may further include connecting the terminal device 101 to a broadband access server, core router, etc., in the communication network. For example, the routing and forwarding device 102 connects the terminal device 101 to an optical modem, and the optical modem connects the terminal device 101 to the core network device 103 through the broadband access server, core router, etc., thereby fulfilling the requirement of connecting the terminal device 101 to the communication network.

[0067] For example, terminal device 101 can be a network-connected user device such as a smartphone, tablet, desktop, laptop, notebook computer, ultra-mobile personal computer (UMPC), handheld smartphone, netbook, personal digital assistant (PDA), mobile phone, set-top box, smart TV, smart wearable device, etc.; or an IoT node in the Internet of Things (IoT); or an in-vehicle communication device in the Internet of Vehicles (IoV); or an entertainment device, gaming device or system; or a GPS device, etc. Terminal device 101 can also be a chip or processing system in the above-mentioned devices. Terminal device 101 can also be a wireless communication chip, wireless sensor, or wireless communication terminal, etc.

[0068] For example, the routing and forwarding device 102 can be a device with routing and forwarding functions. For instance, the routing and forwarding device 102 can be a router, a Layer 3 switch, or other similar devices. The routing and forwarding device 102 can also be a chip or processing system within these devices.

[0069] In specific implementation, such as Figure 1 As shown: Terminal device 101 and routing forwarding device 102 can adopt Figure 2 The shown composition structure, or including Figure 2 The components shown. Figure 2 This is a schematic diagram illustrating the composition of a communication device 200 provided in an embodiment of this 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 also include a memory 204. The processor 201, memory 204, and transceiver 202 can be connected via a communication line 203.

[0071] The processor 201 can be a central processing unit (CPU), 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 can also be other devices with processing capabilities, such as circuits, devices, or software modules, without limitation.

[0072] Transceiver 202 is used to communicate with other devices or other communication networks. These other communication networks can be Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc. Transceiver 202 can be a module, circuit, transceiver, or any device capable of enabling communication.

[0073] Communication line 203 is used to transmit information between the components included in communication device 200.

[0074] Memory 204 is used to store instructions. These instructions can be deterministic machine programs.

[0075] The memory 204 can be a read-only memory (ROM) or other type of static storage device that can store static information and / or instructions; it can also be a random access memory (RAM) or other type of dynamic storage device that can store information and / or instructions; it can also be 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 discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, 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, program code, or some data, etc. The memory 204 can be located inside or outside the communication device 200, without limitation. The processor 201 is used to execute the instructions stored in the memory 204 to implement the methods provided in the following embodiments of this application.

[0077] In one example, processor 201 may include one or more CPUs, for example Figure 2 CPU0 and CPU1 in the CPU.

[0078] As an optional implementation, the communication device 200 includes multiple processors, for example, besides Figure 2 In addition to processor 201, it may also include processor 207.

[0079] As an optional implementation, the communication device 200 also includes an output device 205 and an input device 206. For example, the input device 206 is a device such as a keyboard, mouse, microphone, or joystick, and the output device 205 is a device such as a display screen or speaker.

[0080] It should be pointed out that, Figure 2 The structural composition shown 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 illustrated, or combine certain components, or have different component arrangements.

[0081] In this embodiment of the application, the chip system may be composed of chips or may include chips and other discrete devices.

[0082] Furthermore, the actions, terms, etc., involved in the various embodiments of this application can be referenced interchangeably without limitation. The message names or parameter names in the messages used for interaction between devices in the embodiments of this application are merely examples, and other names may be used in specific implementations without limitation.

[0083] Combination Figure 1 The communication system shown allows terminal device 101 to establish connections with other devices (such as other terminal devices) through routing and forwarding device 102 and core network device 103 using a communication protocol. This communication protocol can be either TCP or User Datagram Protocol (UDP). In the following embodiments, TCP is used as an example to illustrate the technical solution of this application's embodiments.

[0084] Typically, when terminal device 101 establishes a TCP connection with other devices, the device that actively initiates the TCP connection establishment can be called the TCP client, and the device that passively waits for the TCP connection to be established can be called the TCP server. For example, the TCP client and TCP server can establish a TCP connection through a three-way handshake.

[0085] Figure 3 This diagram illustrates how a TCP connection is established via a three-way handshake. 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. This TCP connection request message can be the first handshake message used to establish a TCP connection.

[0087] In this TCP connection request message header, the SYN flag is set to 1 (i.e., SYN = 1). SYN = 1 indicates that this 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. 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 acknowledgment message to the TCP client. This TCP connection request acknowledgment message can be the second handshake message used to establish the TCP connection.

[0089] In this TCP connection request acknowledgment message header, both the SYN and ACK flags are 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 acknowledgment of receipt of the TCP connection request message sent by the TCP client in step 301. The sequence number in the TCP connection request acknowledgment message header is set to an initial value y (i.e., sequence number = y), which is the initial sequence number selected by the TCP server and is randomly generated by the TCP server. The acknowledgment number in the TCP connection request acknowledgment message header is set to x + 1 (i.e., acknowledgment number = x + 1), indicating acknowledgment of the initial sequence number selected by the TCP client.

[0090] Once a TCP client receives a TCP connection request acknowledgment message (i.e., the second handshake message), it can enter the established state.

[0091] Step 303: After receiving the TCP connection request acknowledgment message, the TCP client can also send a TCP acknowledgment message to the TCP server. This TCP acknowledgment message can be the third handshake message used to establish a TCP connection.

[0092] In this TCP acknowledgment message, the ACK flag in the header is set to 1 (i.e., ACK = 1), indicating that this is a TCP acknowledgment message. The sequence number in the header is set to x+1 (i.e., sequence number = x+1). This is because the sequence number of the previous TCP message sent by the TCP client (i.e., the TCP connection request message) was x, therefore the sequence number of this TCP acknowledgment message is x+1 (i.e., sequence number = x+1). The acknowledgment number in the header is set to y+1 (i.e., acknowledgment number = y+1), which is an acknowledgment of the initial sequence number chosen by the TCP server process.

[0093] After receiving the TCP acknowledgment message (third handshake message), the TCP server also enters the connection established state.

[0094] Optionally, in the handshake process described above, the TCP client primarily reports its sending capability to the TCP server, and the TCP client confirms the TCP server's receiving capability. Similarly, the TCP server, in the same handshake process, primarily reports its sending capability to the TCP client, and the TCP server confirms the TCP client's receiving capability. After both parties have mutually confirmed their sending and receiving capabilities, the TCP client and TCP server can negotiate and determine the maximum amount of data they can transmit.

[0095] based on Figure 3As shown in the handshake process, both the TCP client and the TCP server enter the established connection state. After the TCP client and the TCP server negotiate and determine the maximum amount of data to be transmitted, data stream transmission can begin based on the established TCP connection.

[0096] Figure 4 This is a schematic diagram illustrating communication between a TCP client and a TCP server, provided as an embodiment of this application. For example,... Figure 4 As shown, the communication process between a TCP client and a TCP server can include: a three-way handshake, a TCP data transmission process, and a four-way handshake. Among these, Figure 4 The TCP data transmission process is a normal data transmission process.

[0097] Combination Figure 4 As shown, the TCP data transmission process and the four-way handshake process are illustrated here. For an example of the three-way handshake process, please refer to the above embodiment, which will not be repeated here.

[0098] Taking a TCP client as the sender and a TCP server as the receiver as an example, after both the TCP client and TCP server enter the established connection state, they can transmit data. For instance, the TCP client can send the first piece of data to the TCP server. When the TCP server receives the first piece of data sent by the TCP client, the TCP server will return an acknowledgment (ACK) to the TCP client, indicating that it expects to receive the second piece of data. For example, ... Figure 4 As shown, the TCP client sends TCP segment 1 to the TCP server. This TCP segment 1 carries the data corresponding to the sequence number (e.g., seq=1), where seq=1 indicates that the data has sequence number 1. When the TCP server receives the data corresponding to seq=1, it returns a TCP acknowledgment segment to the TCP client. This TCP acknowledgment segment carries an acknowledgment response (e.g., ACK=2), where ACK=2 indicates that the client expects to receive the second data segment.

[0099] Correspondingly, after receiving the TCP acknowledgment packet, the TCP client sends TCP packet 2 to the TCP server. This TCP packet 2 carries the data corresponding to the sequence number (e.g., seq=2), where seq=2 indicates the data with sequence number 2. When the TCP server receives the data corresponding to seq=2, it returns a TCP acknowledgment packet to the TCP client. This acknowledgment packet carries an acknowledgment response (e.g., ACK=3), where ACK=3 indicates an expectation of receiving a third piece of data. And so on, such as... Figure 4As shown, this continues until the TCP client has sent all the data to the TCP server, such as the sixth piece of data (seq=6), where seq=6 means the data with sequence number 6.

[0100] Understandably, after the TCP client and TCP server establish a TCP connection through a three-way handshake, they will negotiate and determine the maximum data size for this transmission. For example, if the TCP client and TCP server negotiate a maximum data size of 6, then after the TCP client sends the sixth piece of data to the TCP server, the data transmission is considered complete. Then, the TCP client and TCP server will close the TCP connection through a four-way handshake.

[0101] For example, such as Figure 4 As shown, the four-way handshake process can include: the TCP client sending a TCP connection termination request message to the TCP server. For example, the FIN field in this TCP connection termination request message is set to 1 (which can be represented as FIN=1), indicating that the TCP connection needs to be terminated. The seq field in this TCP connection termination request message is set to x (which can be represented as seq=x), where x is randomly generated by the TCP client.

[0102] The TCP server can reply to a TCP client's TCP disconnect request message. For example, the FIN field in this message is set to 1 (which can be represented as FIN=1), indicating that the TCP connection needs to be closed; the ACK field in this message is set to x+1 (which can be represented as ACK=x+1), indicating that the TCP client's request to close the TCP connection has been verified; and the seq field in this message is set to y (which can be represented as seq=y), where y is randomly generated by the TCP server.

[0103] After replying to the TCP client's TCP disconnect request message, the TCP server does not immediately close the TCP connection. The TCP server first confirms whether the data to be transmitted has been completely transmitted to ensure data transmission is completed before disconnection. After confirming that the required data has been transmitted, the TCP server sends a TCP disconnect request message to the TCP client. For example, the FIN field in this TCP disconnect request message is set to 1 (which can be represented as FIN = 1), indicating that the TCP connection needs to be closed. The ACK field in this TCP disconnect request message is set to y+1 (which can be represented as ACK = y+1), indicating that the TCP client's request to close the TCP connection has been verified; the seq field in this TCP disconnect request message is set to z (which can be represented as seq = z), where z is randomly generated by the TCP client.

[0104] After receiving a TCP disconnect request message from the TCP server, the TCP client can reply with a TCP disconnect request message. For example, the FIN field in this message might be set to 1 (FIN = 1), indicating that the TCP connection needs to be closed; the ACK field might be set to z+1 (ACK = z+1), indicating that the TCP client's request to close the TCP connection has been verified; and the seq field might be set to h (seq = h), where h is randomly generated by the TCP server. At this point, the four-way handshake process between the TCP client and the TCP server is complete, and the TCP connection is closed.

[0105] based on Figure 3 and Figure 4 As can be understood from the embodiments shown, the SYN flag is used to identify the message field for a three-way handshake, and the FIN flag is used to identify the message field for a four-way handshake.

[0106] Figure 5 This is a schematic diagram illustrating communication between a TCP client and a TCP server, provided as an embodiment of this application. For example, as shown... Figure 5 As shown, the communication process between a TCP client and a TCP server can include: a three-way handshake, a TCP data transmission process, and a four-way handshake. Among these, Figure 5 The TCP data transmission process includes a retransmission mechanism.

[0107] Combination Figure 5 As shown, this example illustrates the TCP data transmission process (including the retransmission mechanism). For the three-way handshake and four-way handshake processes, please refer to the above embodiments, which will not be elaborated here.

[0108] Retransmission mechanisms can include timeout retransmission, fast retransmission, and selective acknowledgment (SACK). Timeout retransmission refers to the sending end setting a timer when sending a message. If the sending end does not receive an acknowledgment (ACK) from the receiving end after the timer expires (RTO), it retransmits the data. Typically, timeout retransmission is used when data is lost or an acknowledgment is lost.

[0109] Fast retransmission refers to retransmitting lost packets when the sender receives three identical ACKs. SACK refers to the inclusion of the SACK flag in the header of a TCP packet sent by the receiver. Upon receiving a TCP packet with the SACK flag, the sender can identify the lost data and retransmit it. It should be noted that... Figure 5 The TCP data transmission process is described using timeout retransmission as an example.

[0110] Let's continue with the example of a TCP client as the sender and a TCP server as the receiver. For instance, as shown... Figure 5 As shown, after a TCP client sends a message to a TCP server (for example, sending message 1, in which the seq field is set to 1, indicating that the data has a sequence number of 1), if the TCP client does not receive an acknowledgment from the TCP server when the timer duration exceeds the RTO (the ACK field in the acknowledgment is set to 2, indicating that a second data is expected), the TCP client will retransmit message 1.

[0111] TCP will retransmit after a timeout in case of packet loss or lost acknowledgment. For example, in the case of packet loss, such as... Figure 5 As shown, packet 1 (with its seq field set to 1, meaning seq = 1) sent by the TCP client to the TCP server is lost. This means the TCP server did not receive packet 1, and therefore will not return an acknowledgment to the TCP client. So, if the TCP client does not receive an acknowledgment from the TCP server when the timer expires (RTO), it will retransmit packet 1. After receiving packet 1, the TCP server returns an acknowledgment to the TCP client. In this acknowledgment, the ACK field is set to 2, indicating that a second data packet is expected.

[0112] For example, in the case of a lost confirmation response, such as Figure 5 As shown, the TCP client sends message 1 to the TCP server. After receiving message 1, the TCP server returns an acknowledgment to the TCP client. Figure 5 As shown, the acknowledgment returned by the TCP server to the TCP client was lost, meaning the TCP client did not receive the acknowledgment. Therefore, if the TCP client does not receive the acknowledgment from the TCP server when the timer expires (RTO), the TCP client will retransmit packet 1. After receiving packet 1, the TCP server returns an acknowledgment to the TCP client. The ACK field in this acknowledgment is set to 2, indicating that a second data packet is expected.

[0113] The above embodiments mainly describe the process of establishing and closing a TCP connection between a TCP client and a TCP server. Specifically, the TCP client and TCP server establish a TCP connection, transmit data, and close the TCP connection primarily by transmitting TCP packets. Furthermore, in related technologies, when the TCP client acts as the sender and the TCP server as the receiver, the transmission of TCP packets is implemented through a router. That is, the router acts as an intermediate forwarding device, mainly used to forward TCP packets transmitted between the TCP client and the TCP server.

[0114] Multiple TCP packets transmitted through the same port can be referred to as a single data stream. In other words, a router can forward data streams transmitted between TCP clients and TCP servers. Based on this, in this embodiment, the router can predict the bandwidth of the current data stream being transmitted, thus more accurately reflecting the current network conditions, i.e., the actual network usage.

[0115] In addition, since routers in related technologies act as intermediate forwarding devices and have the function of forwarding TCP packets, the bandwidth of the current data stream can be predicted by using routers without affecting the network performance of the TCP client and TCP server.

[0116] The following examples illustrate the specific implementation process of a router predicting the bandwidth of the current data stream.

[0117] For example, in a router operating system kernel (Linux) scenario, TCP packets are transmitted at the protocol layer (such as network layer, link layer, physical layer, forwarding layer, and transport layer). Figure 6 This document provides a schematic diagram of the netfilter framework for routers in a Linux environment. The Linux IP protocol stack is a layer four or higher (also known as a top-level protocol stack). Figure 6 As shown, the netfilter framework includes six key hook points (also known as detection points, key points, or hook points): pre-routing, routing decision, forward, post-routing, local-in, and local-out. The pre-routing node primarily handles destination address translation and adds specific markers to each TCP packet in the data stream. The routing decision node decides whether to forward the data stream. The post-routing node primarily performs source address translation.

[0118] For example, each TCP packet in the data stream forwarded by the router passes through three hook points: the pre-processing node, the critical node, and the post-processing node. In this embodiment, a hook interface can be registered at the critical node. Optionally, this hook interface can be represented as: atp_static_netband_process.

[0119] For example, such as Figure 6 As shown, each TCP packet in the data stream arrives at the routing decision node after passing through the preprocessing node. If the routing decision node decides that each TCP packet in the data stream should be forwarded, then for each TCP packet in the data stream that needs to be forwarded, the hook interface is called at the key node to identify the packet length, sequence number, and flag bits of each TCP packet in the data stream.

[0120] Specifically, the message length of each TCP segment in the data stream is identified to determine the amount of data transmitted per unit time, thus aiding in bandwidth prediction. The sequence number of each TCP segment in the data stream is identified to determine if there are any retransmissions. The flag bits of each TCP segment in the data stream are identified to determine whether the data stream transmission has ended.

[0121] For example, the total length field in a TCP packet includes the packet length. Taking packet capture using network packet analysis software (Wireshark) as an example, the total length field might be: _be16 tot_len; indicating that the packet length is 16 bits.

[0122] For example, the protocol field of each TCP packet in the data stream includes the protocol type. For instance, the protocol field is: protocol: TCP(6); indicating that the protocol type corresponding to this data stream is the TCP protocol.

[0123] For example, the header fields (or head fields) in a TCP packet include the sequence number and flags. For instance, a header field might include: sequence number: 4342 (relative sequence number); indicating that the sequence number of this TCP packet is 4342. Another example is a header field containing: FIN = 1; indicating that the data stream has been completed.

[0124] As an example, a router can look up the packet length, sequence number, and flags of each TCP packet in a data stream in a stored hash table based on the 5-tuple information. Optionally, when forwarding a data stream, the router can parse the IP information of each TCP packet in the data stream and convert the IP information into 5-tuple information.

[0125] The 5-tuple information includes the source IP address, destination IP address, source port number, destination port number, and protocol type (e.g., TCP, UDP). The hash table shows the correspondence between the 5-tuple information of the data stream and the data information (i.e., the packet length, sequence number, and flag bits of each TCP packet in the data stream). It is important to note that the 5-tuple information of the data stream is unique; that is, there is a one-to-one correspondence between the data stream and the 5-tuple information.

[0126] In some embodiments, the router can store the 5-tuple information and data information of the data stream in a hash table in key-value pairs, where the 5-tuple information can be considered the key and the data information can be considered the value. After this information is stored in the hash table, the router has the information needed to predict bandwidth.

[0127] In some embodiments, after obtaining the 5-tuple information corresponding to a data stream, the router can use the 5-tuple information as a key to look up the corresponding data information in a hash table. If the router does not find the corresponding data information in the hash table, it will identify the data information corresponding to the data stream, 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, it will obtain the data information and predict the bandwidth based on the data information.

[0128] In conjunction with the above embodiments, refer to the following Figure 7 This application describes the bandwidth prediction method provided in its embodiments, wherein the routing and forwarding device can be a router, a Layer 3 switch, etc. The routing and forwarding device can have... Figure 2 The components shown. The processing performed by a single execution entity (routing and forwarding device) shown in the embodiments of this application can also be divided into multiple execution entities, which can be logically and / or physically separated, without limitation.

[0129] Figure 7 A flowchart of a bandwidth prediction method provided in this application embodiment is shown below. 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 can be preset by the routing and forwarding device; there is no specific limitation on the first period, and the actual setting shall prevail. For example, the first period can 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, tablets, laptops, etc.). For example, N data streams can be data streams sent by multiple terminal devices and forwarded by the routing and forwarding device within the first period, or data streams received by multiple terminal devices. Alternatively, N data streams can also be data streams sent by a single terminal device and forwarded by the routing and forwarding device within the first period, or data streams received by a single terminal device.

[0133] In this system, each of the N data streams corresponds to a packet on a different port. That is, TCP packets in a data stream have the same port (e.g., same source port number, same destination port number) and the same protocol type (e.g., all are TCP protocols).

[0134] Step 402: For each of the N data streams, the routing and forwarding device obtains the message lengths of the multiple packets included in the data stream and determines the first bandwidth corresponding to the data stream based on the message lengths.

[0135] Bandwidth refers to the data transmission rate per unit time (unit: bits per second (bps)), which can be determined by the ratio of traffic to time. Traffic refers to the amount of data transmitted per unit time (i.e., data length). Therefore, in this embodiment, the amount of data in the transmitted data stream (i.e., traffic) can be determined based on the message length, and then the first bandwidth can be determined based on the traffic.

[0136] For example, the routing and forwarding device first determines the amount of data transmitted in the first period (i.e., determines the traffic) based on the message length of the data stream, which includes multiple messages, and then uses the ratio of the traffic to the first period as the first bandwidth.

[0137] It should be noted that if the data stream does not include retransmission packets, the routing and forwarding device can use the ratio of the traffic determined above to the first period as the first bandwidth. If the data stream includes retransmission packets, the impact of retransmissions on bandwidth must be considered.

[0138] For example, such as Figure 8 As shown, assume that a data stream transmitted by the routing and forwarding device in the first cycle includes... Figure 8 The diagram shows multiple packets. Based on this, the routing and forwarding device can determine the first bandwidth by sampling retransmitted packets transmitted within the pre-set timeout retransmission interval and normal packets transmitted outside the timeout retransmission interval.

[0139] The timeout retransmission interval can be set based on the duration of the retransmission timer. For example, the timeout retransmission interval is an integer multiple of the retransmission timer duration (or retransmission timeout period RTO). For instance, the timeout retransmission interval can be two, three, or four times the retransmission timer duration, etc., without limitation.

[0140] Understandably, TCP monitors packet loss by setting a retransmission timer when sending packets. If the retransmission timer expires before the sender receives an acknowledgment, the sender retransmits the packet. Therefore, in this embodiment, the timeout retransmission interval is set based on the duration of the retransmission timer, which maximizes the chances of sampling retransmitted packets within the timeout retransmission interval.

[0141] For example, such as Figure 8 As shown, the router's pre-set timeout retransmission interval is t2 (or the second duration). Therefore, the remaining time interval within the first period is T-t2 (or the first duration, denoted as t1). Here, T represents the first period.

[0142] For example, such as Figure 8 As shown, within the first period T, the data stream transmitted by the routing and forwarding device includes multiple packets. For example, within the first duration t1, the routing and forwarding device transmits n packets, such as packet seq1, packet seq2, packet seq3, ..., packet seqn; their packet lengths are L1, L2, L3, ..., Ln, respectively.

[0143] During the second time period t2, the routing forwarding device transmits packets seq(n+1), seq(n+2), seq(a), seq(b), ..., seq(m), ..., seq(2n); their packet lengths are Ln+1, Ln+2, La, Lb, ..., Lm, ..., L2n, respectively.

[0144] It should be noted that the retransmitted messages transmitted within the second time period can be retransmitted messages of some of the aforementioned n messages (message seq1, message seq2, message seq3, ..., message seqn); or, they can be retransmitted messages of all of the aforementioned n messages; or, they can be retransmitted messages of other than the aforementioned n messages, for example, retransmitted messages of other messages. There are no restrictions.

[0145] based on Figure 8As shown in the data stream, the routing and forwarding device can determine the amount of data in normal packets transmitted within a first time period and the amount of data in retransmitted packets transmitted within a second time period. Then, the routing and forwarding device determines the first bandwidth based on the amount of data in normal packets transmitted within the first time period, the amount of data in retransmitted packets transmitted within the second time period, the amount of data in all packets transmitted within the second time period, and the first and second time period segments.

[0146] It should be noted that, in the embodiments of this application, a normal message refers to a message that is sent once by the sending end and is successfully sent.

[0147] Optionally, the first bandwidth can satisfy the following expression:

[0148] Where Bi represents the first bandwidth. This indicates the amount of data in normal messages transmitted within the first time period. This indicates the amount of data in the retransmitted messages transmitted within the second time period; This represents the total amount of data transmitted in all messages within the second time period, where 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 amount of data in a normal message transmitted within the first period to the time. This time is related to the duration of normal messages transmitted within the first duration and the proportion of retransmitted messages transmitted within the second duration. Thus, by taking into account the proportion of retransmitted messages transmitted within the first period when determining the bandwidth using the above expression, the determined first bandwidth can be more accurate.

[0150] It should be noted that in actual implementation, the messages transmitted within the first time period may not include retransmitted messages, may include some retransmitted messages, or may consist entirely of retransmitted messages. Correspondingly, the messages transmitted within the second time period may not include retransmitted messages, may include some retransmitted messages, or may consist entirely of retransmitted messages. Based on these different scenarios, the first bandwidth determined by the above expression will also differ. Examples illustrating the various scenarios for determining the first bandwidth using the above expression are provided below.

[0151] Scenario 1: The messages transmitted within the first time period do not include retransmitted messages, while the messages transmitted within the second time period include some retransmitted messages.

[0152] For example, in combination Figure 8 Given the above expression, n first messages are transmitted normally within the first time period, and b messages are transmitted normally within the second time period, including a retransmission messages. Therefore, the first bandwidth is the ratio of the amount of data transmitted in the first time period to the sum of the time for transmitting retransmission messages in the second time period and the first time period itself.

[0153] Scenario 2: All messages transmitted within the first time period are retransmitted messages, and all messages transmitted within the second time period are retransmitted messages. Therefore, combining this with the above expression, since... This represents the amount of data in the first message that was normally transmitted within the first time period. Therefore, if all messages transmitted within the first time period are retransmission messages, If the value is 0, then 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 is not sending data streams through the routing and forwarding device, that is, no traffic is generated.

[0154] Scenario 3: The packets transmitted within the first time period include some retransmitted packets, while the packets transmitted within the second time period do not include retransmitted packets. In practice, the routing and forwarding device uses the packets transmitted normally within the first time period and ignores the retransmitted packets transmitted within the first time period. Thus, The value is 0, and the first bandwidth is the ratio of the amount of data in the normally transmitted messages within the first time period to the first time period.

[0155] It should be noted that step 402 above uses a data stream as an example to illustrate the specific implementation process of determining the first bandwidth. For the specific implementation process of the first bandwidth corresponding to other data streams, please refer to the above embodiments, which will not be repeated here.

[0156] Step 403: The routing and forwarding device determines the sum of the first bandwidths when transmitting N data streams within the first period, based on the first bandwidth corresponding to each data stream.

[0157] For example, the first bandwidth satisfies the following expression:

[0158] Where 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 the target bandwidth based at least on the first bandwidth and the target bandwidth, where the target bandwidth is the maximum bandwidth when transmitting N data streams.

[0160] Optionally, the routing and forwarding device may use the sum of the first bandwidths as the target bandwidth. For example, the target bandwidth B = Bt1. The reason for using the sum of the first bandwidths as the target bandwidth, i.e., as the maximum bandwidth for transmitting N data streams, is that in this embodiment, the sum of the first bandwidths is determined in real time. That is, the currently determined sum of the first bandwidths is the latest bandwidth of the current routing and forwarding device. Therefore, using the sum of the first bandwidths as the target bandwidth can more accurately reflect the current network status, i.e., reflect the actual usage of the current network.

[0161] Optionally, the routing device may use the sum of the first bandwidths determined in the previous cycle as the target bandwidth. Alternatively, the routing device may use the sum of the first bandwidths determined in the next cycle as the target bandwidth. Or, the routing device may use the average of the sums of the first bandwidths of two adjacent cycles as the target bandwidth.

[0162] In summary, by adopting the solution of this application embodiment, when the routing and forwarding device transmits N data streams in the first period, the routing and forwarding device determines the first bandwidth corresponding to each of the N data streams, thereby determining the sum of the first bandwidths when transmitting N data streams in the first period. Based on this sum of first bandwidths, the maximum bandwidth when the routing and forwarding device transmits N data streams is determined. Thus, by predicting the maximum bandwidth of the currently transmitted data streams through the routing and forwarding device, the current network condition can be more accurately reflected, i.e., the actual network usage.

[0163] As an example, over time, the routing and forwarding device can also determine the sum of bandwidths for all data streams transmitted in the next period and update the target bandwidth. In other words, the routing and forwarding device can periodically determine the sum of bandwidths for all data streams transmitted within that period and update the target bandwidth in real time. For example, such as... Figure 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 cycle, where M is a positive integer.

[0165] Step 502: For each of the M data streams, the routing and forwarding device obtains the message length of the multiple packets included in the data stream and determines the second bandwidth corresponding to the data stream based on the message length.

[0166] Step 503: The routing and forwarding device determines the second bandwidth of the M data streams to be transmitted in the second period based on the second bandwidth corresponding to each data stream.

[0167] For examples of steps 501-503, please refer to steps 401-403 in the above embodiments, which will not be described in detail here.

[0168] Step 504: The routing and forwarding device determines the target bandwidth based on the first bandwidth and the second bandwidth.

[0169] In this embodiment of the application, the routing and forwarding device can periodically predict the bandwidth of the current transmitted data stream, thereby reflecting the current network status more accurately through the periodically predicted bandwidth, that is, reflecting the actual usage of the network.

[0170] The second bandwidth sum can be represented as Bt2. Optionally, if the second bandwidth sum is greater than the first bandwidth sum, the routing 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 rate is greater than the retransmission ratio, then the routing and forwarding device updates the target bandwidth to the second bandwidth sum. That is, if Bt2 < Bt1, and ΔB > Rt, then update B = Bt2. Here, the bandwidth increase rate ΔB indicates the bandwidth increase rate of the second period compared to the first period; the retransmission ratio Rt indicates the proportion of retransmissions occurring within the first period.

[0172] Optionally, if the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase rate is less than the retransmission rate, the target bandwidth is retained as the first bandwidth sum. That is, if Bt2 < Bt1, and ΔB < Rt, then B = Bt1 is retained.

[0173] For example, the bandwidth increase ratio satisfies the following expression: ΔB=(Bt1-Bt2) / Bt2; where ΔB represents the bandwidth increase ratio, Bt2 represents the second bandwidth sum, and Bt1 represents the first bandwidth sum.

[0174] For example, the retransmission ratio satisfies the following expression: Where Rt represents the retransmission ratio. This indicates the amount of data transmitted in the retransmission messages within the first cycle. This indicates the amount of data transmitted in all messages during the first cycle.

[0175] In this embodiment, if ΔB > Rt, it indicates that the bandwidth increase rate is greater than the retransmission rate. Therefore, it can be considered that in the case of a retransmission mechanism, the bandwidth reduction effect of retransmission is less than the bandwidth enhancement effect. Thus, the maximum bandwidth B is updated to the second bandwidth and Bt2, i.e., B = Bt2. Conversely, if ΔB < Rt, it indicates that the retransmission rate is greater than the bandwidth increase rate. Therefore, it can be considered that in the case of a retransmission mechanism, the bandwidth reduction effect of retransmission is stronger. The bandwidth reduction effect of retransmission needs to be considered, so the maximum bandwidth B is retained as the first bandwidth and Bt1, i.e., B = Bt1.

[0176] Based on this, considering the impact of retransmission on bandwidth, in this embodiment of the application, the routing and forwarding device periodically determines the bandwidth of all data streams transmitted in each period, and dynamically adjusts the target bandwidth based on the bandwidth increase ratio and retransmission ratio, so that the predicted maximum bandwidth of the current data stream is more accurate, and thus 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 and forwarding device displaying the target bandwidth; or, the routing and forwarding device sending 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, displaying the target bandwidth by the routing and forwarding device or by the terminal device allows users to more accurately assess network conditions and confirm whether the bandwidth is overloaded or whether the bandwidth package purchased by the user meets their actual needs. Furthermore, for network congestion issues caused by home environments (such as an excessive number of terminal devices accessing the communication network through the routing and forwarding device), leading to slow network speeds, displaying the target bandwidth by the routing and forwarding device or by the terminal device allows users to easily confirm whether the problem is caused by insufficient or excessive bandwidth, facilitating troubleshooting and improving the user experience.

[0179] In some embodiments, the method may further include: the routing and forwarding device allocating target bandwidth to the terminal device based on the 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 based on the MAC address. Optionally, the routing and forwarding device can also allocate corresponding bandwidth to the terminal device based on the corresponding Internet protocol address (IP).

[0181] For example, if the application scenario of the terminal device is a 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 a second application scenario, the routing and forwarding device allocates a second target bandwidth to the terminal device; wherein, 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.

[0182] Assuming the target bandwidth is 10bps, for example, if the terminal device's application scenario is gaming, the routing and forwarding device allocates a first target bandwidth (e.g., 8bps) to the terminal device. If the terminal device's application scenario is video, the routing and forwarding device allocates a second target bandwidth (e.g., 2bps) 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 improving the network speed of the terminal devices in the application scenario and enhancing the user experience.

[0184] It should be noted that the contents described in the various embodiments of this application can explain and illustrate the technical solutions in other embodiments of this application. The technical features described in the various embodiments can also be applied in other embodiments and combined with the technical features in other embodiments to form new solutions. This application only provides an exemplary list of several embodiments for illustration and does not mean that this application is limited thereto.

[0185] This application also provides a communication device, which includes a processor for implementing the methods in any of the above method embodiments.

[0186] Optionally, the communication device further includes a memory. The memory stores necessary program instructions and data, and the processor can call the program code and instructions stored in the memory to cause the communication device to execute the methods in any of the above method embodiments. Of course, the memory may not be included in the communication device.

[0187] Optionally, the communication device further includes an interface circuit, which is a code / data read / write circuit. The interface circuit is used to receive deterministic execution instructions (deterministic execution instructions are stored in memory, and may be read directly from memory or may be transmitted through other devices) and transmit them to the processor.

[0188] Optionally, the communication device may further include a communication interface for communicating with modules outside the communication device.

[0189] It is 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 may include chips and other discrete devices. This application does not specifically limit this.

[0190] This application embodiment also provides a routing forwarding device, which includes a memory and one or more processors. The memory stores deterministic machine instructions, and when the routing forwarding device is running, the processor executes the deterministic machine instructions stored in the memory to cause the routing forwarding device to perform the various functions or steps performed by the aforementioned site device.

[0191] This application also provides a chip system for use in a communication device. For example... Figure 10 As shown, the chip system 1100 includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 can be one of the types described in the above embodiments. Figure 2 The processor 201 is shown. The interface circuit 1102 can be, for example, an interface circuit between the processor 1101 and other devices (such as transceiver 102).

[0192] The processor 1101 and interface circuit 1102 described above can be interconnected via a line. For example, interface circuit 1102 can be used to receive signals from other devices (e.g., processor 1101). As another example, interface circuit 1102 can be used to send signals to other devices (e.g., processor 1101). Exemplarily, interface circuit 1102 can read instructions stored in memory and send those instructions to processor 1101. When the instructions are executed by processor 1101, the site device can perform the various functions or steps performed by the site device in the above embodiments. Of course, the chip system may also include other discrete devices, and this application embodiment does not specifically limit this.

[0193] This application also provides a deterministic machine-readable storage medium, which includes deterministic machine instructions that, when executed on a site device, cause the site device to perform any of the methods described in the above method embodiments.

[0194] This application also provides a deterministic machine program product, which, when running on a deterministic machine, causes the deterministic machine to execute any of the methods described in the above method embodiments.

[0195] It should be noted that the terms "first" and "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. "First" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.

[0196] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.

[0197] It should be understood that in this application, "at least one (item)" means one or more. "More than one" means two or more. "At least two (items)" means two or three or more. "And / or" is used to describe the relationship between related objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) 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, and c can be single or multiple. Both "...when" and "if" indicate that a corresponding action will be taken under certain objective circumstances. They are not time limits, nor do they require a judgment action to be taken when the action is taken, nor do they imply any other limitations.

[0198] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner to facilitate understanding.

[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above 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 this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0201] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0202] Furthermore, the functional units in the various embodiments of this 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 integrated unit described above can be implemented in hardware or as a software functional unit.

[0203] If the integrated unit is implemented as 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 solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0204] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A bandwidth prediction method, characterized in that, The method is applied in a routing and forwarding device, which establishes a communication connection with a terminal device to forward data streams sent by the terminal device or data streams received by the terminal device; the method includes: N data streams are transmitted in the first cycle, where N is a positive integer; the first cycle includes a preset first duration and a second duration, the second duration is related to the retransmission timeout (RTO), and the first duration is the difference between the first cycle and the second duration; For each of the N data streams, the message length of the multiple messages included in the data stream is obtained, and the amount of data transmitted in the first period is determined based on the message length of the multiple messages. Based on the amount of data transmitted in the data stream during the first period and the first period, determine the amount of data of normal messages transmitted during the first duration, the amount of data of retransmitted messages transmitted during the second duration, and the amount of data of all messages transmitted during the second duration. Based on the data volume of normal messages transmitted within the first duration, the data stream of retransmitted messages transmitted within the second duration, the data volume of all messages transmitted within the second duration, the first duration, and the second duration, the first bandwidth corresponding to the data stream is determined. Based on the first bandwidth corresponding to each of the N data streams, determine the sum of the first bandwidths when transmitting the N data streams within the first period; The target bandwidth is determined based at least on the first bandwidth; the target bandwidth is the maximum bandwidth when transmitting the N data streams.

2. The method according to claim 1, characterized in that, The method further includes: M data streams are transmitted during the second cycle; M is a positive integer. For each of the M data streams, obtain the message length of the multiple messages included in the data stream, and determine the second bandwidth corresponding to the data stream based on the message length; Based on the second bandwidth corresponding to each of the M data streams, determine the second bandwidth for transmitting the M data streams within the second period; Wherein, determining the target bandwidth based at least on the first bandwidth includes: The target bandwidth is determined based on the first bandwidth sum and the second bandwidth sum.

3. The method according to claim 2, characterized in that, Determining the target bandwidth based on the first bandwidth sum and the second bandwidth sum includes: If the second bandwidth sum is greater than the first bandwidth sum, then 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 rate is greater than the retransmission ratio, then the target bandwidth is determined to be the second bandwidth sum; wherein, the bandwidth increase rate 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 proportion of retransmissions occurring within the first period; or, If the second bandwidth sum is less than the first bandwidth sum, and the bandwidth increase rate is less than the retransmission rate, the target bandwidth is retained as the first bandwidth sum.

4. The method according to claim 1, characterized in that, Determining the first bandwidth corresponding to the data stream includes: The first bandwidth corresponding to the data stream satisfies the following expression: ; in, This indicates the first bandwidth corresponding to the data stream. This represents the amount of data in normal messages transmitted within the first time period. The amount of data in the retransmitted message transmitted within the second time period; This indicates the total amount of data in all messages transmitted within the second time period. Indicates the first duration. Indicates the second duration.

5. The method according to claim 3, characterized in that, The bandwidth increase ratio satisfies the following expression: ; in, Indicates the bandwidth increase rate. Indicates the second bandwidth and, This represents the first bandwidth.

6. The method according to claim 3, characterized in that, The retransmission ratio satisfies the following expression: ; in, Indicates the retransmission ratio. This indicates the amount of data in the retransmitted messages transmitted within the first period. This represents the total data volume of all messages transmitted within the first period.

7. The method according to any one of claims 1-6, characterized in that, The method also 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.

8. The method according to any one of claims 1-7, characterized in that, The method further includes: The routing and forwarding device allocates the target bandwidth to the terminal device based on the application scenario of the terminal device.

9. The method according to claim 8, 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 the 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 the second target bandwidth to the terminal device; Wherein, 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.

10. A routing and forwarding device, characterized in that, include: Memory and one or more processors; The memory stores deterministic machine program code, which includes deterministic machine instructions; when the processor executes the deterministic machine instructions, the method as described in any one of claims 1-9 is performed.

11. 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 them to the at least one processor; the at least one processor executes the instructions to cause the method as described in any one of claims 1-9 to be performed.

12. A computer-readable storage medium, characterized in that, Includes computer instructions that, when executed on a routing and forwarding device, cause the method as described in any one of claims 1-9 to be performed.

Citation Information

Patent Citations

  • Facilitating real-time transport of data streams

    US20220109717A1

  • Apparatus for and method of managing bandwidth for a packet based connection

    US6493316B1