Traffic adjustment method and device, computer device, storage medium and program product
By acquiring CPU load and QPS data from gateways and actual tenants, we can determine and adjust weights, accurately adjust tenant traffic, solve the problem of high CPU load for tenants in cloud computing scenarios, and ensure service quality.
Patent Information
- Application Number
- CN202411693175.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-11-25
AI Technical Summary
In cloud computing scenarios, when multiple tenants share application layer gateway services, sudden or complex requests from tenant businesses can cause high CPU load on network elements, affecting the QoS service quality of other tenants. Existing methods cannot accurately limit the overhead of sudden tenant requests.
By acquiring CPU load and QPS data from the gateway and actual tenants, we can determine the adjustment weights and precisely adjust the traffic of each tenant to control CPU load.
It enables precise adjustment of traffic for each tenant, reduces gateway CPU load, and ensures QoS service quality for all tenants.
Smart Images

Figure CN119484411B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of network services, and in particular, to a traffic adjustment method and device, a computer device, a storage medium, and a program product. BACKGROUND
[0002] For an application layer gateway deployed between a client and a service server, various application protocol requests such as HTTP and HTTPS can be routed, load balanced, secured, compressed, cached, and the like, and thus, the application layer gateway is widely used in seven-layer load balancing, API gateway, and CDN (Content Delivery Network) scenarios.
[0003] In a cloud computing scenario, multiple tenants share an application layer gateway service, and compete for limited CPU time of the gateway. If a tenant has a business burst or has complex encryption and compression requests, the CPU of the network element will be in high load, and the QoS (Quality of Service) of other tenants will be affected. Moreover, due to the natural complexity of application layer traffic, there are both IO (Input / Output) intensive services and computing intensive services, and it is impossible to accurately limit the cost of a burst tenant by limiting a fixed QPS (Queries Per Second) and bandwidth throttling. SUMMARY
[0004] Therefore, it is necessary to provide a traffic adjustment method, device, computer device, storage medium, and program product to accurately adjust the traffic of each tenant.
[0005] In a first aspect, the present application provides a traffic adjustment method, which comprises:
[0006] obtaining a gateway actual central processing unit (CPU) load corresponding to a gateway in a target period, and individual actual CPU loads and individual actual queries per second (QPS) corresponding to each real tenant; wherein the gateway is used to forward traffic data of each real tenant;
[0007] In a case where the gateway actual CPU load exceeds a load warning value, determining an adjustment weight corresponding to each real tenant according to an individual standard CPU load and the individual actual CPU loads of each real tenant;
[0008] adjusting the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0009] In one of the embodiments, each real tenant corresponds to at least one virtual tenant, the individual actual CPU load of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual CPU load of each virtual tenant corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual QPS of each virtual tenant corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; and the individual standard CPU load is determined according to the gateway standard CPU load and the number of real tenants.
[0010] In one of the embodiments, the adjustment weight corresponding to each real tenant is determined according to the individual standard CPU load and the individual actual CPU load of each real tenant, including:
[0011] The over-standard tenants are selected from the virtual tenants according to the size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant; the adjustment weight corresponding to each over-standard tenant is determined based on the gateway actual CPU load, the gateway standard CPU load and the individual actual CPU load of each over-standard tenant; and the adjustment weight of the real tenant corresponding to each over-standard tenant is determined according to the adjustment weight corresponding to each over-standard tenant.
[0012] In one of the embodiments, the over-standard tenants are selected from the virtual tenants according to the size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant, including:
[0013] The virtual tenant with the individual actual CPU load greater than the individual standard CPU load in each virtual tenant is selected as the over-standard tenant.
[0014] In one of the embodiments, the adjustment weight corresponding to each over-standard tenant is determined based on the gateway actual CPU load, the gateway standard CPU load and the individual actual CPU load of each over-standard tenant, including:
[0015] The sum of the individual actual CPU load of each over-standard tenant is determined as the over-standard CPU total; and the adjustment weight corresponding to each over-standard tenant is determined based on the gateway actual CPU load, the gateway standard CPU load and the over-standard CPU total.
[0016] In one of the embodiments, the traffic of each real tenant is adjusted according to the individual actual QPS and the adjustment weight corresponding to each real tenant, including:
[0017] The product of the individual actual QPS and the adjustment weight corresponding to each real tenant is determined as the adjustment QPS of the real tenant; and the traffic of the corresponding real tenant is adjusted based on the adjustment QPS.
[0018] In one of the embodiments, the gateway actual central processing unit (CPU) load corresponding to the gateway in a target period is acquired, and individual actual CPU loads and individual actual query rates per second (QPS) corresponding to each real tenant are acquired, including:
[0019] The individual actual QPS corresponding to each real tenant is acquired; the user state beat number and the kernel state beat number consumed by the whole process in the target period and the user state beat number and the kernel state beat number consumed by each real tenant are acquired; the gateway actual CPU load corresponding to the gateway is determined according to the target period, the beat rate, and the user state beat number and the kernel state beat number consumed by the whole process; and the individual actual CPU load corresponding to each real tenant is determined according to the target period, the beat rate, and the user state beat number and the kernel state beat number consumed by each real tenant.
[0020] In a second aspect, the present application further provides a traffic adjustment device, which comprises:
[0021] An acquisition module is configured to acquire a gateway actual central processing unit (CPU) load corresponding to a gateway in a target period, and individual actual CPU loads and individual actual query rates per second (QPS) corresponding to each real tenant; wherein the gateway is configured to forward traffic data of each real tenant.
[0022] A weight determination module is configured to determine an adjustment weight corresponding to each real tenant according to an individual standard CPU load and the individual actual CPU load of each real tenant in a case where the gateway actual CPU load exceeds a load warning value.
[0023] An adjustment module is configured to adjust the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0024] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0025] The gateway actual central processing unit (CPU) load corresponding to the gateway in a target period is acquired, and individual actual CPU loads and individual actual query rates per second (QPS) corresponding to each real tenant are acquired; wherein the gateway is configured to forward traffic data of each real tenant.
[0026] In a case where the gateway actual CPU load exceeds a load warning value, an adjustment weight corresponding to each real tenant is determined according to an individual standard CPU load and the individual actual CPU load of each real tenant.
[0027] The traffic of each real tenant is adjusted according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0028] In a fourth aspect, the present application also provides a computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements the following steps:
[0029] obtaining gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant; wherein the gateway is used to forward traffic data of each real tenant;
[0030] in a case where the gateway actual CPU load exceeds a load warning value, determining an adjustment weight corresponding to each real tenant according to the individual standard CPU load and the individual actual CPU load of each real tenant;
[0031] adjusting the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0032] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0033] obtaining gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant; wherein the gateway is used to forward traffic data of each real tenant;
[0034] in a case where the gateway actual CPU load exceeds a load warning value, determining an adjustment weight corresponding to each real tenant according to the individual standard CPU load and the individual actual CPU load of each real tenant;
[0035] adjusting the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0036] The traffic adjustment method, device, computer device, storage medium and program product provide data basis for judging whether the CPU is overloaded by obtaining the gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and the individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant. Further, in the case that the gateway actual CPU load exceeds a load warning value, the adjustment weight corresponding to each real tenant is determined according to the individual standard CPU load and the individual actual CPU load of each real tenant, which provides a train of thought for traffic control. Finally, the traffic of each real tenant can be adjusted according to the individual actual QPS and the adjustment weight corresponding to each real tenant. The scheme provides a basis for realizing fine traffic adjustment by respectively obtaining the gateway actual CPU load corresponding to the gateway and the individual actual CPU load corresponding to each real tenant. Moreover, the adjustment weight is introduced, which provides a way for traffic regulation according to the actual CPU condition of each real tenant, and finally realizes accurate traffic adjustment of each real tenant. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0038] Figure 1 An application environment diagram of a traffic adjustment method provided in an embodiment of the present application;
[0039] Figure 2 A flowchart of traffic adjustment provided in an embodiment of the present application;
[0040] Figure 3 A gateway service structure diagram provided in an embodiment of the present application;
[0041] Figure 4 A flowchart of determining an adjustment weight provided in an embodiment of the present application;
[0042] Figure 5 A flowchart of adjusting the traffic of each real tenant provided in an embodiment of the present application;
[0043] Figure 6 A flowchart of another traffic adjustment method provided in an embodiment of the present application;
[0044] Figure 7 A structure block diagram of a traffic adjustment device provided in an embodiment of the present application;
[0045] Figure 8 A structural block diagram of another flow adjustment device provided in an embodiment of the present application;
[0046] Figure 9 An internal structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0048] The flow adjustment method provided in the embodiments of the present application can be applied to an application environment as shown in Figure 1 . The terminal 102 communicates with the server 104 through a network. The data storage system can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on a cloud or other network server. The server 104 can obtain the gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and the individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant, and perform calculation and analysis thereon, and adjust the flow of each real tenant according to the analysis result. The gateway actual central processing unit (CPU) load corresponding to the gateway in the target period, the individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant, and the adjusted data can be presented through the terminal 102. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle-mounted device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0049] In an exemplary embodiment, as shown in Figure 2 , a flow adjustment method is provided. Taking the server 104 in Figure 1 as an example, the method can include the following steps:
[0050] S201, obtaining the gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and the individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant.
[0051] The gateway actual central processing unit (CPU) load refers to the load of the central processing unit (CPU) on the gateway device when processing network traffic and data forwarding tasks. The individual actual CPU load refers to the actual occupancy rate of the CPU resources allocated to the real tenant when the real tenant is running, which can include the CPU time consumed by the applications, processes and threads of the real tenant. The individual actual query rate per second (QPS) refers to the actual number of query requests per second processed by the real tenant in the target period. The CPU load refers to the number of running and waiting processes, which can reflect the busy degree of the CPU when processing tasks. Generally, the higher the load, the more tasks the CPU is processing, which can cause performance degradation.
[0052] It should be noted that the gateway is used to forward the traffic data of each real tenant, and works in the application layer, that is, an application layer gateway (ALG), which is a device or system used to forward application layer data between different networks. As shown in Figure 3 The gateway in the embodiment of the present application is located between the clients and servers of a plurality of real tenants, receives and processes client requests, and forwards the requests to the servers of the corresponding real tenants; receives and processes server responses, and forwards the responses to the clients. The application layer gateway service specifically carries a network element, which can be a single physical machine or a virtual machine, or a machine composed of multiple devices.
[0053] For example, the CPU load of the gateway and the CPU load and QPS of each real user in the target period can be monitored in real time by a performance monitoring tool, and the corresponding gateway actual central processing unit (CPU) load of the gateway and the individual actual CPU load and individual actual query rate per second (QPS) of each real tenant in the target period can be determined according to the monitoring data. The data related to the CPU load of the gateway and the CPU load and QPS of each real user in the target period can also be obtained by commands or instructions, and the corresponding gateway actual central processing unit (CPU) load of the gateway and the individual actual CPU load and individual actual query rate per second (QPS) of each real tenant in the target period can be finally determined.
[0054] S202, in the case that the gateway actual CPU load exceeds the load warning value, the adjustment weight corresponding to each real tenant is determined according to the individual standard CPU load and the individual actual CPU load of each real tenant.
[0055] The load warning value can represent that the gateway is in an overload state, and the load warning value can be set in advance to ensure the stability and security of the gateway; the individual standard CPU load can represent the CPU load level expected by the tenant under normal circumstances, and can be used to evaluate the CPU load of the tenant; and the adjustment weight can be used to adjust the traffic limit of each tenant.
[0056] Optionally, the setting of the load warning value can be based on the actual performance and business demand of the system or device, to ensure that the overload condition can be found in time, and to avoid frequent traffic adjustment due to setting too low, such as analyzing the historical load data of the system or device in combination with the performance fluctuation and business demand change of the system or device, and determining a reasonable load warning value.
[0057] For example, when the actual CPU load of the gateway exceeds the load warning value, it indicates that the gateway is in an overload state, and the tenants responsible for the gateway need to be adjusted in traffic (such as limiting the traffic of part of the tenants) to reduce the CPU load of the gateway; further, the individual standard CPU load can be compared with the individual actual CPU load of each real tenant, and the tenants that need to be adjusted in traffic can be determined according to the comparison result; further, the adjustment range, i.e., the adjustment weight, can be determined based on the gap between the individual actual CPU load and the individual standard CPU load of the tenant that needs to be adjusted in traffic.
[0058] For example, the individual standard CPU load and the individual actual CPU load of each real tenant can be input into a weight determination model when the actual CPU load of the gateway exceeds the load warning value, the weight determination model can analyze them, and the adjustment weight corresponding to each real tenant can be determined; wherein the weight determination model can be a model trained based on historical CPU load, and the determination process of the weight determination model is not limited in the present application.
[0059] S203, adjusting the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0060] For example, the individual actual QPS and the adjustment weight corresponding to each real tenant can be input into a traffic adjustment model, the traffic adjustment model can analyze them, and the adjusted QPS of each real tenant can be determined according to the analysis result; further, the traffic limiting strategy such as delay processing and returning 429 error code (i.e., too many request error code) can be adopted for each real tenant based on the adjusted QPS of each real tenant.
[0061] It should be noted that after adjusting the traffic of each real tenant, if the gateway actual CPU load corresponding to the gateway reaches a gateway standard CPU load (i.e., returns to the normal state), the automatic recovery mechanism can be used to automatically release the traffic limit of each real tenant; for example, the automatic recovery mechanism can release the traffic limit of each real tenant after 10 minutes when the gateway is in the normal state, i.e., not in an overload state (e.g., without performing the delay processing strategy).
[0062] The above traffic adjustment method provides a data basis for judging whether the CPU is overloaded by obtaining the gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and the individual actual CPU load and individual actual query rate per second (QPS) corresponding to each real tenant. Further, in the case where the gateway actual CPU load exceeds the load warning value, the adjustment weight corresponding to each real tenant is determined according to the individual standard CPU load and the individual actual CPU load of each real tenant, which provides a train of thought for traffic control. Finally, the traffic of each real tenant can be adjusted according to the individual actual QPS and the adjustment weight corresponding to each real tenant. The scheme provides a basis for realizing fine traffic adjustment by respectively obtaining the gateway actual CPU load corresponding to the gateway and the individual actual CPU load corresponding to each real tenant. Moreover, by introducing the adjustment weight, a way is provided for adjusting the traffic according to the actual CPU condition of each real tenant, and finally the traffic of each real tenant is accurately adjusted.
[0063] On the basis of the above embodiment, the embodiment of the present application explains and describes the above embodiment S202 in detail. Specifically, the embodiment of the present application involves a process of determining the adjustment weight corresponding to each real tenant, as shown in Figure 4 The process specifically includes the following steps:
[0064] S401, selecting an over-standard tenant from each virtual tenant according to the size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant.
[0065] The over-standard tenant represents a tenant whose CPU load exceeds the individual standard CPU load, i.e., a tenant that needs to be controlled and adjusted in traffic.
[0066] Optionally, the individual standard CPU load can be determined by the gateway standard CPU load and the number of virtual tenants, such as individual standard CPU load = gateway standard CPU load ÷ number of virtual tenants.
[0067] It should be noted that in the actual multi-tenant gateway scenario, different tenants can have different tenant quotas, such as three types of basic, performance, and high-level, and the three quotas allow the tenants to consume CPU load in proportions of 1:2:4. Therefore, there can be an unfair resource phenomenon between the real tenants in the actual scenario. Further, in the process of flow control for each real user, if the same flow adjustment strategy is used, the impact on the real users with high quotas and the real users with low quotas can be different. In order to reduce the CPU load quota difference between each real user, the concept of virtual tenant is introduced, that is, each real tenant corresponds to at least one virtual tenant, the individual actual CPU load of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual CPU load of each virtual tenant corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual QPS of each virtual tenant corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; the individual standard CPU load is determined according to the gateway standard CPU load and the number of real tenants.
[0068] For example, there are three real tenants (A, B, and C), real tenant A is basic, real tenant B is performance, and real tenant C is high-level, and the three types of basic, performance, and high-level allow the tenants to consume CPU load in proportions of 1:2:4, and then there can be 7 virtual tenants in total, real tenant A corresponds to 1 virtual tenant, real tenant B corresponds to 2 virtual tenants, and real tenant C corresponds to 4 virtual tenants; if the CPU load of real tenant A (basic) is 8% and the QPS is 100 in a statistical period, then the consumption CPU load of the 1 virtual tenant corresponding to real tenant A is 8% and the QPS is 100; the CPU load of real tenant B (performance) is 12% and the QPS is 170 in a statistical period, then in the 2 virtual tenants corresponding to real tenant B, each virtual tenant consumes CPU load of 12% ÷ 2, i.e. 6%, and QPS of 170 ÷ 2, i.e. 85; the CPU load of real tenant C (high-level) is 80% and the QPS is 1000 in a statistical period, then in the 4 virtual tenants corresponding to real tenant C, each virtual tenant consumes CPU load of 80% ÷ 4, i.e. 20%, and QPS of 1000 ÷ 4, i.e. 250.
[0069] Optionally, the virtual tenants with individual actual CPU load greater than the individual standard CPU load in each virtual tenant are regarded as over-standard tenants.
[0070] As shown in the above example, if the individual standard CPU load is 15%, the consumed CPU load of the 1 virtual tenant corresponding to real tenant A is 8%, the consumed CPU loads of the 2 virtual tenants corresponding to real tenant B are 6% and 6% respectively, and the consumed CPU loads of the 4 virtual tenants corresponding to real tenant C are 20% respectively, it can be seen that the consumed CPU load (20%) of the 4 virtual tenants corresponding to real tenant C is greater than the individual standard CPU load (15%), and thus the 4 virtual tenants corresponding to real tenant C are determined as the over-standard tenants.
[0071] S402, determining the adjustment weight corresponding to each over-standard tenant based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the individual actual CPU load of each over-standard tenant.
[0072] It should be noted that for a tenant in each virtual tenant whose individual actual CPU load is not greater than the individual standard CPU load, no flow adjustment is performed on the virtual tenant, i.e., the adjustment weight can be 1.
[0073] In an implementation manner, the sum of the individual actual CPU loads of the over-standard tenants is taken as the over-standard CPU total; and the adjustment weight corresponding to each over-standard tenant is determined based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the over-standard CPU total.
[0074] The over-standard CPU total can represent the sum of the CPU loads of all over-standard tenants.
[0075] For example, if the number of over-standard tenants is n, the individual actual CPU load of over-standard tenant i is , and the over-standard CPU total is , which can be represented as ; further, the candidate weight corresponding to each over-standard tenant can be determined based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the over-standard CPU total , such as ; and then, the maximum value between the candidate weight and 0 is determined as the adjustment weight corresponding to each over-standard tenant.
[0076] In another implementation manner, the actual CPU load of the gateway, the standard CPU load of the gateway, and the individual actual CPU load of each over-standard tenant can be input into an adjustment weight model, analyzed by the adjustment weight model, and finally the adjustment weight corresponding to each over-standard tenant is determined.
[0077] S403, determining the adjustment weight of the real tenant corresponding to each over-standard tenant according to the adjustment weight corresponding to each over-standard tenant.
[0078] For example, for each real tenant, if there is an over-standard tenant in the virtual tenant corresponding to the real tenant, the adjustment weight corresponding to the over-standard tenant can be directly determined as the adjustment weight of the real tenant.
[0079] In the embodiment of the present application, by introducing a virtual tenant, a solution is provided for improving the unfairness of traffic adjustment among real tenants caused by resource differences in actual scenarios.
[0080] On the basis of the above-mentioned embodiments, the embodiment of the present application explains and describes the above-mentioned embodiment S203 in detail. Specifically, the process of adjusting the traffic of each real tenant in the embodiment of the present application includes the following steps, as shown in the following table: Figure 5
[0081] S501, for each real tenant, the product of the individual actual QPS corresponding to the real tenant and the adjustment weight is determined as the adjustment QPS of the real tenant.
[0082] The adjustment QPS can represent the target QPS of the real tenant, that is, the QPS to be reached after traffic adjustment.
[0083] S502, based on the adjustment QPS of each real tenant, the traffic of the corresponding real tenant is adjusted.
[0084] For example, based on the adjustment QPS corresponding to each real tenant, the traffic of each real tenant can be adjusted by using traffic limiting strategies such as delay processing and returning a 429 error code (i.e. too many request error code), so as to reach the adjustment QPS corresponding to each real tenant.
[0085] In the embodiment of the present application, by adjusting the traffic of each real tenant based on the individual actual QPS and the adjustment weight corresponding to the real tenant, a data basis is laid for accurately achieving the effect of traffic adjustment.
[0086] On the basis of the above-mentioned embodiments, the embodiment of the present application explains and describes the above-mentioned embodiment S201 in detail. Specifically, the process of obtaining the CPU load and QPS in the embodiment of the present application includes the following steps:
[0087] obtaining the individual actual QPS corresponding to each real tenant; obtaining the number of user mode ticks and the number of kernel mode ticks consumed by the whole process in the target period, and the number of user mode ticks and the number of kernel mode ticks consumed by each real tenant; determining the actual gateway CPU load corresponding to the gateway according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by the whole process; determining the individual actual CPU load corresponding to each real tenant according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by each real tenant.
[0088] For example, during the time period between time t and time t+T, the actual QPS of each individual tenant can be directly obtained through commands or monitoring tools; furthermore, for the gateway as a whole, the total number of user-space and kernel-space ticks consumed by the process at time t can be obtained through the Linuxtimes system call. t And the total number of user-space and kernel-space ticks consumed by the process at time t+T. t+T Furthermore, we can obtain the total number of user-space and kernel-space ticks consumed by the process within the target time period T: Δtick = tick t+T -tick t On Linux systems, the tick rate (Hz) can be obtained through the `sysconf(_SC_CLK_TCK)` system call. Furthermore, the overall CPU load (i.e., the actual CPU load of the gateway corresponding to the gateway) can be determined based on the total number of user-space and kernel-space ticks (Δtick) consumed by the process within the target time period T and the tick rate (Hz). For example, the actual CPU load of the gateway = Δtick ÷ (T × Hz). For each real tenant, within the target time period T, at the time t when the real user processes the request, the tick number (tick) is obtained through the `times` system. t At time t+Δt, when the real user stops processing requests, the tick count is retrieved again through the times system. t+Δt tick t+Δt -tick t This gives the consumption of the real user in processing requests within time Δt. By summing the consumption of all requests by the real user within the target time period T, the total number of ticks consumed by the real user within the target time period T can be obtained. Furthermore, based on the total number of ticks consumed by each real user within the target time period T and the tick rate Hz, the individual actual CPU load corresponding to each tenant can be determined, such as individual actual CPU load = tick ÷ (T × Hz).
[0089] Optionally, the gateway status can be statistically analyzed every target time period T (e.g., 10 seconds), and traffic adjustments can be made if anomalies are detected. It should be noted that the shorter the target time period, the faster the traffic adjustments take effect, but the resulting inspection overhead and glitches will be greater.
[0090] It should be noted that the gateway can perform decryption, authentication, security scanning, complex routing lookup, transcoding, caching, compression and various operations; and then, when receiving a new connection and request of a real tenant, the identification code (such as id) of the real tenant can be parsed, for example, the real tenant information table can be queried according to the TCP connection information of the request, and the identification of the real tenant can be obtained; the gateway can forward the processed client request to a suitable real tenant server based on a load balancing strategy.
[0091] In the embodiment of the application, by obtaining the user state beat number and the kernel state beat number, a data basis is provided for accurately determining the actual CPU load of the gateway and the individual actual CPU load, and finally a foundation is laid for accurately controlling the traffic.
[0092] On the basis of the above embodiment, the present embodiment provides an optional example of a traffic adjustment method. As shown in Figure 6 the specific implementation process is as follows:
[0093] S601, obtaining the individual actual QPS corresponding to each real tenant.
[0094] It should be noted that each real tenant corresponds to at least one virtual tenant, the individual actual CPU load of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual CPU loads of each virtual tenant corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual QPS of each virtual tenant corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant.
[0095] S602, obtaining the user state beat number and the kernel state beat number consumed by the whole process and the user state beat number and the kernel state beat number consumed by each real tenant in a target period.
[0096] S603, determining the gateway actual CPU load corresponding to the gateway according to the target period, the beat rate, and the user state beat number and the kernel state beat number consumed by the whole process.
[0097] The gateway is used to forward the traffic data of each real tenant.
[0098] S604, determining the individual actual CPU load corresponding to each real tenant according to the target period, the beat rate, and the user state beat number and the kernel state beat number consumed by each real tenant.
[0099] S605, in the case that the gateway actual CPU load exceeds the load warning value, selecting an over-standard tenant from each virtual tenant according to the size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant.
[0100] wherein the individual standard CPU load is determined according to the gateway standard CPU load and the real tenant quantity.
[0101] Optionally, the virtual tenants with the individual actual CPU load greater than the individual standard CPU load in the virtual tenants are taken as the over-standard tenants.
[0102] S606, summing the individual actual CPU loads of the over-standard tenants as an over-standard CPU total.
[0103] S607, determining the adjustment weight corresponding to each over-standard tenant based on the gateway actual CPU load, the gateway standard CPU load, and the over-standard CPU total.
[0104] S608, determining the adjustment weight of the real tenant corresponding to each over-standard tenant according to the adjustment weight corresponding to each over-standard tenant.
[0105] S609, for each real tenant, multiplying the individual actual QPS corresponding to the real tenant and the adjustment weight to determine the adjustment QPS of the real tenant.
[0106] S610, adjusting the flow of the corresponding real tenant based on the adjustment QPS.
[0107] The specific process of S601-S610 can refer to the description of the above method embodiments, and the implementation principle and technical effects are similar, which will not be repeated here.
[0108] It should be understood that although each step in the flowchart involved in each of the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated herein, the execution of these steps has no strict sequence limitation, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with other steps or steps or stages in other steps.
[0109] Based on the same inventive concept, the embodiments of the present application also provide a flow adjustment device for implementing the above-mentioned flow adjustment method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more flow adjustment device embodiments provided below can refer to the limitations of the flow adjustment method in the above text, which will not be repeated here.
[0110] In one example embodiment, as shown in Figure 7 A traffic adjustment apparatus 1 is provided, comprising an obtaining module 10, a weight determining module 20 and an adjustment module 30, wherein:
[0111] The obtaining module 10 is configured to obtain a gateway actual central processing unit (CPU) load corresponding to a gateway in a target period, and individual actual CPU loads and individual actual query per second (QPS) corresponding to each real tenant; wherein the gateway is configured to forward traffic data of each real tenant.
[0112] The weight determining module 20 is configured to determine an adjustment weight corresponding to each real tenant according to an individual standard CPU load and the individual actual CPU load of each real tenant, in a case where the gateway actual CPU load exceeds a load warning value.
[0113] The adjustment module 30 is configured to adjust traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0114] In one embodiment, each real tenant corresponds to at least one virtual tenant, the individual actual CPU loads of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual CPU loads of the virtual tenants corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual QPS of the virtual tenants corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; and the individual standard CPU load is determined according to a gateway standard CPU load and a number of real tenants.
[0115] In one embodiment, as shown in Figure 8 The weight determining module 20 comprises:
[0116] The over-standard selection unit 21 is configured to select over-standard tenants from the virtual tenants according to a size relationship between the individual actual CPU loads of the virtual tenants and the individual standard CPU load.
[0117] The over-standard weight unit 22 is configured to determine an adjustment weight corresponding to each over-standard tenant based on the gateway actual CPU load, the gateway standard CPU load and the individual actual CPU load of each over-standard tenant.
[0118] The real weight unit 23 is configured to determine an adjustment weight of a real tenant corresponding to each over-standard tenant according to the adjustment weight corresponding to each over-standard tenant.
[0119] In one embodiment, the over-standard selection unit 21 is specifically configured to:
[0120] The virtual tenants with individual actual CPU loads greater than the individual standard CPU loads in each virtual tenant are taken as the over-standard tenants.
[0121] In one embodiment, the over-standard weight unit 22 is specifically configured to:
[0122] The sum of the individual actual CPU loads of the over-standard tenants is taken as an over-standard CPU total; and the adjustment weight corresponding to each over-standard tenant is determined based on the gateway actual CPU load, the gateway standard CPU load, and the over-standard CPU total.
[0123] In one embodiment, the adjustment module 30 is specifically configured to:
[0124] For each real tenant, the product of the individual actual QPS corresponding to the real tenant and the adjustment weight is determined as an adjustment QPS of the real tenant; and the corresponding real tenant is subjected to traffic adjustment based on the adjustment QPS.
[0125] In one embodiment, the obtaining module 10 is specifically configured to:
[0126] The individual actual QPS corresponding to each real tenant is obtained; the user mode tick number and the kernel mode tick number consumed by the process as a whole and the user mode tick number and the kernel mode tick number consumed by each real tenant in the target period are obtained; the gateway actual CPU load corresponding to the gateway is determined according to the target period, the tick rate, and the user mode tick number and the kernel mode tick number consumed by the process as a whole; and the individual actual CPU load corresponding to each real tenant is determined according to the target period, the tick rate, and the user mode tick number and the kernel mode tick number consumed by each real tenant.
[0127] Each module in the above traffic adjustment device can be realized in whole or in part by software, hardware, and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to each module.
[0128] In one exemplary embodiment, a computer device, which can be a server, is provided, and an internal structure diagram of the computer device can be as shown in Figure 9As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store traffic data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement a traffic adjustment method.
[0129] Those skilled in the art can understand that, Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0130] In one exemplary embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the following steps:
[0131] Obtaining the gateway actual central processing unit (CPU) load corresponding to the gateway in the target period, and the individual actual CPU load and the individual actual query rate per second (QPS) corresponding to each real tenant; wherein the gateway is used to forward the traffic data of each real tenant;
[0132] In the case where the gateway actual CPU load exceeds the load warning value, determining the adjustment weight corresponding to each real tenant according to the individual standard CPU load and the individual actual CPU load of each real tenant;
[0133] Adjusting the traffic of each real tenant according to the individual actual QPS and the adjustment weight corresponding to each real tenant.
[0134] In one embodiment, each real tenant corresponds to at least one virtual tenant, individual actual CPU loads of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual CPU loads of the virtual tenants corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; individual actual QPS of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual QPS of the virtual tenants corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; and the individual standard CPU load is determined according to the gateway standard CPU load and the number of real tenants.
[0135] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0136] According to a size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant, a tenant exceeding a standard is selected from the virtual tenants; based on the gateway actual CPU load, the gateway standard CPU load and the individual actual CPU load of each tenant exceeding the standard, an adjustment weight corresponding to each tenant exceeding the standard is determined; and based on the adjustment weight corresponding to each tenant exceeding the standard, an adjustment weight of a real tenant corresponding to each tenant exceeding the standard is determined.
[0137] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0138] A virtual tenant whose individual actual CPU load is greater than the individual standard CPU load in the virtual tenants is taken as a tenant exceeding the standard.
[0139] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0140] A sum of the individual actual CPU loads of the tenants exceeding the standard is taken as a total CPU exceeding the standard; and based on the gateway actual CPU load, the gateway standard CPU load and the total CPU exceeding the standard, an adjustment weight corresponding to each tenant exceeding the standard is determined.
[0141] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0142] For each real tenant, a product of the individual actual QPS corresponding to the real tenant and the adjustment weight is determined as an adjustment QPS of the real tenant; and based on the adjustment QPS, traffic adjustment is performed on the corresponding real tenant.
[0143] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0144] obtaining individual actual QPSs of the real tenants; obtaining the number of user mode ticks and the number of kernel mode ticks consumed by the process as a whole in the target period, and the number of user mode ticks and the number of kernel mode ticks consumed by the real tenants; determining the gateway actual CPU load corresponding to the gateway according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by the process as a whole; and determining individual actual CPU loads corresponding to the real tenants according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by the real tenants.
[0145] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium has stored thereon a computer program, and the computer program is executed by a processor to implement the following steps:
[0146] obtaining gateway actual central processing unit (CPU) loads corresponding to the gateway in a target period, and individual actual CPU loads and individual actual query rates per second (QPSs) corresponding to the real tenants; wherein the gateway is used to forward traffic data of the real tenants;
[0147] In a case where the gateway actual CPU load exceeds a load warning value, determining adjustment weights corresponding to the real tenants according to the individual standard CPU load and the individual actual CPU loads of the real tenants;
[0148] adjusting the traffic of the real tenants according to the individual actual QPSs and the adjustment weights corresponding to the real tenants.
[0149] In one embodiment, each real tenant corresponds to at least one virtual tenant, the individual actual CPU loads of the virtual tenants corresponding to the same real tenant are the same, and the sum of the individual actual CPU loads of the virtual tenants corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPSs of the virtual tenants corresponding to the same real tenant are the same, and the sum of the individual actual QPSs of the virtual tenants corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; and the individual standard CPU load is determined according to the gateway standard CPU load and the number of real tenants.
[0150] In one embodiment, the computer program is further executed by the processor to implement the following steps:
[0151] selecting over-limit tenants from the virtual tenants according to the size relationship between the individual actual CPU loads and the individual standard CPU loads of the virtual tenants; determining adjustment weights corresponding to the over-limit tenants based on the gateway actual CPU load, the gateway standard CPU load, and the individual actual CPU loads of the over-limit tenants; and determining adjustment weights of the real tenants corresponding to the over-limit tenants according to the adjustment weights corresponding to the over-limit tenants.
[0152] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0153] The virtual tenants whose individual actual CPU loads are greater than the individual standard CPU loads are regarded as over-standard tenants.
[0154] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0155] The sum of the individual actual CPU loads of the over-standard tenants is regarded as an over-standard CPU total; and the adjustment weight corresponding to each over-standard tenant is determined based on the gateway actual CPU load, the gateway standard CPU load, and the over-standard CPU total.
[0156] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0157] For each real tenant, the product of the individual actual QPS corresponding to the real tenant and the adjustment weight is determined as an adjusted QPS of the real tenant; and the traffic corresponding to the real tenant is adjusted based on the adjusted QPS.
[0158] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0159] The individual actual QPS corresponding to each real tenant is obtained; the number of user-mode ticks and the number of kernel-mode ticks consumed by the whole process in a target period, and the number of user-mode ticks and the number of kernel-mode ticks consumed by each real tenant are obtained; the gateway actual CPU load corresponding to the gateway is determined according to the target period, the tick rate, and the number of user-mode ticks and the number of kernel-mode ticks consumed by the whole process; and the individual actual CPU load corresponding to each real tenant is determined according to the target period, the tick rate, and the number of user-mode ticks and the number of kernel-mode ticks consumed by each real tenant.
[0160] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the following steps:
[0161] The gateway actual central processing unit (CPU) load corresponding to the gateway in a target period, and the individual actual CPU load and the individual actual query rate per second (QPS) corresponding to each real tenant are obtained; wherein the gateway is used to forward traffic data of each real tenant;
[0162] In a case where the gateway actual CPU load exceeds a load warning value, the adjustment weight corresponding to each real tenant is determined according to the individual standard CPU load and the individual actual CPU load of each real tenant;
[0163] The traffic of each real tenant is adjusted according to the individual actual QPS corresponding to each real tenant and the adjustment weight.
[0164] In one embodiment, each real tenant corresponds to at least one virtual tenant, individual actual CPU loads of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual CPU loads of the virtual tenants corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; individual actual QPS of the virtual tenants corresponding to the same real tenant are the same, and a sum of the individual actual QPS of the virtual tenants corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; and the individual standard CPU load is determined according to the gateway standard CPU load and the number of real tenants.
[0165] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0166] According to a size relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant, a tenant exceeding a standard is selected from the virtual tenants; based on the gateway actual CPU load, the gateway standard CPU load and the individual actual CPU load of each tenant exceeding a standard, an adjustment weight corresponding to each tenant exceeding a standard is determined; and based on the adjustment weight corresponding to each tenant exceeding a standard, an adjustment weight of a real tenant corresponding to each tenant exceeding a standard is determined.
[0167] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0168] A virtual tenant whose individual actual CPU load is greater than the individual standard CPU load in each virtual tenant is taken as a tenant exceeding a standard.
[0169] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0170] A sum of the individual actual CPU loads of each tenant exceeding a standard is taken as a total CPU exceeding a standard; and based on the gateway actual CPU load, the gateway standard CPU load and the total CPU exceeding a standard, an adjustment weight corresponding to each tenant exceeding a standard is determined.
[0171] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0172] For each real tenant, a product of the individual actual QPS corresponding to the real tenant and the adjustment weight is determined as an adjustment QPS of the real tenant; and based on the adjustment QPS, a flow adjustment is performed on the corresponding real tenant.
[0173] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0174] acquire individual actual QPS corresponding to each real tenant; acquire the number of user mode ticks and the number of kernel mode ticks consumed by the process as a whole in the target period, and the number of user mode ticks and the number of kernel mode ticks consumed by each real tenant; determine the gateway actual CPU load corresponding to the gateway according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by the process as a whole; and determine individual actual CPU loads corresponding to each real tenant according to the target period, the tick rate, and the number of user mode ticks and the number of kernel mode ticks consumed by each real tenant.
[0175] It should be noted that the information (including but not limited to gateway CPU load information) and data (including but not limited to data for analysis, stored data, and displayed data) involved in the present application are all information and data fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0176] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0177] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0178] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A flow rate adjustment method, characterized in that, The method includes: Obtain the actual QPS for each real tenant; Obtain the total number of user-mode and kernel-mode cycles consumed by the process within the target time period, as well as the number of user-mode and kernel-mode cycles consumed by each real tenant; Based on the target time period, the clock rate, and the total number of user-mode and kernel-mode clock cycles consumed by the process, determine the actual CPU load of the gateway corresponding to the gateway. Based on the target time period, the clock rate, and the number of user-state clock cycles and kernel-state clock cycles consumed by each real tenant, the individual actual CPU load corresponding to each real tenant is determined; wherein, the gateway is used to forward the traffic data of each real tenant; each real tenant corresponds to at least one virtual tenant, the individual actual CPU load of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual CPU loads of each virtual tenant corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual QPS of each virtual tenant corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; the individual standard CPU load is determined based on the gateway standard CPU load and the number of virtual tenants; If the actual CPU load of the gateway exceeds the load warning value, the excess tenant is selected from among the virtual tenants based on the relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant. Based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the individual actual CPU load of each over-limit tenant, determine the adjustment weight corresponding to each over-limit tenant; Based on the adjustment weight corresponding to each tenant who exceeds the limit, determine the adjustment weight of the actual tenant corresponding to each tenant who exceeds the limit; The traffic of each real tenant is adjusted based on their actual QPS and weight.
2. The method according to claim 1, characterized in that, The process of selecting overloaded tenants from among the virtual tenants based on the relationship between the actual CPU load of each virtual tenant and the standard CPU load of each virtual tenant includes: Virtual tenants whose actual CPU load exceeds their standard CPU load are considered to be over-standard tenants.
3. The method according to claim 1, characterized in that, The process of determining the adjustment weight for each overloaded tenant based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the individual actual CPU load of each overloaded tenant includes: The sum of the individual actual CPU loads of each tenant exceeding the limit is taken as the total number of CPUs exceeding the limit. Based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the total number of CPUs exceeding the limit, the adjustment weight corresponding to each tenant exceeding the limit is determined.
4. The method according to claim 3, characterized in that, The step of determining the adjustment weight for each tenant exceeding the limit based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the total number of CPUs exceeding the limit includes: Based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the total number of CPUs exceeding the limit, determine the candidate weight corresponding to each tenant exceeding the limit. The maximum value between the candidate weights for each tenant exceeding the limit and 0 is determined as the adjustment weight for each tenant exceeding the limit.
5. The method according to claim 4, characterized in that, The step of determining the candidate weight for each tenant exceeding the limit based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the sum of the CPUs exceeding the limit includes: Determine the ratio between the difference between the standard CPU load of the gateway and the actual CPU load of the gateway, and the sum of the CPU loads exceeding the standard. The sum of the ratio and 1 is used as the candidate weight for each tenant exceeding the limit.
6. The method according to claim 1, characterized in that, The process of adjusting the traffic of each real tenant based on their actual QPS and adjustment weight includes: For each real tenant, the product of the individual actual QPS and the adjustment weight corresponding to the real tenant is determined as the adjusted QPS of the real tenant; Based on the QPS adjustments described above, traffic adjustments are made for the corresponding real tenants.
7. A flow rate adjustment device, characterized in that, The device includes: The acquisition module is used to acquire the individual actual QPS corresponding to each real tenant; acquire the total user-mode and kernel-mode clock cycles consumed by the process within the target time period, as well as the user-mode and kernel-mode clock cycles consumed by each real tenant; determine the actual CPU load of the gateway corresponding to the gateway based on the target time period, the clock cycle rate, and the total user-mode and kernel-mode clock cycles consumed by the process; determine the individual actual CPU load corresponding to each real tenant based on the target time period, the clock cycle rate, and the user-mode and kernel-mode clock cycles consumed by each real tenant; wherein, the gateway is used to forward traffic data of each real tenant; each real tenant corresponds to at least one virtual tenant, the individual actual CPU load of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual CPU loads of each virtual tenant corresponding to the same real tenant is equal to the individual actual CPU load corresponding to the real tenant; the individual actual QPS of each virtual tenant corresponding to the same real tenant is the same, and the sum of the individual actual QPS of each virtual tenant corresponding to the same real tenant is equal to the individual actual QPS corresponding to the real tenant; the individual standard CPU load is determined based on the gateway standard CPU load and the number of virtual tenants; The weight determination module is used to select overloaded tenants from among the virtual tenants when the actual CPU load of the gateway exceeds the load warning value, based on the relationship between the individual actual CPU load and the individual standard CPU load of each virtual tenant; determine the adjustment weight corresponding to each overloaded tenant based on the actual CPU load of the gateway, the standard CPU load of the gateway, and the individual actual CPU load of each overloaded tenant; and determine the adjustment weight of the real tenant corresponding to each overloaded tenant based on the adjustment weight corresponding to each overloaded tenant. The adjustment module is used to adjust the traffic of each real tenant based on their actual QPS and adjustment weight.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Real-time multi-tenant workload tracking and automatic throttling
CN115004156A
Multi-tenant resource management in a gateway
US20210044539A1