Message forwarding method, system, electronic device, and storage medium

By monitoring congestion in a virtual network and using a token bucket to allocate tokens to packets of different priorities, the network congestion problem during packet forwarding in a virtual network is solved, QoS in the virtual network is achieved, and forwarding costs are reduced.

WO2026007687A1PCT designated stage Publication Date: 2026-01-08CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/101567
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-02
Filing Date
2025-06-18
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

In virtual networks, network congestion can easily occur during message forwarding, leading to performance degradation, a problem that current technologies cannot effectively solve.

Method used

By monitoring congestion in the packet forwarding network and using multiple token buckets to allocate tokens to packets of different priorities, QoS in the virtual network can be achieved, avoiding the high hardware resource requirements caused by using message queues.

Benefits of technology

It enables differentiated forwarding of packets with different priorities in a virtual network, reducing forwarding costs and solving the performance degradation problem caused by network congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025101567_08012026_PF_FP_ABST
    Figure CN2025101567_08012026_PF_FP_ABST
Patent Text Reader

Abstract

A message forwarding method, a system, an electronic device, and a storage medium. The method comprises: in response to receipt of a message to be forwarded, determining a sending object corresponding to the message to be forwarded, and monitoring whether congestion occurs in a message forwarding network used for forwarding the message to be forwarded; when congestion occurs in the message forwarding network, on the basis of a feature of the message to be forwarded, acquiring a token from multiple token buckets allocated to the sending object in advance, priorities of messages corresponding to different token buckets being different; when a first number of acquired tokens satisfies a preset forwarding condition, forwarding the message to be forwarded by means of the message forwarding network, the preset forwarding condition being used for characterizing the number of tokens required for forwarding the message to be forwarded. By means of the described method, the technical problem in the related art of reduced performance of a virtual network, caused by network congestion in a message forwarding process, is resolved.
Need to check novelty before this filing date? Find Prior Art

Description

Message forwarding method and system, electronic device and storage medium TECHNICAL FIELD

[0001] The present disclosure relates to the field of data transmission, and in particular, to a message forwarding method and system, an electronic device and a storage medium. BACKGROUND

[0002] With the development of Internet technology, more and more data is forwarded through the Internet, and the forwarding of a large amount of data will occupy more network resources, so network congestion is likely to occur in the process of data forwarding. The traditional Quality of Service (QoS) allows different flows to compete for network resources unequally when network congestion occurs at the physical network (also referred to as underlay network) forwarding level, so as to allow voice, video and important data applications to be preferentially forwarded in network devices, but it cannot be applied in virtual networks (also referred to as overlay networks).

[0003] At present, no effective solution has been proposed for the above problems. SUMMARY

[0004] The embodiments of the present disclosure provide a message forwarding method and system, an electronic device and a storage medium to at least solve the technical problem that the performance of a virtual network is reduced due to network congestion in the process of message forwarding in the related art.

[0005] According to an aspect of an embodiment of the present disclosure, a message forwarding method is provided, comprising: in response to receiving a to-be-forwarded message, determining a sending object corresponding to the to-be-forwarded message, and monitoring whether a message forwarding network used for forwarding the to-be-forwarded message is congested; in the case that the message forwarding network is congested, obtaining tokens from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded message, wherein the messages corresponding to different token buckets have different priorities; in the case that a first number of the obtained tokens meets a preset forwarding condition, forwarding the to-be-forwarded message through the message forwarding network, wherein the preset forwarding condition is used to represent the number of tokens required for forwarding the to-be-forwarded message.

[0006] According to an aspect of the embodiments of the present disclosure, a message forwarding method is also provided. The method comprises: obtaining a to-be-forwarded message by calling a first interface, wherein the first interface comprises a first parameter, and a parameter value of the first parameter comprises the to-be-forwarded message; determining a sending object corresponding to the to-be-forwarded message, and monitoring whether a message forwarding network for forwarding the to-be-forwarded message is congested; in the case that the message forwarding network is congested, obtaining a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded message, wherein different token buckets correspond to messages with different priorities; and in the case that a first number of the obtained tokens meets a preset forwarding condition, forwarding the to-be-forwarded message through the message forwarding network by calling a second interface, wherein the second interface comprises a second parameter, a parameter value of the second parameter comprises the to-be-forwarded message, and the preset forwarding condition represents a number of tokens required for forwarding the to-be-forwarded message.

[0007] According to an aspect of the embodiments of the present disclosure, a message forwarding system is provided. The system comprises: a plurality of token buckets configured to store tokens; a message receiving module configured to receive a to-be-forwarded message; a network monitoring module configured to monitor whether a message forwarding network for forwarding the to-be-forwarded message is congested; and a scheduling module connected with the message receiving module, the network monitoring module and the token buckets, and configured to, in response to receiving the to-be-forwarded message, determine a sending object corresponding to the to-be-forwarded message, and in the case that the message forwarding network for forwarding the to-be-forwarded message is congested, obtain a token from the plurality of token buckets based on a feature of the to-be-forwarded message, and in the case that a first number of the obtained tokens meets a preset forwarding condition, forward the to-be-forwarded message through the message forwarding network, wherein the token buckets are token buckets pre-constructed based on different priority requirements of the sending object, and the preset forwarding condition represents a number of tokens required for forwarding the to-be-forwarded message.

[0008] According to another aspect of the embodiments of the present disclosure, a message forwarding apparatus is provided. The apparatus comprises: a monitoring module configured to, in response to receiving a to-be-forwarded message, determine a sending object corresponding to the to-be-forwarded message, and monitor whether a message forwarding network for forwarding the to-be-forwarded message is congested; an obtaining module configured to, in the case that the message forwarding network is congested, obtain a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded message, wherein different token buckets correspond to messages with different priorities; and a determining module configured to, in the case that a first number of the obtained tokens meets a preset forwarding condition, forward the to-be-forwarded message through the message forwarding network, wherein the preset forwarding condition represents a number of tokens required for forwarding the to-be-forwarded message.

[0009] According to an aspect of an embodiment of the present disclosure, a packet forwarding device is also provided, comprising: a first calling module configured to obtain a to-be-forwarded packet by calling a first interface, wherein the first interface comprises a first parameter, and a parameter value of the first parameter comprises the to-be-forwarded packet; a monitoring module configured to determine a sending object corresponding to the to-be-forwarded packet, and monitor whether a packet forwarding network used for forwarding the to-be-forwarded packet is congested; an obtaining module configured to, in a case where the packet forwarding network is congested, obtain a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein different token buckets correspond to packets with different priorities; and a second calling module configured to, in a case where a first number of the obtained token meets a preset forwarding condition, forward the to-be-forwarded packet through the packet forwarding network by calling a second interface, wherein the second interface comprises a second parameter, a parameter value of the second parameter comprises the to-be-forwarded packet, and the preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded packet.

[0010] According to another aspect of an embodiment of the present disclosure, an electronic device is also provided, comprising: a memory storing an executable program; and a processor configured to run the program, wherein the program, when running, performs the method in various embodiments of the present disclosure.

[0011] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is also provided, comprising a stored executable program, wherein the executable program, when running, controls a device where the computer-readable storage medium is located to perform the method in various embodiments of the present disclosure.

[0012] According to another aspect of an embodiment of the present disclosure, a computer program product is also provided, comprising a computer program, wherein the computer program, when executed by a processor, implements the method in various embodiments of the present disclosure.

[0013] In the embodiments of the present disclosure, by responding to receiving a to-be-forwarded packet, a sending object corresponding to the to-be-forwarded packet is determined, and it is monitored whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet; in the case that congestion occurs in the packet forwarding network, tokens are obtained from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein the packets corresponding to different token buckets have different priorities; in the case that a first number of the obtained tokens meets a preset forwarding condition, the to-be-forwarded packet is forwarded through the packet forwarding network, wherein the preset forwarding condition is used to represent the number of tokens required for forwarding the to-be-forwarded packet. It is easy to note that in the case that the network is congested, the purpose of forwarding the to-be-forwarded packet with different delays of different priorities can be achieved by obtaining tokens from a plurality of token buckets pre-allocated for the sending object, the QoS in the virtual network is achieved, and by the way of storing tokens in the token bucket, the problem of high demand for hardware resources caused by using the message queue to cache the to-be-forwarded packet is avoided, thereby reducing the cost of forwarding the to-be-forwarded packet, and further solving the technical problem that the virtual network performance is reduced due to network congestion in the process of packet forwarding in the related art.

[0014] It is easy to note that the above general description and the following detailed description are only for exemplifying and explaining the present disclosure, and do not constitute a limitation on the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0015] The drawings described herein are used to provide further understanding of the present disclosure, constitute a part of the present disclosure, and the illustrative embodiments of the present disclosure and the description thereof are used to explain the present disclosure, and do not constitute an improper limitation on the present disclosure. In the drawings:

[0016] FIG. 1 is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a packet forwarding method according to an embodiment of the present disclosure;

[0017] FIG. 2 is a structure block diagram of a computing environment according to an embodiment of the present disclosure;

[0018] FIG. 3 is a structure block diagram of a service mesh according to an embodiment of the present disclosure;

[0019] FIG. 4 is a flowchart of a packet forwarding method according to an embodiment of the present disclosure;

[0020] FIG. 5 is a schematic diagram of a token adding logic according to the present disclosure;

[0021] FIG. 6 is a schematic diagram of a packet forwarding manner according to an embodiment of the present disclosure;

[0022] FIG. 7 is a flowchart of a packet forwarding method according to an embodiment of the present disclosure;

[0023] FIG. 8 is a schematic diagram of a packet forwarding system according to an embodiment of the present disclosure;

[0024] FIG. 9 is a schematic diagram of a packet forwarding device according to an embodiment of the present disclosure;

[0025] FIG. 10 is a schematic diagram of a packet forwarding device according to an embodiment of the present disclosure;

[0026] FIG. 11 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to make the personnel in the technical field better understand the present disclosure scheme, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, not all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor should be within the scope of protection of the present disclosure.

[0028] It should be noted that the terms "first", "second" and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0029] First, some nouns or terms that appear in the description of the embodiments of the present disclosure are applicable to the following explanations:

[0030] Quality of Service: also known as Quality of Service, abbreviated as QoS, refers to the ability of a network to use various basic technologies to provide better service capabilities for specified network communication, which is a technology to solve network delay and congestion problems, which allows different traffic to unequally compete for network resources, and voice, video and important data applications can be given priority in network devices.

[0031] Physical network: also known as Underlay network, refers to the network of the current data center network basic forwarding architecture, which relies on routing for packet forwarding.

[0032] Virtual network: also known as Overlay network, refers to a virtual network built on the physical network foundation, the upper application only relates to the virtual network, and can be separated from other networks.

[0033] SNA: also known as Smart Network Appliance, is a programmable network device, which integrates programmable switching capability and super computing power into an integrated high-performance network platform.

[0034] Programmable switching chip: refers to a network chip programmable in the data plane of the network. The programmable switching chip in the core switching system is not limited to the control software of the underlying chip, and can be developed and customized according to its own needs. Different message processing and forwarding logic are customized for different needs and different scenarios.

[0035] Embodiment 1

[0036] According to the embodiments of the present disclosure, a message forwarding method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown.

[0037] The method embodiments provided by the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. FIG. 1 is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a message forwarding method according to an embodiment of the present disclosure. As shown in FIG. 1, the computer terminal 10 (or mobile device) can include one or more (in the figure, 102a, 102b, …, 102n are used to show) processors 102 (the processor 102 can include but not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication function. In addition, it can also include a cursor control device, a keyboard, a display, an input / output interface (I / O interface), a universal serial bus (Universal Serial Bus, USB) port (which can be included as one of the ports in the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that the structure shown in FIG. 1 is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or fewer components than those shown in FIG. 1, or have a different configuration from that shown in FIG. 1.

[0038] It should be noted that the one or more processors 102 and / or other data processing circuitry described above can be generally referred to herein as "data processing circuitry." The data processing circuitry can be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuitry can be a single standalone processing module or incorporated in whole or in part within any of the other elements of the computer terminal 10 (or mobile device). As referred to in the embodiments of the present disclosure, the data processing circuitry functions as a processor to control, for example, selection of the variable resistance terminal path connected to the interface.

[0039] The memory 104 can be used to store software programs of application software and modules, such as program instructions / data storage means corresponding to the method in the embodiments of the present disclosure. The processor 102 can execute various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e., implement the method in the embodiments described above. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory disposed remotely with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the network can include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0040] The transmission device 106 is configured to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (NIC) that can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module configured to communicate with the Internet in a wireless manner.

[0041] The display can be, for example, a touch screen type liquid crystal display (LCD) that can enable a user to interact with the user interface of the computer terminal 10 (or mobile device).

[0042] FIG. 1 illustrates a hardware structure diagram that can be used as an exemplary diagram for the computer terminal 10 (or mobile device) described above, as well as an exemplary diagram for the server described above. In an alternative embodiment, FIG. 2 illustrates an embodiment of using the computer terminal 10 (or mobile device) described above in FIG. 1 as a computing node in a computing environment 201 in a block diagram. FIG. 2 is a structural diagram of a computing environment according to an embodiment of the present disclosure, as shown in FIG. 2, the computing environment 201 includes a plurality of computing nodes (such as servers) running on a distributed network (shown in the figure as 210-1, 210-2,...). The computing nodes all contain local processing and memory resources, and the end user 202 can remotely run applications or store data in the computing environment 201. The applications can be provided as a plurality of services 220-1, 220-2, 220-3 and 220-4 in the computing environment 201, representing services "A", "D", "E" and "H", respectively.

[0043] The end user 202 can provide and access the services through a web browser or other software applications on the client, and in some embodiments, the provision and / or request of the end user 202 can be provided to the entry gateway 230. The entry gateway 230 can include a corresponding agent to process the provision and / or request for the services (one or more services provided in the computing environment 201).

[0044] The services are provided or deployed according to various virtualization technologies supported by the computing environment 201. In some embodiments, the services can be provided according to virtual machine (VM) based virtualization, container-based virtualization and / or the like. The virtual machine based virtualization can be to simulate a real computer by initializing a virtual machine, and to execute programs and applications without directly contacting any actual hardware resources. At the same time as the virtual machine virtualization machine, according to the container-based virtualization, the container can be started to virtualize the entire operating system (OS), so that multiple workloads can run on a single operating system instance.

[0045] In one embodiment based on container virtualization, several containers of a service can be assembled into a Pod (e.g., a Kubernetes Pod). For example, as shown in FIG. 2, service 220-2 can be equipped with one or more Pods 240-1, 240-2, …, 240-N (collectively, Pods). A Pod can include a proxy 245 and one or more containers 242-1, 242-2, …, 242-M (collectively, containers). The one or more containers in a Pod handle requests related to one or more respective functions of the service, and the proxy 245 generally controls network functions related to the service, such as routing, load balancing, etc. Other services can also be equipped with similar Pods.

[0046] In operation, executing a user request from end user 202 can require invoking one or more services in computing environment 201, and executing one or more functions of a service can require invoking one or more functions of another service. As shown in FIG. 2, service “A” 220-1 receives a user request from end user 202 from ingress gateway 230, and service “A” 220-1 can invoke service “D” 220-2, which can request service “E” 220-3 to execute one or more functions.

[0047] The computing environment described above can be a cloud computing environment, in which allocation of resources is managed by a cloud service provider, allowing development of functions without considering implementation, tuning, or scaling of servers. The computing environment allows developers to execute code in response to events without building or maintaining complex infrastructure. Instead of scaling up a single hardware device to handle potential load, services can be partitioned to complete a set of functions that can automatically scale independently.

[0048] In another alternative embodiment, FIG. 3 illustrates, in a block diagram, an embodiment of using the computer terminal 10 (or mobile device) shown in FIG. 1 above as a service mesh. FIG. 3 is a block diagram of a structure of a service mesh according to an embodiment of the present disclosure, as shown in FIG. 3, the service mesh 300 is mainly used to facilitate secure and reliable communication between multiple microservices, which refers to breaking down an application into multiple smaller services or instances and running them on different clusters / machines.

[0049] As shown in FIG. 3, the microservices can include application service instance A and application service instance B, which form a functional application layer of the service mesh 300. In one implementation, application service instance A is running in the form of container / process 308 on machine / workload container group 314 (Pod), and application service instance B is running in the form of container / process 310 on machine / workload container group 316 (Pod).

[0050] In an implementation, the application service instance A can be a commodity query service, and the application service instance B can be a commodity ordering service.

[0051] As shown in FIG. 3, the application service instance A and the mesh proxy 303 coexist in the machine workload container group 314, and the application service instance B and the mesh proxy 305 coexist in the machine workload container 316. The mesh proxy 303 and the mesh proxy 305 form a data plane layer of the service mesh 300. Among them, the mesh proxy 303 and the mesh proxy 305 run in the form of containers / processes 304, 306 respectively, can receive the request 312 for commodity query service, and the mesh proxy 303 and the application service instance A can communicate bidirectionally, the mesh proxy 305 and the application service instance B can communicate bidirectionally. In addition, the mesh proxy 303 and the mesh proxy 305 can also communicate bidirectionally.

[0052] In an implementation, the traffic of the application service instance A is all routed to the appropriate destination through the mesh proxy 303, and the network traffic of the application service instance B is all routed to the appropriate destination through the mesh proxy 305. It should be noted that the network traffic mentioned herein includes but is not limited to Hyper Text Transfer Protocol (HTTP), Representational State Transfer (REST), Google Remote Procedure Call (gRPC), and Redis.

[0053] In an implementation, the function of extending the data plane layer can be implemented by writing a custom filter for the proxy (Envoy) in the service mesh 300, and the service mesh proxy configuration can be to make the service mesh correctly proxy service traffic, implement service interconnection and service governance. The mesh proxy 303 and the mesh proxy 305 can be configured to perform at least one of the following functions: service discovery, health checking, routing, load balancing, authentication and authorization, and observability.

[0054] As shown in FIG. 3, the service mesh 300 also includes a control plane layer. Among them, the control plane layer can be a group of services running in a dedicated namespace, which are hosted by a hosting control plane component 301 in a machine / Pod 302. As shown in FIG. 3, the hosting control plane component 301 communicates bidirectionally with the mesh agent 303 and the mesh agent 305. The hosting control plane component 301 is configured to perform some control management functions. For example, the hosting control plane component 301 receives telemetry data transmitted by the mesh agent 303 and the mesh agent 305, and can further aggregate the telemetry data. These services, the hosting control plane component 301 can also provide a user-oriented application programming interface (API) to more easily manipulate network behavior, and provide configuration data to the mesh agent 303 and the mesh agent 305, etc.

[0055] In the above running environment, the present disclosure provides a packet forwarding method as shown in FIG. 4. FIG. 4 is a flowchart of a packet forwarding method according to Embodiment 1 of the present disclosure, as shown in FIG. 4, the method comprises:

[0056] Step S402: In response to receiving the to-be-forwarded packet, determining the sending object corresponding to the to-be-forwarded packet, and monitoring whether congestion occurs in the packet forwarding network used to forward the to-be-forwarded packet.

[0057] The to-be-forwarded packet described above refers to a data packet sent by different users, which needs to be forwarded to other users through network devices such as routers and switches. The packet forwarding network can be a network used to implement packet forwarding, which can be a physical network or a virtual network in a cloud computing scenario. In the present disclosure, a virtual network is taken as an example for illustration. The sending object can be a mobile terminal such as a smartphone, an IPAD, a tablet computer, a notebook computer, or a user sending the to-be-forwarded packet.

[0058] In an optional embodiment, the to-be-forwarded packet can be directly sent to the packet forwarding system by the user, for example, the user sends the data packet needed to be sent by the user to the router and the switch. Optionally, the to-be-forwarded packet can also be sent to the packet forwarding device by a packet sending device, for example, a physical machine, a virtual machine, etc. That is, the physical machine, the virtual machine, etc. send the data packet needed to be forwarded to the packet forwarding device. Optionally, the present disclosure does not make specific limitations on the sending mode of the to-be-forwarded packet.

[0059] Optionally, after receiving the to-be-forwarded packet, the to-be-forwarded packet can be parsed first, and the sending object that sends the to-be-forwarded packet can be determined. Since the to-be-forwarded packet is forwarded to the receiving end device through the packet forwarding network, it is necessary to monitor whether the packet forwarding network is congested in real time, so as to ensure that the to-be-forwarded packet can be forwarded in time and quickly. That is, in the case that the packet forwarding network is congested, the congestion can be processed in time, and in the case that the packet forwarding network is not congested, the to-be-forwarded packet can be directly forwarded. Optionally, the following steps can be taken to monitor whether the packet forwarding network is congested:

[0060] Firstly, the network traffic can be monitored. Optionally, a network traffic monitoring tool can be used to monitor the traffic of the packet forwarding network in real time, including real-time traffic, bandwidth utilization, packet loss rate, etc.

[0061] Secondly, the device performance can be checked, that is, the performance of the devices involved in the packet forwarding network, such as routers, switches, firewalls, etc., including central processor utilization, memory utilization, etc., to determine whether the device has a performance bottleneck.

[0062] Thirdly, the packet forwarding delay can be analyzed, that is, by monitoring the transmission delay of the packet in the network, it is determined whether the network is congested, and high delay may be one of the manifestations of network congestion.

[0063] Further, the link state can be checked, that is, the state of each link in the packet forwarding network is monitored, specifically, the bandwidth utilization, packet loss rate, delay, etc. of the link can be monitored to determine whether there is a link congestion.

[0064] Finally, a network analysis tool can be used, that is, the network analysis tool is used to deeply analyze the packet forwarding network to find potential network congestion problems and process them in time.

[0065] Step S404: In the case that the packet forwarding network is congested, tokens are obtained from a plurality of token buckets pre-assigned to the sending object based on the characteristics of the to-be-forwarded packet.

[0066] Different tokens in different token buckets correspond to packets with different priorities.

[0067] The token bucket described above can be a tool for limiting packet forwarding. The token bucket algorithm generates a certain number of tokens in different time periods. The to-be-forwarded packet needs to consume one or more tokens to be forwarded. If there are not enough tokens in a certain time period, the data packet will be temporarily blocked until there are enough tokens to forward the to-be-forwarded packet, so as to realize QoS when the network is congested and avoid network performance degradation.

[0068] The features of the to-be-forwarded packet can include size, type, priority, and the like of the to-be-forwarded packet.

[0069] In an optional embodiment, in a case where it is determined that the packet forwarding network is congested, a plurality of token buckets previously allocated for the sending object can be determined, so that the plurality of token buckets can be managed and controlled. Since the priorities of the packets corresponding to different token buckets are different, a target token bucket can be determined from the plurality of token buckets according to the priority of the to-be-forwarded packet, for example, a to-be-forwarded packet with a high priority corresponds to a token bucket with a high forwarding rate, and a to-be-forwarded packet with a low priority corresponds to a token bucket with a low forwarding rate. Optionally, the priority of the to-be-forwarded packet can be determined according to the type of the to-be-forwarded packet, for example, a to-be-forwarded packet of a video type has a high priority, and a to-be-forwarded packet of a text type has a low priority. Optionally, the priority of the to-be-forwarded packet can also be determined according to the size of the to-be-forwarded packet, for example, a to-be-forwarded packet with a large size has a high priority, and a to-be-forwarded packet with a small size has a low priority.

[0070] Further, when the packet forwarding network is congested, a target token bucket that meets the to-be-forwarded packet can be determined from the plurality of token buckets according to the features of the to-be-forwarded packet, and a corresponding number of tokens can be further obtained from the target token bucket, which can be automatically performed by a token bucket management program, or the tokens can be obtained according to a rule preset by a user. Optionally, after sufficient tokens are obtained, the to-be-forwarded packet can be forwarded, so as to relieve the congestion of the packet forwarding network.

[0071] Step S406: Forwarding the to-be-forwarded packet through the packet forwarding network in a case where the first number of obtained tokens meets a preset forwarding condition.

[0072] The preset forwarding condition is used to represent the number of tokens required for forwarding the to-be-forwarded packet.

[0073] The first number can be the remaining number of tokens in the token bucket corresponding to the to-be-forwarded packet. The preset forwarding condition can be the current number of tokens in the token bucket corresponding to the to-be-forwarded packet, that is, the first number can meet the forwarding of the to-be-forwarded packet.

[0074] In an optional embodiment, after the first number of obtained tokens is determined, whether to forward the to-be-forwarded packet through the packet forwarding network can be determined according to the first number. If the first number of tokens is greater than or equal to the number of tokens required for forwarding the to-be-forwarded packet, the packet can be directly forwarded through the packet forwarding network.

[0075] In another alternative embodiment, if the first number of tokens acquired is less than the number of tokens required for forwarding the to-be-forwarded packet, the tokens need to be generated and added to the token bucket until the first number of tokens is equal to the number of tokens required for forwarding the to-be-forwarded packet, so as to forward the packet through the packet forwarding network.

[0076] Optionally, the devices provided by mainstream device manufacturers basically support QoS functions, including traditional port-based QoS and customer-differentiated QoS, that is, at the ingress, data packets are classified into different categories or set to different priorities, then when the packet is forwarded out of the device, the packet is cached in a queue and a certain scheduling algorithm is adopted to arrange the forwarding order of the packet, and when the network is congested, high-priority data packets are preferentially forwarded, but this traditional QoS method can only be applied to underlay networks and cannot provide QoS services for tenants at the overlay level. In order to realize differentiated user traffic and scheduling according to the priority of the user, the device manufacturers implement the QoS method.

[0077] QoS further refines the traffic by multi-level queues, so that multiple user transmission objects can be uniformly managed and hierarchically scheduled, and in the form of VLAN (Virtual Local Area Network) beside the scheduler, the classification rules of the retriever are marked, and the SP (Strict Priority) of the upstream node, WRR (Weighted Round Robin), GTS (Generic Traffic Shaping) representing the control parameters of the upstream node are pointed to, when the scheduling strategy is applied to the interface, the traffic entering the interface can be classified and managed multiple times, compared with the traditional one-layer QoS, the biggest difference is that the scheduling queue can be divided into multiple scheduling levels such as physical level, logical level, application level, etc., among which different levels can use different features for traffic management, for example, the physical level is used to manage the bandwidth of the entire physical interface, while the logical level can be used to manage the bandwidth of each user on the interface, and the application level can be used to manage the bandwidth of different applications of a user. In this way, the tenant-level QoS function can also be realized on the overlay level, but the disadvantages of this method are also obvious, for example, it continues to implement QoS scheduling based on the queue combined with the scheduler mode, which is multiple hierarchical on the traditional QoS, and the data packet needs to be buffered in each queue first, so more hardware resources are needed, that is, the demand for hardware resources is high, so the cost of packet forwarding is high. The method involved in the present disclosure occupies less hardware resources because it does not use queue buffering, and in the implementation process, it can create corresponding multi-level token buckets for thousands of tenants on a programmable chip, for example, provide customized QoS services for each tenant, so it can be widely used in cloud network scenarios.

[0078] In the embodiments of the present disclosure, by responding to receiving a to-be-forwarded packet, a sending object corresponding to the to-be-forwarded packet is determined, and it is monitored whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet; in the case that congestion occurs in the packet forwarding network, tokens are obtained from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein the different token buckets correspond to packets of different priorities; in the case that a first number of the obtained tokens meets a preset forwarding condition, the to-be-forwarded packet is forwarded through the packet forwarding network, wherein the preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded packet. It is easy to note that in the case that congestion occurs in the network, the purpose of forwarding the to-be-forwarded packet with different delays of different priorities can be achieved by obtaining tokens from the plurality of token buckets pre-allocated for the sending object, the QoS in the virtual network is achieved, and by the way of storing tokens in the token bucket, the problem of high demand for hardware resources caused by using a message queue to cache the to-be-forwarded packet is avoided, thereby reducing the cost of forwarding the to-be-forwarded packet, and further solving the technical problem that the virtual network performance is reduced due to network congestion in the process of packet forwarding in the related art.

[0079] In the above embodiments of the present disclosure, obtaining the token from the plurality of token buckets pre-allocated for the sending object based on the feature of the to-be-forwarded packet comprises: determining the plurality of token buckets based on the feature of the to-be-forwarded packet; determining a target priority of the to-be-forwarded packet based on the feature of the to-be-forwarded packet; determining a target token bucket corresponding to the target priority from the plurality of token buckets; and obtaining the token from the target token bucket based on a length of the to-be-forwarded packet.

[0080] The feature of the to-be-forwarded packet can be the identity of a tenant to which the to-be-forwarded packet belongs, wherein the tenant refers to different users, organizations or application programs in a cloud computing environment, who share the same set of system or platform resources but are isolated from each other.

[0081] The plurality of token buckets can be token buckets constructed for packets of different priorities, and different token buckets correspond to different priorities, for example, a high-priority token bucket (which can be referred to as a gold token bucket), a normal-priority token bucket (which can be referred to as a silver token bucket), a low-priority token bucket (which can be referred to as a copper token bucket), etc. Optionally, in the present disclosure, the number of the plurality of token buckets can be set by a user according to the priority demand of the packet.

[0082] The target priority can be the priority of the to-be-forwarded packet.

[0083] The target token bucket can be a token bucket matched with the priority of the to-be-forwarded packet, that is, the priority corresponding to the target token bucket is the same as the target priority.

[0084] Optionally, the multiple token buckets can be determined by the following steps:

[0085] Firstly, the characteristics of the to-be-forwarded packet can be extracted, which can include the size of the packet, the source address, the target address, the protocol type, the service type, etc.

[0086] Secondly, a series of matching rules can be set according to the characteristics of the to-be-forwarded packet, which are used to determine which token buckets the packet should be allocated to.

[0087] Thirdly, the to-be-forwarded packet can be allocated to the corresponding multiple token buckets according to the results of the matching rules, and different token buckets can correspond to different network resources or services.

[0088] Finally, the token bucket has its own token generation rate and capacity limit, and whether there are enough tokens for forwarding the packet can be determined according to the allocation of the token bucket.

[0089] Optionally, the target priority of the to-be-forwarded packet can be determined by the following steps:

[0090] Firstly, the characteristics of the to-be-forwarded packet can be extracted, which can include the size of the packet, the source address, the target address, the protocol type, the service type, etc.

[0091] Secondly, a series of priority rules can be set, and then the priority of the to-be-forwarded packet can be determined according to its characteristics, which can include priority promotion for a specific service type or target address, or priority reduction for a specific source address, etc.

[0092] Thirdly, the target priority of the to-be-forwarded packet can be determined according to the results of the priority rules, so as to perform corresponding scheduling and forwarding in the network.

[0093] Optionally, the priority can also be divided according to the Differentiated Services Code Point (DSCP) of the to-be-forwarded packet, such as DSCP 1-5 representing high priority (corresponding to gold token bucket), 6-10 representing medium priority (corresponding to silver token bucket), and 11-15 representing low priority (corresponding to bronze token bucket). Optionally, the division rules can be set by the tenant.

[0094] In an optional embodiment, after obtaining the plurality of token buckets and determining the target priority of the to-be-forwarded packet, the target token bucket corresponding to the target priority of the to-be-forwarded packet can be determined from the plurality of token buckets. For example, assuming that the target priority is a high priority, the gold token bucket in the token bucket can be used for packet forwarding; assuming that the target priority is a normal priority, the silver token bucket in the token bucket can be used for packet forwarding; and assuming that the target priority is a low priority, the copper token bucket in the token bucket can be used for packet forwarding. Optionally, by providing the QoS service for the tenant, the priority of different flows can be divided according to the setting of the tenant, and the normal forwarding value of the high-priority flow is preferentially guaranteed, so as to realize the overlay-level QoS service for the tenant.

[0095] In the above embodiment of the present disclosure, the plurality of token buckets are determined based on the characteristics of the to-be-forwarded packet, including: extracting the virtual local area network identifier of the to-be-forwarded packet from the characteristics of the to-be-forwarded packet; obtaining the token bucket corresponding to the virtual local area network identifier to obtain the plurality of token buckets.

[0096] The virtual local area network identifier (also referred to as VLAN ID) is a number or label used to identify a VLAN, which is used to distinguish different VLANs on switches and routers and ensure correct transmission of data between different VLANs. The VLAN ID is usually a number, and the range can be between 1 and 4094.

[0097] In an optional embodiment, a special table can be used to determine the tenant according to the virtual local area network identifier, and then the priority is obtained according to the DSCP of the packet, so as to determine the plurality of token buckets corresponding to the packet forwarding network.

[0098] In the above embodiment of the present disclosure, the target priority of the to-be-forwarded packet is determined based on the characteristics of the to-be-forwarded packet, including: comparing the characteristics of the to-be-forwarded packet with a plurality of preset characteristics corresponding to priorities to determine the preset characteristics matched with the to-be-forwarded packet; and determining the priority corresponding to the preset characteristics matched with the to-be-forwarded packet as the target priority.

[0099] The above-mentioned preset characteristics can be packet characteristics corresponding to different priorities, such as IP address, DSCP, port number and the like.

[0100] In an optional embodiment, when the target priority of the to-be-forwarded packet is determined based on the characteristics of the to-be-forwarded packet, the preset characteristics can be set for different priorities in advance, and the characteristics of the to-be-forwarded packet are compared with the preset characteristics corresponding to the priorities, so that the priority corresponding to the preset characteristics matched with the to-be-forwarded packet can be determined as the priority of the to-be-forwarded packet.

[0101] In the above embodiments of the present disclosure, the obtaining of the token from the target token bucket based on the length of the to-be-forwarded packet comprises: determining a first number based on the length of the to-be-forwarded packet, a total capacity of the target token bucket and a second number of tokens added in the target token bucket; and obtaining the token from the target token bucket according to the first number.

[0102] The second number can be the number of tokens added in the target token bucket.

[0103] In an optional embodiment, the token can be obtained from the target token bucket based on the length of the to-be-forwarded packet, the total capacity of the target token bucket and the second number of tokens added in the target token bucket, that is, the number of tokens required for forwarding the to-be-forwarded packet is determined according to the length of the to-be-forwarded packet. Optionally, a corresponding rule can be set when determining the number of tokens required for forwarding the to-be-forwarded packet. Optionally, the number of tokens consumed by a packet is proportional to the size (bit) of the packet. Assuming that the size of a packet is x bit and the bucket depth (that is, the capacity of the token bucket) is z bit, the number of tokens in the token bucket is actually an integer value when implemented in programming. Assuming that the maximum integer value is y, where y is not specifically limited in the present disclosure, and y is taken as 2 to the power of 32 in the present disclosure for illustration, then the number of tokens consumed by a packet is x×(y / z). Further, the token can be obtained from the target token bucket according to the first number of tokens in the token bucket corresponding to the to-be-forwarded packet.

[0104] In the above embodiments of the present disclosure, the method further comprises: determining a total number of token buckets based on the priority requirement, and determining a total capacity of the token buckets based on the networking bandwidth; generating the token buckets according to the total number of token buckets and the total capacity of the token buckets; and adding tokens into the token buckets in sequence based on the networking bandwidth and the priority corresponding to the token buckets.

[0105] In an optional embodiment, a corresponding number of token buckets can be created according to the priority of the to-be-forwarded packet required by the tenant to forward, for example, three token buckets are created for a tenant who wants to implement QoS of three priority traffics, namely, gold, silver and bronze medal traffics. That is, a gold medal bucket, a silver medal bucket and a bronze medal bucket are created, wherein the capacities of the three token buckets can be consistent. Optionally, a suitable capacity of the token bucket can be set according to the networking bandwidth, for example, the capacity (Bytes) of the token bucket is set according to the empirical formula: bandwidth (kbit / s)×1000 (s) / 8 when the bandwidth≤100 Mbit / s; and the capacity (Bytes) of the token bucket is 100000 (kbit / s)×1000 (s) / 8 when the bandwidth>100 Mbit / s. Further, tokens can be added into the multiple token buckets in sequence based on the networking bandwidth and the priority corresponding to the multiple token buckets.

[0106] In the above embodiment of the present disclosure, based on the networking bandwidth and the priority corresponding to the token bucket, tokens are sequentially added to the token bucket, including: determining a second number of tokens to be added to the token bucket based on the networking bandwidth; adding tokens to a first token bucket corresponding to the highest priority according to the second number; determining whether the current number of tokens in the first token bucket exceeds the total capacity of the first token bucket; in the case that the current number does not exceed the total capacity, based on adding tokens to the first token bucket according to the second number until the current number exceeds the total capacity; in the case that the current number exceeds the total capacity, repeating the steps of adding tokens to a second token bucket corresponding to the next priority according to the second number, and determining whether the current number of tokens in the second token bucket exceeds the total capacity of the second token bucket, until the multiple token buckets are added with tokens.

[0107] The first token bucket described above can be a token bucket with the highest priority, for example, a gold token bucket.

[0108] The second token bucket described above can be a token bucket with a priority only next to the first token bucket, for example, a silver token bucket.

[0109] In an optional embodiment, when adding tokens to multiple token buckets, a second number of tokens to be added to the multiple token buckets can be determined based on the networking bandwidth, and then tokens are sequentially added to the multiple token buckets according to the priorities of different token buckets in the multiple token buckets. Optionally, assuming that the first token bucket has the highest priority, tokens are first added to the first token bucket according to the second number until the current number of tokens in the first token bucket exceeds the total capacity of the first token bucket, then tokens are added to the second token bucket based on the second number until the current number of tokens in the second token bucket exceeds the total capacity of the second token bucket, and then the method can be used to add tokens to the token bucket with the next priority.

[0110] Figure 5 is a schematic diagram of a token adding logic according to the present disclosure. As shown in Figure 5, tokens can be generated by a token generation module. When the token generation module generates n tokens, the tokens can be added to the gold token bucket, the silver token bucket, and the bronze token bucket in order of priority. Optionally, assuming that the current number of tokens in the gold token bucket is a, after adding n tokens, the number of tokens A in the gold token bucket becomes a+n. Further, it is necessary to determine whether the gold token bucket is full, i.e., whether the overflow value N is greater than 0, where the overflow value N = a+n-z, and z is the maximum capacity of the plurality of token buckets. When the overflow value is greater than 0, the tokens can be added to the silver token bucket. When the overflow value is not greater than 0, the gold token bucket continues to be added. Assuming that the current number of tokens in the silver token bucket is b, after adding n tokens, the number of tokens B in the silver token bucket becomes b+n. Optionally, when the overflow value N = b+n-z of the silver token bucket is greater than 0, the tokens can be added to the bronze token bucket based on the above method. When the overflow value is not greater than 0, the silver token bucket continues to be added.

[0111] In the above embodiments of the present disclosure, the method further includes discarding the to-be-forwarded packet when the first number does not satisfy the preset forwarding condition.

[0112] In an optional embodiment, if the current number of tokens in the token bucket corresponding to the to-be-forwarded packet cannot satisfy forwarding of the to-be-forwarded packet, the to-be-forwarded packet needs to be discarded.

[0113] Figure 6 is a schematic diagram of a packet forwarding method according to an embodiment of the present disclosure. As shown in Figure 6, when a tenant packet, i.e., a packet to be forwarded, is obtained, the priority of the packet to be forwarded is determined using a tenant-level traffic difference module. In order of priority from high to low, the packet to be forwarded can be forwarded using gold medal traffic, silver medal traffic, and bronze medal traffic in turn. The gold medal traffic corresponds to a gold medal bucket, the silver medal traffic corresponds to a silver medal bucket, and the bronze medal traffic corresponds to a bronze medal bucket. Optionally, when adding tokens, a token generation module adds tokens at a fixed rate and adds the tokens to the gold medal bucket, the silver medal bucket, and the bronze medal bucket in order of priority from high to low. The gold medal bucket is used to forward gold medal packets, i.e., packets with the highest priority. The silver medal bucket is used to forward silver medal packets, i.e., packets with a priority only next to that of the gold medal packets. The bronze medal bucket is used to forward bronze medal packets, i.e., packets with a priority only next to that of the silver medal packets. Optionally, during token addition, when the tokens in the gold medal bucket are full, i.e., the gold medal bucket leaks, tokens can be added to the silver medal bucket. Further, when the tokens in the silver medal bucket are full, i.e., the silver medal bucket leaks, tokens can be added to the bronze medal bucket. Optionally, during packet forwarding, if the current number of tokens, i.e., a first number, in the token bucket corresponding to the packet to be forwarded meets the forwarding requirement, the packet to be forwarded can be normally forwarded. If the current number of tokens in the token bucket corresponding to the packet to be forwarded does not meet the forwarding requirement, the packet to be forwarded needs to be discarded, i.e., gold medal packet discarding, silver medal packet discarding, and bronze medal packet discarding are performed.

[0114] In the above-described embodiments of the present disclosure, the method further includes determining the number of remaining tokens in the target token bucket, obtaining a difference between the number of remaining tokens and the first number, determining that the first number meets the preset forwarding condition when the difference is greater than or equal to a preset difference, and determining that the first number does not meet the preset forwarding condition when the difference is less than the preset difference.

[0115] The preset difference described above can be set by a person skilled in the art as needed. In the present disclosure, the preset difference is taken as 0 for illustration.

[0116] In an optional embodiment, assuming that a packet to be forwarded needs to consume x tokens and the current bucket still has y tokens, when y-x >= 0, it indicates that sufficient tokens are obtained, otherwise, it indicates that sufficient tokens are not obtained.

[0117] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0118] It should be noted that for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited to the action sequence described, because according to the present disclosure, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present disclosure.

[0119] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the method of each embodiment of the present disclosure.

[0120] Embodiment 2

[0121] According to another aspect of the embodiments of the present disclosure, another packet forwarding method is also provided. Fig. 7 is a flowchart of a packet forwarding method according to Embodiment 2 of the present disclosure. As shown in Fig. 7, the method includes:

[0122] Step S702: obtaining a to-be-forwarded packet by calling a first interface.

[0123] The first interface includes a first parameter, and a parameter value of the first parameter includes the to-be-forwarded packet.

[0124] Step S704: determining a sending object corresponding to the to-be-forwarded packet, and monitoring whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet.

[0125] Step S706: in the case that congestion occurs in the packet forwarding network, obtaining a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet.

[0126] Different tokens correspond to different priorities of the messages.

[0127] Step S708: In a case where the first number of the obtained tokens meets a preset forwarding condition, the second interface is called to forward the to-be-forwarded message through the message forwarding network.

[0128] The second interface includes a second parameter, and a parameter value of the second parameter includes the to-be-forwarded message. The preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded message.

[0129] The first interface can be a data interface on a graphical user interface of the client 70, and is used to obtain the to-be-forwarded message.

[0130] The second interface can be a data interface on a graphical user interface of the client 70, and is used to output the to-be-forwarded message.

[0131] In an optional embodiment, a user can input the to-be-forwarded message on a graphical user interface of the client 70, and after the server 71 obtains the to-be-forwarded message by calling the first interface, the user determines a sending object corresponding to the to-be-forwarded message, and monitors whether the message forwarding network used for forwarding the to-be-forwarded message is congested. Optionally, in a case where the message forwarding network is not congested, the to-be-forwarded message is directly forwarded. In a case where the message forwarding network is congested, tokens are obtained from token buckets corresponding to the message forwarding network based on a feature of the to-be-forwarded message, and in a case where a first number of the obtained tokens meets a preset forwarding condition, the second interface is called to forward the to-be-forwarded message through the message forwarding network.

[0132] Embodiment 3

[0133] According to the embodiments of the present disclosure, a system for implementing the message forwarding method is also provided. FIG. 8 is a schematic diagram of a message forwarding system according to Embodiment 3 of the present disclosure. As shown in FIG. 8, the system 800 includes:

[0134] A plurality of token buckets 80 are configured to store tokens.

[0135] A message receiving module 81 is configured to receive a to-be-forwarded message.

[0136] A network monitoring module 82 is configured to monitor whether a message forwarding network is congested, where the message forwarding network is used to forward the to-be-forwarded message.

[0137] The scheduling module 83 is connected with the packet receiving module 81, the network monitoring module 82 and the plurality of token buckets 80, and is configured to, in response to receiving a to-be-forwarded packet, determine a sending object corresponding to the to-be-forwarded packet, and in a case where it is monitored that congestion occurs in the packet forwarding network used for forwarding the to-be-forwarded packet, acquire tokens from the plurality of token buckets 80 based on a feature of the to-be-forwarded packet, and in a case where a first number of the acquired tokens satisfies a preset forwarding condition, forward the to-be-forwarded packet through the packet forwarding network. The token bucket is a token bucket pre-constructed based on different priority requirements of the sending object, and the preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded packet.

[0138] In an optional embodiment, the plurality of token buckets 80, the packet receiving module 81, the network monitoring module 82 and the scheduling module 83 are connected respectively, so that the scheduling module 83 can acquire tokens from the token bucket corresponding to the packet forwarding network based on the feature of the to-be-forwarded packet when congestion occurs in the packet forwarding network, and determine whether to forward the to-be-forwarded packet through the packet forwarding network based on the first number of the acquired tokens.

[0139] In the above embodiments of the present disclosure, the token generation module is connected with the plurality of token buckets, and is configured to determine a third number of the plurality of token buckets corresponding to the packet forwarding network based on priority requirements, and determine a total capacity of the plurality of token buckets based on a networking bandwidth; generate the plurality of token buckets according to the third number and the total capacity; and add tokens to the plurality of token buckets in sequence based on the networking bandwidth and priorities corresponding to the plurality of token buckets.

[0140] In an optional embodiment, the token generation module is connected with the plurality of token buckets, so that the token generation module can determine a third number of the plurality of token buckets corresponding to the packet forwarding network based on priority requirements, and determine a total capacity of the plurality of token buckets based on a networking bandwidth, and then generate the plurality of token buckets according to the third number and the total capacity, so as to add tokens to the plurality of token buckets in sequence based on the networking bandwidth and priorities corresponding to the plurality of token buckets.

[0141] Embodiment 4

[0142] According to the embodiments of the present disclosure, an apparatus for implementing the above packet forwarding method is also provided. FIG. 9 is a schematic diagram of a packet forwarding apparatus according to Embodiment 4 of the present disclosure. As shown in FIG. 9, the apparatus includes a monitoring module 902, an acquiring module 904 and a determining module 906.

[0143] The monitoring module 902 is configured to determine a sending object corresponding to the to-be-forwarded packet in response to receiving the to-be-forwarded packet, and monitor whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet. The obtaining module 904 is configured to obtain a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, in a case where the packet forwarding network is congested, wherein the plurality of token buckets correspond to packets with different priorities. The determining module 906 is configured to forward the to-be-forwarded packet through the packet forwarding network in a case where a first quantity of the obtained tokens meets a preset forwarding condition, wherein the preset forwarding condition is used to represent a quantity of tokens required for forwarding the to-be-forwarded packet.

[0144] In the foregoing embodiments of the present disclosure, the obtaining module 904 includes: a first determining unit configured to determine the plurality of token buckets based on the feature of the to-be-forwarded packet; a second determining unit configured to determine a target priority of the to-be-forwarded packet based on the feature of the to-be-forwarded packet; a third determining unit configured to determine a target token bucket corresponding to the target priority from the plurality of token buckets; and an obtaining unit configured to obtain the token from the target token bucket based on a length of the to-be-forwarded packet.

[0145] In the foregoing embodiments of the present disclosure, the first determining unit includes: an extracting subunit configured to extract a virtual local area network identifier of the to-be-forwarded packet from the feature of the to-be-forwarded packet; and a first obtaining subunit configured to obtain a token bucket corresponding to the virtual local area network identifier to obtain the plurality of token buckets.

[0146] In the foregoing embodiments of the present disclosure, the second determining unit includes: a comparing subunit configured to compare the feature of the to-be-forwarded packet with preset features corresponding to a plurality of priorities to determine a preset feature matched with the to-be-forwarded packet; and a first determining subunit configured to determine a priority corresponding to the preset feature matched with the to-be-forwarded packet as the target priority.

[0147] In the foregoing embodiments of the present disclosure, the obtaining unit includes: a second determining subunit configured to determine the first quantity based on the length of the to-be-forwarded packet, a total capacity of the target token bucket, and a second quantity of tokens added in the target token bucket; and a second obtaining subunit configured to obtain the token from the target token bucket according to the first quantity.

[0148] In the foregoing embodiments of the present disclosure, the apparatus further includes: a second determining module configured to determine a total quantity of the token buckets based on the priority requirement, and determine a total capacity of the token buckets based on the networking bandwidth; a generating module configured to generate the token buckets according to the total quantity of the token buckets and the total capacity of the token buckets; and an adding module configured to add tokens into the token buckets in sequence based on the networking bandwidth and the priority corresponding to the token buckets.

[0149] In the above-mentioned embodiments of the present disclosure, the adding module comprises: a third determining unit configured to determine a second number of tokens to be added to the token bucket based on the networking bandwidth; a first adding unit configured to add tokens to the first token bucket corresponding to the highest priority according to the second number; a fourth determining unit configured to determine whether a current number of tokens in the first token bucket exceeds a total capacity of the first token bucket; a second adding unit configured to, in a case where the current number does not exceed the total capacity, add tokens to the first token bucket according to the second number until the current number exceeds the total capacity; and a fifth determining unit configured to, in a case where the current number exceeds the total capacity, repeatedly perform the steps of determining whether a current number of tokens in a second token bucket corresponding to a next priority exceeds a total capacity of the second token bucket by adding tokens to the second token bucket according to the second number until tokens are added to all the token buckets.

[0150] In the above-mentioned embodiments of the present disclosure, the device further comprises a discarding module configured to discard the to-be-forwarded packet in a case where the first number does not satisfy the preset forwarding condition.

[0151] In the above-mentioned embodiments of the present disclosure, the device further comprises: a third determining module configured to determine a remaining number of tokens in the target token bucket; a second obtaining module configured to obtain a difference between the remaining number of tokens and the first number; a fourth determining module configured to determine that the first number satisfies the preset forwarding condition in a case where the difference is greater than or equal to a preset difference; and a fifth determining module configured to determine that the first number does not satisfy the preset forwarding condition in a case where the difference is less than the preset difference.

[0152] It should be noted that the above-mentioned monitoring module 902, obtaining module 904 and determining module 906 correspond to steps S402 to S406 in Embodiment 1, and the three modules have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (for example, memory 94) and processed by one or more processors (for example, processors 92a, 92b, …, 92n), and the above-mentioned modules can also be a part of the device and can run in the computer terminal 9 provided in Embodiment 1.

[0153] It should be noted that the preferred embodiments involved in the above-mentioned embodiments of the present disclosure have the same scheme, application scenario and implementation process as those provided in Embodiment 1, but are not limited to the scheme provided in Embodiment 1.

[0154] Embodiment 5

[0155] According to the embodiments of the present disclosure, the packet forwarding method is also provided with an apparatus. FIG. 10 is a schematic diagram of a packet forwarding apparatus according to an embodiment 5 of the present disclosure. As shown in FIG. 10, the apparatus comprises a first calling module 1002, a monitoring module 1004, an obtaining module 1006, and a second calling module 1008.

[0156] The first calling module 1002 is configured to obtain the packet to be forwarded by calling a first interface, wherein the first interface comprises a first parameter, and a parameter value of the first parameter comprises the packet to be forwarded. The monitoring module 1004 is configured to determine a sending object corresponding to the packet to be forwarded, and monitor whether a packet forwarding network used for forwarding the packet to be forwarded is congested. The obtaining module 1006 is configured to, in the case that the packet forwarding network is congested, obtain a token from a plurality of token buckets pre-allocated for the sending object based on a feature of the packet to be forwarded, wherein different token buckets correspond to packets with different priorities. The second calling module 1008 is configured to, in the case that a first number of the obtained tokens meets a preset forwarding condition, forward the packet to be forwarded through the packet forwarding network by calling a second interface, wherein the second interface comprises a second parameter, and a parameter value of the second parameter comprises the packet to be forwarded, and the preset forwarding condition is used to represent a number of tokens required for forwarding the packet to be forwarded.

[0157] It should be noted that the first calling module 1002, the monitoring module 1004, the obtaining module 1006, and the second calling module 1008 correspond to the steps S702 to S708 in the embodiment 2, and the four modules have the same instances and application scenarios as the corresponding steps, but are not limited to the solutions provided in the embodiment 2. It should be noted that the modules or units can be hardware components or software components stored in a memory (for example, the memory 104) and processed by one or more processors (for example, the processors 102a, 102b, …, 102n), or the modules can be a part of the apparatus and can run in the computer terminal 10 provided in the embodiment 1.

[0158] It should be noted that the preferred embodiments involved in the above embodiments of the present disclosure have the same application scenarios, implementation processes as the solutions provided in the embodiment 2, but are not limited to the solutions provided in the embodiment 2.

[0159] Embodiment 6

[0160] The embodiments of the present disclosure can provide an electronic device, which can be any one of the electronic devices in the electronic device group. Alternatively, in the present embodiment, the electronic device can also be replaced with a terminal device such as a mobile terminal.

[0161] Optionally, in the embodiment, the electronic device can be located in at least one of the plurality of network devices of the computer network.

[0162] In the embodiment, the computer terminal can execute program codes in the method.

[0163] Optionally, FIG. 11 is a structural block diagram of an electronic device according to an embodiment of the present disclosure. As shown in the figure, the electronic device A can include one or more (only one is shown in the figure) processors 1102, a memory 1104, a storage controller, and a peripheral interface connected with a radio frequency module, an audio module, and a display.

[0164] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the method and device in the embodiments of the present disclosure. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the method in the above embodiments. The memory can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to the terminal A through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0165] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: in response to receiving a to-be-forwarded packet, determining a sending object corresponding to the to-be-forwarded packet, and monitoring whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet; in the case that congestion occurs in the packet forwarding network, obtaining tokens from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein different token buckets correspond to packets with different priorities; in the case that a first number of the obtained tokens meets a preset forwarding condition, forwarding the to-be-forwarded packet through the packet forwarding network, wherein the preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded packet.

[0166] Optionally, the processor can further execute program codes of the following steps: determining a plurality of token buckets based on the feature of the to-be-forwarded packet; determining a target priority of the to-be-forwarded packet based on the feature of the to-be-forwarded packet; determining a target token bucket corresponding to the target priority from the plurality of token buckets; and obtaining tokens from the target token bucket based on a length of the to-be-forwarded packet.

[0167] Optionally, the processor can further execute program codes of the following steps: extracting a virtual local area network identifier of the to-be-forwarded packet from the characteristics of the to-be-forwarded packet; obtaining a token bucket corresponding to the virtual local area network identifier to obtain a plurality of token buckets.

[0168] Optionally, the processor can further execute program codes of the following steps: comparing the characteristics of the to-be-forwarded packet with preset characteristics corresponding to a plurality of priorities to determine a preset characteristic matched with the to-be-forwarded packet; determining a priority corresponding to the preset characteristic matched with the to-be-forwarded packet as a target priority.

[0169] Optionally, the processor can further execute program codes of the following steps: determining the first quantity based on the length of the to-be-forwarded packet, a total capacity of the target token bucket, and a second quantity of tokens added into the target token bucket; and obtaining tokens from the target token bucket according to the first quantity.

[0170] Optionally, the processor can further execute program codes of the following steps: determining a total quantity of the token buckets based on the priority requirement, and determining a total capacity of the token buckets based on the networking bandwidth; generating the token buckets according to the total quantity of the token buckets and the total capacity of the token buckets; and adding tokens into the token buckets in sequence based on the networking bandwidth and the priorities corresponding to the token buckets.

[0171] Optionally, the processor can further execute program codes of the following steps: determining a second quantity of tokens added into the token buckets based on the networking bandwidth; adding tokens into a first token bucket corresponding to the highest priority according to the second quantity; determining whether a current quantity of tokens in the first token bucket exceeds a total capacity of the first token bucket; in a case where the current quantity does not exceed the total capacity, repeatedly adding tokens into the first token bucket according to the second quantity until the current quantity exceeds the total capacity; and in a case where the current quantity exceeds the total capacity, repeatedly performing the steps of adding tokens into a second token bucket corresponding to a next priority according to the second quantity, and determining whether a current quantity of tokens in the second token bucket exceeds a total capacity of the second token bucket until tokens are added into all the token buckets.

[0172] Optionally, the processor can further execute program codes of the following steps: discarding the to-be-forwarded packet in a case where the first quantity does not satisfy a preset forwarding condition.

[0173] Optionally, the processor can further execute program codes of the following steps: determining a remaining quantity of tokens in the target token bucket; obtaining a difference between the remaining quantity of tokens and the first quantity; determining that the first quantity satisfies the preset forwarding condition in a case where the difference is greater than or equal to a preset difference; and determining that the first quantity does not satisfy the preset forwarding condition in a case where the difference is less than the preset difference.

[0174] In the embodiments of the present disclosure, by responding to receiving a to-be-forwarded packet, a sending object corresponding to the to-be-forwarded packet is determined, and it is monitored whether congestion occurs in a packet forwarding network used for forwarding the to-be-forwarded packet; in the case that congestion occurs in the packet forwarding network, tokens are obtained from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein the packets corresponding to different token buckets have different priorities; in the case that a first number of the obtained tokens meets a preset forwarding condition, the to-be-forwarded packet is forwarded through the packet forwarding network, wherein the preset forwarding condition is used to represent a number of tokens required for forwarding the to-be-forwarded packet. It is easy to note that in the case that congestion occurs in the network, the purpose of forwarding the to-be-forwarded packets with different priorities with different delays can be achieved by obtaining tokens from a plurality of token buckets pre-allocated for the sending object, the QoS in the virtual network is achieved, and by the way of storing tokens in the token bucket, the problem of high demand for hardware resources caused by using the message queue to cache the to-be-forwarded packets is avoided, thereby reducing the cost of forwarding the to-be-forwarded packets, and further solving the technical problem that the virtual network performance is reduced due to network congestion in the process of packet forwarding in the related art.

[0175] Those skilled in the art can understand that the structure as shown in the figure is only schematic, and the electronic device can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a mobile Internet device (MID), a PAD, and the like. The figure does not limit the structure of the above-mentioned electronic device. For example, the electronic device A can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figure, or have a different configuration from that shown in the figure.

[0176] Those skilled in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing the related hardware of the terminal device through a program, and the program can be stored in a computer readable storage medium, which can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0177] Embodiment 7

[0178] The embodiments of the present disclosure further provide a computer readable storage medium. Optionally, in the present embodiment, the above-mentioned computer readable storage medium can be used to save the program code executed by the method provided by the above-mentioned embodiments.

[0179] Optionally, in the embodiment, the storage medium can be located in any one of the electronic devices in the computer network or any one of the mobile terminals in the mobile terminal group.

[0180] Optionally, in the embodiment, the computer readable storage medium is configured to store program codes for performing the following steps: determining a sending object corresponding to the to-be-forwarded packet in response to receiving the to-be-forwarded packet, and monitoring whether congestion occurs in the packet forwarding network used for forwarding the to-be-forwarded packet; in the case that congestion occurs in the packet forwarding network, obtaining tokens from a plurality of token buckets pre-allocated for the sending object based on the characteristics of the to-be-forwarded packet, wherein the packets corresponding to different token buckets have different priorities; and in the case that a first number of the obtained tokens meets a preset forwarding condition, forwarding the to-be-forwarded packet through the packet forwarding network, wherein the preset forwarding condition represents the number of tokens required for forwarding the to-be-forwarded packet.

[0181] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps: determining a plurality of token buckets based on the characteristics of the to-be-forwarded packet; determining a target priority of the to-be-forwarded packet based on the characteristics of the to-be-forwarded packet; determining a target token bucket corresponding to the target priority from the plurality of token buckets; and obtaining tokens from the target token bucket based on the length of the to-be-forwarded packet.

[0182] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps: extracting a virtual local area network identifier of the to-be-forwarded packet from the characteristics of the to-be-forwarded packet; and obtaining a token bucket corresponding to the virtual local area network identifier to obtain the plurality of token buckets.

[0183] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps: comparing the characteristics of the to-be-forwarded packet with preset characteristics corresponding to a plurality of priorities, determining a preset characteristic matched with the to-be-forwarded packet, and determining a priority corresponding to the preset characteristic matched with the to-be-forwarded packet as the target priority.

[0184] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps: determining the first number based on the length of the to-be-forwarded packet, a total capacity of the target token bucket, and a second number of tokens added to the target token bucket; and obtaining the tokens from the target token bucket according to the first number.

[0185] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps: determining a total number of the token buckets based on the priority requirement, and determining a total capacity of the token buckets based on the networking bandwidth; generating the token buckets according to the total number of the token buckets and the total capacity of the token buckets; and adding tokens to the token buckets in sequence based on the networking bandwidth and the priorities corresponding to the token buckets.

[0186] Optionally, the computer readable storage medium is further arranged to store program code for performing the following steps: determining a second number of tokens to be added into the token bucket based on the networking bandwidth; adding tokens into the first token bucket corresponding to the highest priority according to the second number; determining whether a current number of tokens in the first token bucket exceeds a total capacity of the first token bucket; in a case that the current number does not exceed the total capacity, repeatedly adding tokens into the first token bucket according to the second number until the current number exceeds the total capacity; in a case that the current number exceeds the total capacity, repeatedly performing the steps of adding tokens into a second token bucket corresponding to a next priority according to the second number, and determining whether a current number of tokens in the second token bucket exceeds a total capacity of the second token bucket, until tokens are added into all the token buckets.

[0187] Optionally, the computer readable storage medium is further arranged to store program code for performing the following steps: discarding the packet to be forwarded in a case that the first number does not satisfy the preset forwarding condition.

[0188] Optionally, the computer readable storage medium is further arranged to store program code for performing the following steps: determining a remaining number of tokens in the target token bucket; obtaining a difference between the remaining number of tokens and the first number; determining that the first number satisfies the preset forwarding condition in a case that the difference is greater than or equal to a preset difference; and determining that the first number does not satisfy the preset forwarding condition in a case that the difference is less than the preset difference.

[0189] Embodiment 8

[0190] The embodiments of the present disclosure further provide a computer program. Optionally, the computer program described above, when executed by a processor, implements the method provided by the above-described embodiments.

[0191] The above-mentioned serial numbers of the embodiments of the present disclosure are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0192] In the above-described embodiments of the present disclosure, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0193] In several embodiments provided by the present disclosure, it should be understood that the disclosed technology can be implemented in other manners. For example, the described embodiments of the apparatus are merely schematic. For example, the division of the units is only a logical function division. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, access layers, or middleware layers. For example, the components or units can be integrated into one physical or logical entity, or one or more components can be physically or logically separated.

[0194] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0195] In addition, each functional unit in the various embodiments of the present disclosure can be integrated into one processing unit, or each unit can exist physically or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0196] When 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 computer-readable storage medium. Based on this understanding, the technical solutions of the present disclosure essentially or substantially or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0197] The above description is only the preferred embodiments of the present disclosure, and it should be pointed out that for those of ordinary skill in the art, without departing from the principles of the present disclosure, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present disclosure. Industrial applicability

[0198] In the case of network congestion, the different delay forwarding of the different priority to-be-forwarded messages can be realized by obtaining tokens from the multiple token buckets pre-allocated for the sending objects, the QoS in the virtual network is realized, and by the token bucket storage token, the problem of high hardware resource demand caused by using the message queue to cache the to-be-forwarded messages is avoided, thereby the cost of forwarding the to-be-forwarded messages is reduced, and further the technical problem of the virtual network performance reduction caused by the network congestion in the process of message forwarding in the related technology is solved.

Claims

1. A packet forwarding method, comprising: in response to receiving a packet to be forwarded, determining a sending object corresponding to the packet to be forwarded, and monitoring whether congestion occurs in a packet forwarding network for forwarding the packet to be forwarded; in a case where congestion occurs in the packet forwarding network, obtaining a token from a plurality of token buckets pre-allocated for the sending object based on a characteristic of the packet to be forwarded, wherein different token buckets correspond to packets with different priorities; in a case where a first number of the obtained token satisfies a preset forwarding condition, forwarding the packet to be forwarded through the packet forwarding network, wherein the preset forwarding condition is used to represent a number of tokens required for forwarding the packet to be forwarded.

2. The method of claim 1, wherein, The obtaining of the token from the plurality of token buckets pre-allocated for the sending object based on the characteristic of the packet to be forwarded comprises: determining the plurality of token buckets based on the characteristic of the packet to be forwarded; determining a target priority of the packet to be forwarded based on the characteristic of the packet to be forwarded; determining a target token bucket corresponding to the target priority from the plurality of token buckets; obtaining the token from the target token bucket based on a length of the packet to be forwarded.

3. The method of claim 2, wherein, The determining of the plurality of token buckets based on the characteristic of the packet to be forwarded comprises: extracting a virtual local area network identifier of the packet to be forwarded from the characteristic of the packet to be forwarded; obtaining token buckets corresponding to the virtual local area network identifier to obtain the plurality of token buckets.

4. The method of claim 2, wherein, The determining of the target priority of the packet to be forwarded based on the characteristic of the packet to be forwarded comprises: comparing the characteristic of the packet to be forwarded with preset characteristics corresponding to a plurality of priorities to determine a preset characteristic matched with the packet to be forwarded; determining a priority corresponding to the preset characteristic matched with the packet to be forwarded as the target priority.

5. The method of claim 2, wherein, The obtaining of the token from the target token bucket based on the length of the packet to be forwarded comprises: determining the first number based on the length of the packet to be forwarded, a total capacity of the target token bucket, and a second number of tokens added to the target token bucket; obtaining the token from the target token bucket according to the first number.

6. The method of any one of claims 2 to 5, wherein, The method further comprises: determining a total number of the token buckets based on a priority requirement, and determining a total capacity of the token buckets based on a networking bandwidth; generating the token buckets according to the total number of the token buckets and the total capacity of the token buckets; adding tokens to the token buckets in sequence based on the networking bandwidth and priorities corresponding to the token buckets.

7. The method of claim 6, wherein, The adding of the tokens to the token buckets in sequence based on the networking bandwidth and the priorities corresponding to the token buckets comprises: determining a second number of tokens added to the token buckets based on the networking bandwidth; adding tokens to a first token bucket corresponding to a highest priority according to the second number; determining whether a current number of tokens in the first token bucket exceeds a total capacity of the first token bucket; in a case where the current number does not exceed the total capacity, adding tokens to the first token bucket according to the second number until the current number exceeds the total capacity. In the case that the current quantity exceeds the total capacity, the step of adding tokens into a second token bucket corresponding to a next priority according to the second quantity, and determining whether the current quantity of tokens in the second token bucket exceeds the total capacity of the second token bucket, is repeatedly performed until the adding of tokens into the plurality of token buckets is completed.

8. The method of claim 1, wherein, The method further comprises: In the case that the first quantity does not satisfy the preset forwarding condition, discarding the to-be-forwarded packet.

9. The method of any one of claims 1 to 8, wherein, The method further comprises: determining a remaining token quantity of the target token bucket; obtaining a difference value between the remaining token quantity and the first quantity; In the case that the difference value is greater than or equal to a preset difference value, determining that the first quantity satisfies the preset forwarding condition; In the case that the difference value is less than the preset difference value, determining that the first quantity does not satisfy the preset forwarding condition.

10. A packet forwarding method, comprising: obtaining a to-be-forwarded packet by calling a first interface, wherein the first interface comprises a first parameter, and a parameter value of the first parameter comprises the to-be-forwarded packet; determining a sending object corresponding to the to-be-forwarded packet, and monitoring whether a packet forwarding network for forwarding the to-be-forwarded packet is congested; in the case that the packet forwarding network is congested, obtaining tokens from a plurality of token buckets pre-allocated for the sending object based on a feature of the to-be-forwarded packet, wherein different token buckets correspond to packets of different priorities; in the case that a first quantity of the obtained tokens satisfies a preset forwarding condition, forwarding the to-be-forwarded packet through the packet forwarding network by calling a second interface, wherein the second interface comprises a second parameter, a parameter value of the second parameter comprises the to-be-forwarded packet, and the preset forwarding condition is used to represent a quantity of tokens required for forwarding the to-be-forwarded packet.

11. A packet forwarding system, comprising: a plurality of token buckets configured to store tokens; a packet receiving module configured to receive a to-be-forwarded packet; a network monitoring module configured to monitor whether a packet forwarding network for forwarding the to-be-forwarded packet is congested; a scheduling module connected with the packet receiving module, the network monitoring module and the token buckets, and configured to, in response to receiving the to-be-forwarded packet, determine a sending object corresponding to the to-be-forwarded packet, and in the case that the packet forwarding network for forwarding the to-be-forwarded packet is congested, obtain tokens from the plurality of token buckets based on a feature of the to-be-forwarded packet, and in the case that a first quantity of the obtained tokens satisfies a preset forwarding condition, forward the to-be-forwarded packet through the packet forwarding network, wherein the token buckets are token buckets pre-constructed based on different priority requirements of the sending object, and the preset forwarding condition is used to represent a quantity of tokens required for forwarding the to-be-forwarded packet.

12. The system of claim 11, wherein, The system further comprises: The token generation module is connected with the plurality of token buckets, and is configured to determine a third number of the plurality of token buckets corresponding to the message forwarding network based on priority requirements, and determine a total capacity of the plurality of token buckets based on networking bandwidth; generate the plurality of token buckets according to the third number and the total capacity; and add tokens to the plurality of token buckets in sequence based on the networking bandwidth and priorities corresponding to the plurality of token buckets. 13.An electronic device, comprising: a memory storing an executable program; a processor configured to execute the program, wherein the program, when executed, performs the method of any one of claims 1 to 10.

14. A computer readable storage medium comprising a stored executable program, wherein, controlling a device in which the storage medium is located to perform the method of any one of claims 1 to 10 when the executable program is executed. 15.A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 10.

Citation Information

Patent Citations

  • Access equipment and its bandwidth control means

    CN101064672A

  • Data packet processing method and apparatus based on token barrel algorithm

    CN101478494A

  • Method and system for limiting speed of token bucket based on priority

    CN101997766A

  • Traffic management method and device, electronic equipment and storage medium

    CN116455828A

  • Bandwidth allocation method and apparatus

    WO2010038226A1