Traffic control method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611425402.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-10-16
AI Technical Summary
[0003]目前,云服务器网络带宽限速主要是通过在云服务器或虚拟网卡创建时将限速配置写入静态配置文件来实现,在云服务器运行期间不支持动态变更限速配置,导致限速配置不灵活,存在无法满足用户需求和应对实际业务变化需求的问题
[0010]本公开实施例提供的技术方案与现有技术相比具有如下优点:
Smart Images

Figure CN122933546A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a flow control method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of cloud computing technology, cloud servers have become a core infrastructure for enterprises and individual users to deploy business applications. In a cloud computing environment, network bandwidth, as a crucial resource dimension of cloud servers, is not only a key basis for billing and pricing but also a core factor affecting the quality of business services. Users typically need to reasonably limit the network bandwidth of cloud servers based on their own business traffic characteristics and cost budgets to avoid high costs or network congestion caused by sudden traffic surges, thereby ensuring the stability of business operations and the controllability of costs.
[0003] Currently, network bandwidth limiting for cloud servers is mainly achieved by writing the speed limit configuration into a static configuration file when the cloud server or virtual network card is created. Dynamic changes to the speed limit configuration are not supported during the operation of the cloud server, resulting in inflexible speed limit configuration and the inability to meet user needs and cope with actual business changes. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a flow control method, apparatus, electronic device, and storage medium.
[0005] A first aspect of this disclosure provides a flow control method, including: Receive a traffic control request sent by the user. The traffic control request includes a first rate limiting level type and a first rate limiting parameter. Determine the first virtual interface corresponding to the first rate limiting level type, and execute the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain the traffic rate limiting rules; Traffic control is implemented based on traffic rate limiting rules.
[0006] A second aspect of this disclosure provides a flow control device, comprising: The request receiving module is used to receive traffic control requests sent by users. The traffic control request includes a first rate limiting level type and a first rate limiting parameter. The rate limiting configuration module is used to determine the first virtual interface corresponding to the first rate limiting level type, and to perform traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain the traffic rate limiting rules. The flow control module is used to control flow based on flow rate limiting rules.
[0007] A third aspect of this disclosure provides an electronic device, including: processor; Memory, used to store executable instructions; The processor is used to read executable instructions from memory and execute the executable instructions to implement the flow control method provided in the first aspect above.
[0008] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the flow control method provided in the first aspect.
[0009] A fifth aspect of this disclosure provides a computer program product comprising a computer program or instructions that, when executed by a processor, implement the flow control method of the first aspect described above.
[0010] The technical solution provided in this disclosure has the following advantages compared with the prior art: The traffic control method, apparatus, electronic device, and storage medium provided in this disclosure can receive traffic control requests sent by users in real time and execute rate limiting configurations by calling the corresponding virtual interface according to the rate limiting level type specified in the traffic control request. This allows for the dynamic generation and application of traffic rate limiting rules during cloud server operation, completely overcoming the limitation of static configuration files being fixed at creation time and unchangeable during runtime. It achieves dynamic adjustability and immediate effectiveness of traffic rate limiting rules. Simultaneously, it supports fine-grained and differentiated bandwidth management for different rate limiting levels. Users can flexibly configure differentiated traffic rate limiting rules according to different business needs, significantly improving the flexibility and adaptability of network bandwidth management, effectively responding to business traffic fluctuations, and better meeting users' diverse real-time business needs. Attached Figure Description
[0011] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0012] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of a flow control method provided in an embodiment of this disclosure; Figure 2 This is a flowchart of a speed limit level downgrade processing method provided in an embodiment of this disclosure; Figure 3This is a flowchart of another flow control method provided in this embodiment of the disclosure; Figure 4 This is a schematic diagram of the structure of a flow control device provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0014] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0015] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0016] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0017] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0018] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0019] With the rapid development of cloud computing technology, cloud servers have become a core infrastructure for enterprises and individual users to deploy business applications. In a cloud computing environment, network bandwidth, as a crucial resource dimension of cloud servers, is not only a key basis for billing and pricing but also a core factor affecting the quality of business services. Users typically need to reasonably limit the network bandwidth of their cloud servers based on their business traffic characteristics and cost budgets to avoid high costs or network congestion caused by sudden traffic spikes, thereby ensuring the stability of business operations and the controllability of costs.
[0020] Currently, cloud server network bandwidth limiting schemes mainly fall into three categories: the first is a single network interface card (NIC) level limiting scheme, which sets an independent bandwidth limit for each virtual NIC, and the sum of the NIC limits constitutes the theoretical maximum total bandwidth of the entire machine. When changing the limit, the parameters of each NIC need to be modified individually. The second is a machine-wide limiting scheme, which sets a total bandwidth limit for the cloud server, and all NICs share this quota. When changing the limit, the parameters of the entire machine only need to be modified. The third is a static configuration limiting scheme, which determines the limiting level and parameters when the cloud server is created and writes them into a static configuration file. No dynamic changes are supported during operation.
[0021] However, single-NIC-level rate limiting schemes, lacking overall constraints between NICs, cannot guarantee that the actual total bandwidth of the entire system will not exceed the expected upper limit, leading to uncontrolled costs and service quality. System-wide rate limiting schemes have fixed rate limiting granularity, failing to meet the business requirements of independent rate limiting for individual NICs, and lack a dynamic switching mechanism with single-NIC schemes, preventing users from flexibly adjusting the rate limiting level according to business scenarios. Static configuration schemes do not support runtime changes, cannot adapt to bandwidth adjustment needs during business operation, and have high change costs and impact business continuity. Furthermore, none of the above schemes consider the persistence of policies in hot migration scenarios, and rate limiting configurations may be lost after migration. Simultaneously, when the underlying network service does not support system-wide rate limiting, existing schemes lack automatic degradation mechanisms, directly returning failure and rendering the rate limiting function completely unusable, resulting in insufficient system robustness and compatibility. To address these issues, this disclosure provides a traffic control method, which will be described below with reference to specific embodiments.
[0022] Figure 1 This is a flowchart of a flow control method provided in an embodiment of the present disclosure. The method can be executed by a flow control device, which can be implemented in software and / or hardware. The flow control device can be configured in an electronic device, such as a server or terminal, wherein the terminal specifically includes a mobile phone, computer or tablet computer, etc.
[0023] like Figure 1 As shown, the flow control method provided in this embodiment includes the following steps.
[0024] S110: Receive a flow control request sent by the user.
[0025] In this embodiment of the disclosure, a traffic control request can be understood as a set of instructions initiated by a user to set or modify the network bandwidth limit of a cloud server. Specifically, it may include a first rate limiting level type and a first rate limiting parameter.
[0026] In this embodiment of the disclosure, the first rate limiting level type is used to characterize the granularity of traffic control desired by the user, which may specifically include system-wide rate limiting and single network card-level rate limiting.
[0027] In this embodiment of the disclosure, only one of the different flow control granularities is in effect at any given time. For example, when the system-wide flow control is in effect, the single-NIC-level rate limiting rule is not in effect. Similarly, when the single-NIC-level flow control is in effect, the system-wide flow control rule is not in effect.
[0028] The first speed limit parameter can be understood as the specific bandwidth threshold set by the user.
[0029] Specifically, electronic devices can receive traffic control requests sent by users through an application programming interface (API) via a computing management unit. This request is a user instruction to manage network bandwidth for a specific cloud server, containing two key pieces of information: a first rate-limiting level type and a first rate-limiting parameter. The first rate-limiting level type indicates the user's desired rate-limiting granularity, such as limiting the total bandwidth of the entire cloud server (system-wide) or limiting the bandwidth of each virtual network interface card (NIC) individually (single NIC level). The first rate-limiting parameter contains the specific bandwidth value.
[0030] S120. Determine the first virtual interface corresponding to the first rate limiting level type, and execute the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain the traffic rate limiting rules.
[0031] In this embodiment of the disclosure, the first virtual interface can be understood as the target operation object determined according to the first rate limiting level type. For example, if the first rate limiting level type is system-wide, the first virtual interface points to the main virtual interface representing the system; if the first rate limiting level type is single network card level, the first virtual interface points to a specific virtual network card interface.
[0032] Specifically, after receiving a traffic control request from a user, the electronic device can extract the first rate limiting level type from the request and determine the first virtual interface based on the first rate limiting level type. Then, it can call the first virtual interface and execute traffic limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain the traffic limiting rules.
[0033] S130. Traffic control is performed based on traffic rate limiting rules.
[0034] Specifically, after obtaining the traffic rate limiting rules, electronic devices can control the traffic of data packets passing through the virtual interface according to the traffic rate limiting rules, thereby achieving precise control of the network ingress and egress bandwidth of the cloud server.
[0035] In this embodiment, by receiving real-time traffic control requests from users and calling the corresponding virtual interface to execute rate limiting configurations based on the rate limiting level type specified in the request, traffic rate limiting rules can be dynamically generated and applied during cloud server operation. This completely overcomes the limitation of static configuration files being fixed at creation time and unable to be changed during runtime, achieving dynamic adjustability and immediate effect of traffic rate limiting rules. Simultaneously, it supports fine-grained and differentiated bandwidth management for different rate limiting levels. Users can flexibly configure differentiated traffic rate limiting rules according to different business needs, significantly improving the flexibility and adaptability of network bandwidth management, effectively responding to business traffic fluctuations, and better meeting users' diverse real-time business needs.
[0036] In this embodiment of the disclosure, after receiving a flow control request, the electronic device first parses the first rate limiting level type in the flow control request. When it is determined that the first rate limiting level type is system-wide rate limiting, the calculation management unit does not immediately execute system-wide rate limiting operation, but triggers a capability check to determine whether to perform a rate limiting level downgrade.
[0037] The following will combine Figure 2 A detailed introduction will be provided.
[0038] Figure 2 This is a flowchart of a speed limit level degradation processing method provided in an embodiment of this disclosure. Figure 2 As shown, the specific steps of the rate limiting and degradation processing method after receiving a traffic control request from a user are as follows: S210. After receiving the traffic control request sent by the user, if the first rate limiting level type is machine-level rate limiting, determine whether the network service supports machine-level rate limiting.
[0039] In this embodiment of the disclosure, the network service is a software component running on the host machine or network node, providing a unified network bandwidth management interface, and its underlying capabilities depend on the implementation of the data plane.
[0040] Specifically, electronic devices can determine whether the current underlying network data plane supports machine-level flow control by querying the configuration items or capability set interfaces of the network service module.
[0041] S220. If it is determined that whole-machine-level speed limiting is not supported, the first speed limiting level type is downgraded to obtain the second speed limiting level type after downgrading.
[0042] In this embodiment of the disclosure, the degradation process can be understood as a high availability guarantee mechanism. When high-level functions (such as system-wide rate limiting) cannot be implemented, the system automatically switches to low-level functions (such as single network card-level rate limiting) to ensure that core rate limiting requirements can still be met.
[0043] Specifically, if the electronic device determines, based on the inspection results, that the network service does not support system-wide rate limiting, the computing management unit will automatically execute degradation processing logic. This logic will forcibly modify the user's requested first rate limiting level type to a more basic level, resulting in a degraded second rate limiting level type. This is done to avoid the entire rate limiting operation failing due to capability mismatch, thus preventing the user's cloud server from completely losing traffic control protection. Subsequently, the computing management unit will no longer use the level of the user's original request, but will instead execute the subsequent traffic rate limiting configuration process based on this newly obtained second rate limiting level type.
[0044] In some embodiments of this disclosure, the first rate limiting level type is downgraded to obtain a second rate limiting level type after downgrading. Specifically, this may include: changing the first rate limiting level type from machine-level rate limiting to single network card-level rate limiting to obtain the second rate limiting level type.
[0045] Specifically, when an electronic device determines that the entire system is unavailable, it can directly modify the level type variable in memory from an enumeration value representing the entire system to an enumeration value representing a single network interface card (NIC). This modification is atomic and will be used as the basis for traffic configuration in subsequent steps to obtain the second rate-limiting level type.
[0046] S230, Execute traffic rate limiting configuration based on the second rate limiting level type.
[0047] In some embodiments of this disclosure, traffic rate limiting configuration is performed based on the second rate limiting level type. Specifically, this may include: when the second rate limiting level type is single network card level rate limiting, determining the second rate limiting parameter corresponding to the second rate limiting level type based on the first rate limiting parameter; traversing the second virtual interfaces corresponding to each network card, and performing traffic rate limiting configuration based on the second virtual interfaces and the second rate limiting parameter.
[0048] Specifically, when the electronic device's second rate limiting level is single-NIC-level rate limiting, the computing management unit first processes the rate limiting parameters. Since the user's original request for the first rate limiting parameter is for the total bandwidth of the entire machine, while single-NIC-level rate limiting requires individual settings for each NIC, the total bandwidth of the entire machine needs to be converted to single-NIC bandwidth. A preset parameter determination method is used to determine the second rate limiting parameters. Next, the second virtual interface corresponding to each NIC is determined. The computing management unit iterates through the interface list corresponding to the second virtual interface, and for each second virtual interface in the interface list, it initiates an independent single-NIC rate limiting request to the network service module, carrying the interface's identifier and the calculated second rate limiting parameters. This allows the network service unit to create independent rate limiting rules for each NIC, thereby achieving batch setting of rate limiting rules for all NICs.
[0049] The preset parameter determination method can be the average allocation method, which divides the total bandwidth value corresponding to the first rate-limiting parameter by the total number of virtual network cards to obtain the second rate-limiting parameter for each network card. Other allocation methods are also possible, which can be determined according to user needs and system settings, and are not limited here.
[0050] In this embodiment, the introduction of an automatic degradation mechanism significantly improves the robustness and compatibility of the traffic control system. It avoids request errors or rate limiting failures caused by users configuring features not supported by the platform, ensuring smooth operation of the traffic control function across different hardware and software environments, guaranteeing a consistent user experience, and reducing operational complexity. Simultaneously, it can convert the first rate limiting parameter to the rate limiting parameter corresponding to the degraded second rate limiting level type for traffic rate limiting configuration, avoiding configuration errors caused by mismatched rate limiting parameters and ensuring the integrity and atomicity of the configuration operation.
[0051] In this embodiment of the disclosure, after executing the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain the traffic rate limiting rules, when the user needs to change the rate limiting level, a rate limiting level change request is initiated to change the rate limiting level.
[0052] In this embodiment of the disclosure, after executing traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain traffic rate limiting rules, the traffic control method may further include: receiving a rate limiting level change request sent by a user and determining the target rate limiting level type corresponding to the rate limiting level change request; calling the first virtual interface to clear the traffic rate limiting rules; and after the traffic rate limiting rules are cleared, calling the target virtual interface corresponding to the target rate limiting level type to execute the traffic rate limiting configuration corresponding to the rate limiting level change request to obtain the target traffic rate limiting rules.
[0053] In this embodiment of the disclosure, a rate limiting level change request can be understood as a user-initiated instruction to switch the currently effective flow control granularity to another granularity.
[0054] Specifically, after obtaining the traffic rate limiting rules, the electronic device can receive a rate limiting level change request sent by the user, parse the request, and obtain the target rate limiting level type corresponding to the request. Before executing the rate limiting level change, it calls the first virtual interface to clear the currently effective traffic rate limiting rules to ensure that the rate limiting rules on the network data plane are completely removed. After the clearing operation returns successfully, it calls the target virtual interface corresponding to the target rate limiting level type to execute the traffic rate limiting configuration corresponding to the rate limiting level change request, thereby obtaining the target traffic rate limiting rules.
[0055] In this embodiment of the disclosure, when changing the rate limiting level, the rigorous operation process of clearing the old rules and then setting the new rules effectively avoids rule conflicts and resource residues, ensuring the smoothness and accuracy of the switching process. This allows the cloud platform to adjust the network policy in real time according to business needs without restarting the cloud server or interrupting the business, thus realizing online dynamic switching of the traffic control level.
[0056] In this embodiment, to ensure the persistence and recoverability of the traffic control policy, a metadata storage mechanism is introduced. After the computing management unit successfully executes the traffic rate limiting configuration and obtains the effective traffic rate limiting rule, it immediately persists the key information of this configuration. This information includes the first rate limiting level type corresponding to the currently effective traffic rate limiting rule and the specific first rate limiting parameters.
[0057] In this embodiment of the disclosure, after executing traffic limiting configuration based on the first virtual interface and the first limiting parameter to obtain traffic limiting rules, the traffic control method may further include: storing the first limiting level type and the first limiting parameter corresponding to the traffic limiting rules into the virtual device metadata.
[0058] Specifically, after obtaining the traffic rate limiting rules, the electronic device can call the write interface of the metadata storage service based on the computing management unit, and write the first rate limiting level type and the first rate limiting parameter as attribute values into the virtual device metadata record associated with the cloud server, using the unique identifier of the cloud server (such as UUID) as the primary key.
[0059] In some embodiments of this disclosure, the metadata may be stored in a distributed database or shared storage, without limitation herein.
[0060] In this embodiment, by persisting the traffic control policy to the virtual device metadata record, it is decoupled from the virtual machine's lifecycle. This makes the traffic control policy a persistent attribute of the cloud server, rather than just a temporary state in the host machine's memory, providing a solid foundation for system disaster recovery and state synchronization. It ensures that the rate limiting policy is not lost due to host machine restarts, service restarts, or management module failures, greatly enhancing the system's reliability and state consistency management capabilities.
[0061] In this embodiment of the disclosure, after the electronic device has migrated to a virtual device (such as a cloud server), the rate limiting rules can be restored through the metadata of the rate limiting rules stored in the metadata of the virtual device.
[0062] In this embodiment of the disclosure, the traffic control method may further include: in response to the completion of virtual device migration, determining whether there is a rate limiting level type corresponding to the virtual device in the virtual device metadata; if there is a rate limiting level type corresponding to the virtual device, performing traffic rate limiting configuration based on the rate limiting level type corresponding to the virtual device to restore the traffic rate limiting rules of the virtual device; if there is no rate limiting level type corresponding to the virtual device, determining the rate limiting level type as single network interface card (NIC) level rate limiting, and performing the rate limiting configuration operation corresponding to single NIC level rate limiting to restore the traffic rate limiting rules of the virtual device.
[0063] Specifically, after the virtual device migration is complete, the electronic device queries the virtual device's metadata to determine if a field for the corresponding rate-limiting level type exists. If the query result shows the presence of a rate-limiting level type field, it indicates that the virtual device was configured with a specific traffic control level before the migration (whether at the system-wide or single-NIC level). The compute management unit directly reads the rate-limiting level type and its corresponding rate-limiting parameters and executes traffic rate-limiting configuration based on the read rate-limiting level type. Specifically, if it is at the system-wide level, the main virtual interface is located and the system-wide bandwidth is set; if it is at the single-NIC level, all virtual interfaces are traversed and the single-NIC bandwidth is set to restore the virtual device's traffic rate-limiting rules. If the query result shows that no rate-limiting level type exists in the virtual device's metadata, the rate-limiting level type is defaulted to single-NIC rate-limiting, and the corresponding single-NIC rate-limiting configuration operation is executed, thereby restoring the virtual device's traffic rate-limiting rules in the default manner. After restoring the virtual machine device's traffic rate-limiting rules, the traffic rate-limiting rules are verified. If the verification passes, the traffic rate-limiting rules take effect. The specific implementation method for verifying traffic rate limiting rules is similar to the existing methods for verifying rate limiting rules (such as using stress testing), and will not be elaborated here.
[0064] In this embodiment, by storing the first rate-limiting level type and the first rate-limiting parameters corresponding to the traffic rate-limiting rule in the virtual device metadata, a rate-limiting rule recovery process is triggered after the virtual device migration is completed. This ensures that the network bandwidth limits of the virtual device are completely consistent before and after the migration, eliminates the impact of migration on traffic control policies, achieves seamless migration of network policies, and greatly improves the automation level of cloud platform operation and maintenance. Furthermore, even if the rate-limiting level type corresponding to the virtual device is not present in the virtual device metadata, a default mechanism can be used to determine the rate-limiting level type as single network card-level rate limiting to restore the traffic rate-limiting rule of the virtual device, ensuring that the virtual device always has a clear rate-limiting level type available.
[0065] In this embodiment of the disclosure, before determining the first virtual interface corresponding to the first rate limiting level type, the flow control method may further include: obtaining the virtual interface identifier corresponding to the first rate limiting level type.
[0066] Specifically, after the electronic device obtains the first rate-limiting level type, if the first rate-limiting level type is at the whole-machine level, the computing management unit first queries the associated data storage to obtain the identifier of the main virtual interface of the cloud server. The main virtual interface is usually the default egress network card specified when the cloud server is created. If the first rate-limiting level type is at the single network card level, and the user specifies specific virtual network card identifier information in the request, the computing management unit directly extracts the virtual interface identifier from the request parameters, thus obtaining the virtual interface identifier.
[0067] Based on the preset mapping relationship between virtual interfaces and virtual devices corresponding to the speed limit level type, the virtual interface identifier corresponding to the first speed limit level type is determined.
[0068] Further, determining the first virtual interface corresponding to the first speed limit level type may specifically include: determining the first virtual interface based on the virtual interface identifier.
[0069] In this embodiment, by pre-obtaining a clear and accurate virtual interface identifier, fuzzy queries and potential ambiguities in subsequent operations are avoided, improving the efficiency and accuracy of rate limiting configuration. Especially in system-wide rate limiting scenarios, accurately locating the main virtual interface through associated data storage provides a reliable guarantee for precise anchoring of system-wide bandwidth limits.
[0070] Figure 3 This is a flowchart of another flow control method provided in an embodiment of this disclosure. For example... Figure 3 As shown, the flow control method may include the following steps: S310. Receive the traffic control request sent by the user, determine the first virtual interface corresponding to the first rate limiting level type in the traffic control request, and execute the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain the traffic rate limiting rule.
[0071] S320. Store the first rate limiting level type and the first rate limiting parameter corresponding to the traffic rate limiting rule into the virtual device metadata.
[0072] S330. In response to the completion of virtual device migration, determine whether the virtual device metadata contains a rate limiting level type corresponding to the virtual device.
[0073] S340. If a rate limiting level type corresponding to the virtual device exists, execute the traffic rate limiting configuration based on the rate limiting level type corresponding to the virtual device to restore the traffic rate limiting rules of the virtual device.
[0074] S350. If there is no corresponding rate limiting level type for the virtual device, the rate limiting level type is set to single network card level rate limiting, and the rate limiting configuration operation corresponding to single network card level rate limiting is executed to restore the traffic rate limiting rules of the virtual device.
[0075] It should be noted that the specific implementation of steps S310-S350 is similar to the implementation of the relevant steps in the above embodiments of this disclosure, and will not be repeated here.
[0076] In this embodiment, by persisting the user-defined rate limiting levels and parameters to metadata storage, the traffic control policy becomes an inherent attribute of the virtual device, completely eliminating its strong binding to the host machine's operating state. Furthermore, after a virtual device completes a hot migration, the system can proactively query metadata and automatically trigger a policy recovery process. If a historical configuration exists, it is accurately restored; otherwise, the single-NIC-level rate limiting with optimal compatibility is enabled by default. This not only ensures absolute consistency and seamless inheritance of network rate limiting policies before and after migration, eliminating interference from migration operations on business traffic control, but also guarantees that all virtual devices possess basic network management capabilities after migration through a default degradation fallback policy. This significantly improves the cloud platform's automated operation and maintenance level and system robustness in fault recovery and resource scheduling scenarios.
[0077] In this embodiment of the disclosure, the flow control method can be applied to a flow control system. The flow control system may include: Computation Management Unit: Runs on the host machine and is responsible for judging rate limiting logic, orchestrating processes, and coordinating calls between units.
[0078] Metadata storage unit: Persistent storage of the cloud server's rate limit tier type and bandwidth parameters for querying and migration recovery.
[0079] Network service unit: Provides the actual execution capability of underlying network bandwidth management, including setting and clearing rate limiting rules at the system level and single network card level.
[0080] Associated data storage unit: Stores the mapping relationship between virtual interfaces and virtual networks, used to query the main virtual interface and the list of all virtual interfaces.
[0081] The following section will describe in detail the specific processing procedure of the flow control system using examples.
[0082] Users initiate a traffic control setting request to the computing management unit via API. The request includes the cloud server identifier, the desired rate limiting level type, and the corresponding bandwidth parameters, i.e., the rate limiting parameters.
[0083] Upon receiving a request, the computing management unit first performs a capability check—determining whether the underlying network service supports system-wide rate limiting. If the user requests system-wide rate limiting but the network service does not support it, an automatic degradation mechanism is triggered, downgrading the rate limiting level from system-wide to single network interface card (NIC) level. Subsequently, traffic splitting is performed based on the final determined level. If it is a system-wide bandwidth limit: The computing management unit queries the associated data storage unit for the main virtual interface identifier of the cloud server. After obtaining the returned main interface identifier, it calls the network service unit to set the system-wide bandwidth limit, and the network service unit returns the setting result.
[0084] For single-NIC-level rate limiting: The computing management unit queries the associated data storage unit for all virtual interfaces of the cloud server. After obtaining the returned interface list, it iterates through the list and calls the network service unit to set the single-NIC rate limit for each virtual interface. Each interface returns the setting result.
[0085] After all speed limit rules are set, the calculation management unit writes the currently effective speed limit level type and speed limit parameters to the metadata storage unit for persistent storage.
[0086] When a user needs to switch rate limit levels, the user sends a rate limit level switch request to the computing management unit via API, carrying the cloud server identifier and the new target rate limit level type in the request.
[0087] The computing management unit first reads the current rate-limiting tier type of the cloud server from the metadata storage unit. After obtaining the returned current tier information, it performs the corresponding switching operation based on the target tier type. If switching to system-wide bandwidth limiting: Query the associated data storage unit for the main virtual interface, obtain the main interface identifier, and then call the network service unit to set the system-wide bandwidth limit. At this time, the original single-NIC-level bandwidth limiting rules are automatically invalidated by the network service unit.
[0088] To switch to single-NIC-level rate limiting: Query all virtual interfaces from the associated data storage unit, obtain the interface list, and then iterate through each virtual interface to call the network service unit to set the single-NIC rate limit. If a system-wide rate limiting rule previously existed, the network service unit's interface must be called to clear that rule first.
[0089] After the switch is completed, the computing management unit updates the hierarchy type in the metadata storage unit to the new hierarchy.
[0090] When a cloud server undergoes a hot migration, after the cloud server completes the hot migration and starts up on the target host, the computing management unit triggers the post-migration recovery process.
[0091] The computing management unit first reads the rate limiting tier type and rate limiting parameters of the cloud server from the metadata storage unit. After obtaining the returned rate limiting configuration information, it performs the corresponding recovery operation according to the tier type: If it is a system-wide speed limit: query the main virtual interface from the associated data storage unit, obtain the main interface identifier, call the network service unit to set the system-wide bandwidth limit, and restore the system-wide speed limit rules before the migration.
[0092] If it is a single network interface card (NIC) level rate limit: query all virtual interfaces from the associated data storage unit, obtain the interface list, and then call the network service unit to set the single NIC rate limit for each virtual interface by looping through it, thus restoring the single NIC rate limit rules before the migration.
[0093] If the rate limiting level of the cloud server is not recorded in the metadata storage unit, the recovery operation will be performed by default at the single network card level to ensure that the virtual machine has at least basic network bandwidth management.
[0094] Figure 4 This is a schematic diagram of the structure of a flow control device provided in an embodiment of this disclosure.
[0095] In this embodiment, the flow control device can be located within an electronic device and is understood as a functional module within the aforementioned electronic device. Specifically, the electronic device can be a server or a terminal, wherein the terminal specifically includes mobile phones, computers, or tablet computers, etc., without limitation.
[0096] like Figure 4 As shown, the flow control device 400 may include a request receiving module 410, a rate limiting configuration module 420, and a flow control module 430.
[0097] The request receiving module 410 can be used to receive a flow control request sent by a user. The flow control request includes a first rate limiting level type and a first rate limiting parameter. The rate limiting configuration module 420 can be used to determine the first virtual interface corresponding to the first rate limiting level type, and perform traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain traffic rate limiting rules; The flow control module 430 can be used for flow control based on flow rate limiting rules.
[0098] In this embodiment, by receiving real-time traffic control requests from users and calling the corresponding virtual interface to execute rate limiting configurations based on the rate limiting level type specified in the request, traffic rate limiting rules can be dynamically generated and applied during cloud server operation. This completely overcomes the limitation of static configuration files being fixed at creation time and unable to be changed during runtime, achieving dynamic adjustability and immediate effectiveness of traffic rate limiting rules. Simultaneously, it supports fine-grained and differentiated bandwidth management for different rate limiting levels. Users can flexibly configure differentiated traffic rate limiting rules according to different business needs, significantly improving the flexibility and adaptability of network bandwidth management, effectively responding to business traffic fluctuations, and better meeting users' diverse real-time business needs.
[0099] In some embodiments of this disclosure, the speed limiting level type includes whole-machine speed limiting.
[0100] The flow control device 400 may include a hierarchical degradation processing module.
[0101] The tiered degradation processing module can be used to determine whether the network service supports machine-level rate limiting when the first rate limiting tier type is machine-level rate limiting after receiving a traffic control request from a user. If it is determined that whole-machine-level speed limiting is not supported, the first speed limiting level type is downgraded to obtain the second speed limiting level type after downgrading. Traffic rate limiting configuration is executed based on the second rate limiting level type.
[0102] In some embodiments of this disclosure, the rate limiting level type also includes single network card level rate limiting.
[0103] The tiered degradation processing module can be specifically used to change the first tier of speed limiting from machine-level speed limiting to single network card-level speed limiting, thus obtaining the second tier of speed limiting.
[0104] In some embodiments of this disclosure, the hierarchical degradation processing module can also be specifically used to determine the second speed limiting parameter corresponding to the second speed limiting level type based on the first speed limiting parameter when the second speed limiting level type is a single network card level speed limiting. Iterate through the second virtual interfaces corresponding to each network card, and execute traffic rate limiting configuration based on the second virtual interface and the second rate limiting parameters.
[0105] In some embodiments of this disclosure, the flow control device 400 may further include a hierarchy change module.
[0106] The hierarchical change module can be used to receive the user's hierarchical change request after executing the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain the traffic rate limiting rules, and determine the target rate limiting hierarchical type corresponding to the hierarchical change request. Call the first virtual interface to clear the traffic rate limiting rules; After the traffic rate limiting rules are cleared, the target virtual interface corresponding to the target rate limiting level type is called to execute the traffic rate limiting configuration corresponding to the rate limiting level change request, and the target traffic rate limiting rules are obtained.
[0107] In some embodiments of this disclosure, the flow control device 400 may further include a metadata storage module.
[0108] The metadata storage module can be used to store the first rate limiting level type and the first rate limiting parameter corresponding to the traffic rate limiting rule into the virtual device metadata after executing the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter.
[0109] In some embodiments of this disclosure, the flow control device 400 may further include a migration management module.
[0110] The migration management module can be used to determine whether the corresponding rate-limiting level type of the virtual device exists in the virtual device metadata in response to the completion of virtual device migration; If a rate limiting level type exists for the virtual device, the traffic rate limiting configuration is executed based on the rate limiting level type for the virtual device to restore the traffic rate limiting rules for the virtual device.
[0111] If there is no corresponding rate limiting level for the virtual device, the rate limiting level will be set to single network interface card (NIC) level rate limiting, and the corresponding rate limiting configuration operation will be executed to restore the traffic rate limiting rules of the virtual device.
[0112] In some embodiments of this disclosure, the flow control device 400 may further include an interface identifier determination module.
[0113] The interface identifier determination module can be used to obtain the virtual interface identifier corresponding to the first speed limit level type before determining the first virtual interface corresponding to the first speed limit level type.
[0114] The speed limit configuration module 420 can be specifically used to determine the first virtual interface based on the virtual interface identifier.
[0115] It should be noted that, Figure 4The flow control device 400 shown can execute the various steps in the above method embodiments and achieve the various processes and effects in the above method embodiments, which will not be elaborated here.
[0116] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.
[0117] In this embodiment of the disclosure, Figure 5 The electronic devices shown can be servers or terminals, and terminals specifically include mobile phones, computers, or tablets, etc., without limitation.
[0118] like Figure 5 As shown, the electronic device may include a processor 510 and a memory 520 storing computer program instructions.
[0119] Specifically, the processor 510 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this disclosure.
[0120] Memory 520 may include a large-capacity storage device for information or instructions. For example, and not limitingly, memory 520 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 520 may include removable or non-removable (or fixed) media. Where appropriate, memory 520 may be internal or external to the integrated gateway device. In a particular embodiment, memory 520 is a non-volatile solid-state memory. In a particular embodiment, memory 520 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0121] The processor 510 performs the steps of the flow control method provided in the embodiments of this disclosure by reading and executing computer program instructions stored in the memory 520.
[0122] In one example, the electronic device may also include a transceiver 530 and a bus 540. Wherein, as... Figure 5 As shown, the processor 510, memory 520 and transceiver 530 are connected via bus 540 and communicate with each other.
[0123] Bus 540 may include hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 540 may include one or more buses.
[0124] This disclosure also provides a computer-readable storage medium that can store a computer program that, when executed by a processor, causes the processor to implement the flow control method provided in this disclosure.
[0125] The aforementioned storage medium may, for example, include a memory 520 containing computer program instructions, which can be executed by a processor 510 of an electronic device to perform the flow control method provided in the embodiments of this disclosure. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0126] This disclosure also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, they implement the flow control method provided in this disclosure and can achieve the various processes and effects in the above embodiments of this disclosure, which will not be elaborated here.
[0127] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A flow control method, characterized in that, The method includes: Receive a traffic control request sent by a user, the traffic control request including a first rate limiting level type and a first rate limiting parameter; Determine the first virtual interface corresponding to the first rate limiting level type, and perform traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain the traffic rate limiting rules; Traffic control is performed based on the aforementioned traffic rate limiting rules.
2. The method according to claim 1, characterized in that, Speed limiting levels include system-wide speed limiting; After receiving the flow control request sent by the user, the method further includes: If the first rate limiting level is machine-level rate limiting, determine whether the network service supports machine-level rate limiting; If it is determined that whole-machine-level speed limiting is not supported, the first speed limiting level type is downgraded to obtain the second speed limiting level type after downgrading. Traffic rate limiting configuration is performed based on the second rate limiting level type.
3. The method according to claim 2, characterized in that, The rate limiting level types also include single network card level rate limiting; The process of downgrading the first speed limit level type to obtain a downgraded second speed limit level type includes: The first speed limiting level type is changed from the whole machine level speed limiting to the single network card level speed limiting to obtain the second speed limiting level type.
4. The method according to claim 2 or 3, characterized in that, The process of configuring traffic rate limiting based on the second rate limiting level type includes: When the second speed limiting level is a single network card level speed limiting, the second speed limiting parameter corresponding to the second speed limiting level is determined based on the first speed limiting parameter; Iterate through the second virtual interfaces corresponding to each network card, and execute the traffic rate limiting configuration based on the second virtual interface and the second rate limiting parameter.
5. The method according to claim 1, characterized in that, After executing the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain the traffic rate limiting rules, the method further includes: Receive a user's speed limit level change request and determine the target speed limit level type corresponding to the speed limit level change request; Call the first virtual interface to clear the traffic rate limiting rule; After the traffic rate limiting rule is cleared, the target virtual interface corresponding to the target rate limiting level type is called to execute the traffic rate limiting configuration corresponding to the rate limiting level change request, and the target traffic rate limiting rule is obtained.
6. The method according to claim 1, characterized in that, After executing the traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameter to obtain the traffic rate limiting rules, the method further includes: The first rate limiting level type and the first rate limiting parameter corresponding to the traffic rate limiting rule are stored in the virtual device metadata.
7. The method according to claim 6, characterized in that, The method further includes: In response to the completion of virtual device migration, determine whether the rate limiting level type corresponding to the virtual device exists in the virtual device metadata; If a rate limiting level type corresponding to the virtual device exists, traffic rate limiting configuration is executed based on the rate limiting level type corresponding to the virtual device to restore the traffic rate limiting rules of the virtual device; If no rate limiting level type exists for the virtual device, the rate limiting level type is determined to be single network card level rate limiting, and the rate limiting configuration operation corresponding to single network card level rate limiting is executed to restore the traffic rate limiting rules of the virtual device.
8. The method according to claim 1, characterized in that, Before determining the first virtual interface corresponding to the first speed limit level type, the method further includes: Obtain the virtual interface identifier corresponding to the first speed limit level type; The step of determining the first virtual interface corresponding to the first speed limit level type includes: The first virtual interface is determined based on the virtual interface identifier.
9. A flow control device, characterized in that, include: A request receiving module is used to receive a traffic control request sent by a user, wherein the traffic control request includes a first rate limiting level type and a first rate limiting parameter; The rate limiting configuration module is used to determine the first virtual interface corresponding to the first rate limiting level type, and to perform traffic rate limiting configuration based on the first virtual interface and the first rate limiting parameters to obtain traffic rate limiting rules. The flow control module is used to perform flow control based on the flow rate limiting rules.
10. An electronic device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the flow control method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the flow control method according to any one of claims 1-8.