Method, device and computer equipment for dynamically adjusting server capacity
By automatically determining the server capacity status and executing dynamic adjustment strategies, it solves the problems of inefficiency and resource waste caused by manual estimation in traditional methods, and achieves efficient dynamic adjustment of server capacity and improved stability.
Patent Information
- Application Number
- CN202311305244.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-10-10
AI Technical Summary
Traditional server capacity adjustment methods require manual estimation of resource allocation, resulting in inefficiency and resource waste.
By responding to the selection operation of the business service model, the target service version is determined, the request volume and load volume of the service node are obtained based on the message queue, the current capacity status is determined, and the dynamic expansion or reduction strategy is executed to automatically adjust the server capacity.
It realizes automatic and dynamic adjustment of server capacity, reduces resource consumption and operation and maintenance costs, improves server stability and operation fault tolerance, and avoids waste of resources.
Smart Images

Figure CN117453393B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of server technology, and in particular to a method, device, computer equipment and storage medium for dynamically adjusting server capacity. Background Art
[0002] During server operation, the number of users visiting different time periods or different business service types varies, so the server load has peaks and valleys. In order to save costs and ensure service availability, it is usually necessary to dynamically expand and shrink the server.
[0003] However, traditional server capacity adjustment methods usually require manual estimation of server capacity for the corresponding period of time to complete the pre-application resource configuration of the server, which has problems such as inefficiency or waste of resources. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for dynamically adjusting server capacity that can improve efficiency and avoid waste of resources in response to the above technical problems.
[0005] In a first aspect, a method for dynamically adjusting server capacity is provided, the method comprising:
[0006] In response to a selection operation of a candidate service version of the business service model, a target service version is determined; wherein the target service version is determined according to a result of the selection operation;
[0007] Determine the corresponding message queue according to the target service version, and obtain the request volume and corresponding load volume of each service node based on the message queue;
[0008] Determine the current capacity state of the server according to the request amount and the corresponding load amount; wherein the current capacity state includes a state to be expanded, a state to be reduced, and a normal state;
[0009] In response to the current capacity state being a state to be expanded, executing a dynamic capacity expansion strategy to switch the current capacity state from the state to be expanded to a normal state;
[0010] In response to the current capacity state being a state to be reduced, a dynamic reduction strategy is executed to switch the current capacity state from the state to be reduced to a normal state.
[0011] In one embodiment, the current capacity state also includes a minimum capacity state; wherein, before determining the current capacity state of the server according to each request amount and the corresponding load amount, it also includes: in response to the server being in a non-low-frequency request state, querying the working state of the activator; wherein, the low-frequency request state is used to characterize that the total number of requests of the server during the monitoring period is less than or equal to the minimum total number of requests; the total number of requests is the sum of each request amount; the working state includes an on state and a off state; in response to the working state being the off state, controlling the activator to output an automatic capacity expansion request, and returning to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue; the automatic capacity expansion request is used to request that the current capacity state be controlled to be the minimum capacity state.
[0012] In one of the embodiments, after querying the working status of the activator, the method further includes: in response to the working status being an on state, returning to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue.
[0013] In one of the embodiments, the current capacity state of the server is determined based on each request amount and the corresponding load amount, including: counting the total number of requests and the total load amount; wherein the total number of requests is the sum of each request amount; the total load amount is the sum of each load amount; in response to the total number of requests being greater than the first preset total number of requests or the total number of loads being greater than the first preset total number of loads, determining that the current capacity state is a state to be expanded; in response to the total number of requests being less than or equal to the second preset total number of requests and the total number of loads being less than the second preset total number of loads, determining that the current capacity state is a state to be reduced; wherein the second preset total number of requests is less than the first preset total number of requests; and the second preset total number of loads is less than the first preset total number of loads.
[0014] In one embodiment, judging the current capacity state of the server according to each request amount and the corresponding load amount includes: calculating a request amount average value according to each request amount, and calculating a total load amount according to each load amount; wherein the request amount average value is an average value of each request amount; and the total load amount is a sum of the total load amounts; calculating a first request amount threshold value according to the request amount average value and a first adjustment factor, and calculating a second request amount threshold value according to the request amount average value and a second adjustment factor; wherein the first adjustment factor is less than the second adjustment factor;
[0015] A first load threshold is calculated based on the maximum load amount and the third adjustment factor, and a second load threshold is calculated based on the maximum load amount and the fourth adjustment factor; wherein the third adjustment factor is greater than the fourth adjustment factor; in response to the existence of a request amount greater than the first request amount threshold or the total load amount greater than the first load threshold, it is determined that the current capacity state is a state to be expanded; in response to the existence of a request amount less than the second request amount threshold and the total load amount less than the second load threshold, it is determined that the current capacity state is a state to be reduced.
[0016] In one embodiment, executing the dynamic capacity expansion strategy includes:
[0017] The current capacity of the server is increased by the preset capacity, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be expanded to the normal state.
[0018] In one embodiment, executing the dynamic scaling-down strategy includes:
[0019] The current capacity is reduced by the preset capacity, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the to-be-reduced state to the normal state.
[0020] In one embodiment, executing the dynamic capacity expansion strategy includes:
[0021] Calculate the target increase and the target number of expansion nodes; the target increase is the ratio of the first target total request difference to the first target total request; the first target total request difference is the difference between the second target total request and the first target total request; the second target total request is the sum of all requests in the current statistical cycle; the first target total request is the sum of all requests in the previous statistical weekday; the target number of expansion nodes is the ratio of the first target total request difference to the single node consumption request; the single node consumption request is the maximum request consumed by a single service node;
[0022] In response to the target increase being greater than the increase threshold, the capacity to be expanded is calculated based on the target number of expansion nodes and the fifth adjustment factor, the current capacity of the server is increased by the capacity to be expanded, and the process returns to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue until the current capacity state is switched from the state to be expanded to the normal state.
[0023] In one embodiment, executing the dynamic scaling-down strategy includes:
[0024] Calculate the target reduction and the target number of nodes for shrinking; the target reduction is the ratio of the second target request total difference to the first target request total difference; the second target request total difference is the difference between the first target request total difference and the second target request total difference; the target number of nodes for shrinking is the ratio of the second target request total difference to the single node consumption request amount;
[0025] In response to the target reduction being greater than the reduction threshold, the capacity to be reduced is calculated based on the target number of reduced nodes and the sixth adjustment factor, and the current capacity of the server is reduced by the capacity to be reduced, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue until the current capacity state is switched from the state to be reduced to the normal state.
[0026] In a second aspect, a device for dynamically adjusting server capacity is provided, the device comprising a version determination module, an information acquisition module, a state judgment module, a dynamic capacity expansion module and a dynamic capacity reduction module.
[0027] Among them, the version determination module is used to determine the target service version in response to the selection operation of the candidate service version of the business service model; wherein the target service version is determined according to the result of the selection operation; the information acquisition module is used to determine the corresponding message queue according to the target service version, and obtain the request volume and the corresponding load volume of each service node based on the message queue; the state judgment module is used to judge the current capacity state of the server according to each request volume and the corresponding load volume; wherein the current capacity state includes a state to be expanded, a state to be reduced and a normal state; the dynamic expansion module is used to execute a dynamic expansion strategy in response to the current capacity state being a state to be expanded, so as to switch the current capacity state from the state to be expanded to the normal state; the dynamic reduction module is used to execute a dynamic reduction strategy in response to the current capacity state being a state to be reduced, so as to switch the current capacity state from the state to be reduced to the normal state.
[0028] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0029] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0030] The above-mentioned method, device, computer equipment and storage medium for dynamic adjustment of server capacity determine the target service version by responding to the selection operation of the candidate service version of the business service model; wherein the target service version is determined according to the result of the selection operation; then, the corresponding message queue is determined according to the target service version, and the request amount and the corresponding load amount of each service node are obtained based on the message queue; then, the current capacity state of the server is judged according to each request amount and the corresponding load amount; wherein the current capacity state includes a state to be expanded, a state to be reduced and a normal state; then, in response to the current capacity state being a state to be expanded, a dynamic capacity expansion strategy is executed to switch the current capacity state from the state to be expanded to the normal state; at the same time, in response to the current capacity state being a state to be reduced, a dynamic capacity reduction strategy is executed to switch the current capacity state from the state to be reduced to the normal state, thereby realizing automatic dynamic adjustment of server capacity, reducing the reserve requirement to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, and facilitating rapid response to business requests, while improving the efficiency of dynamic adjustment of servers and avoiding resource waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 An application environment diagram of a method for dynamically adjusting server capacity in one embodiment;
[0032] Figure 2 A first flow chart of a method for dynamically adjusting server capacity in one embodiment;
[0033] Figure 3 A schematic diagram of a first process for determining the current capacity state of a server according to each request amount and a corresponding load amount in an embodiment;
[0034] Figure 4 A schematic diagram of a second process for determining the current capacity state of a server according to each request amount and the corresponding load amount in one embodiment;
[0035] Figure 5 A second flow chart of a method for dynamically adjusting server capacity in one embodiment;
[0036] Figure 6 A third flow chart of a method for dynamically adjusting server capacity in one embodiment;
[0037] Figure 7 A fourth flow chart of a method for dynamically adjusting server capacity in one embodiment;
[0038] Figure 8 A structural block diagram of a device for dynamically adjusting server capacity in one embodiment;
[0039] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0043] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first resistor may be referred to as a second resistor, and similarly, a second resistor may be referred to as a first resistor. Both the first resistor and the second resistor are resistors, but they are not the same resistor.
[0044] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if the connected circuits, modules, units, etc. have electrical signals or data transmission between each other.
[0045] When used herein, the singular forms "a", "an", and "said / the" may also include plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include / comprise" or "have" etc. specify the presence of stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof.
[0046] The method for dynamically adjusting server capacity provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0047] In a specific example, the server can, but is not limited to, perform a method for dynamically adjusting server capacity through a container cluster management system. Knative in the container cluster management system can, but is not limited to, be built based on Kubernetes (k8s), which can manage server deployment, automatic expansion, and load balancing through seamless integration of container technology. The above are only specific examples, which can be flexibly set according to user needs in actual applications and are not limited here.
[0048] In one embodiment, Figure 2 As shown, a method for dynamically adjusting server capacity is provided, and the method is applied to Figure 1 The server in is taken as an example to illustrate, including the following steps 201 to 205.
[0049] Step 201 : In response to a selection operation of a candidate service version of a business service model, a target service version is determined.
[0050] The target service version is determined according to the result of the selection operation. It is understandable that different business service models are used to serve different business types. In a specific example, the business service model includes a loan business service model, a login business service model, and a repayment business service model, etc. The above are only specific examples, which can be flexibly set according to user needs in actual applications and are not limited here.
[0051] In a specific example, the service versions to be selected include the initial version, the first version, the second version, the third version and the latest version, etc. The server can perform routing management according to the target service version, that is, route the business request to the specified target service version. The above is only a specific example. In actual application, it is flexibly set according to user needs and is not limited here.
[0052] In a specific example, different target service versions can be identified by version identification numbers or version tags. The above are only specific examples and can be flexibly set according to user needs in actual applications and are not limited here.
[0053] Specifically, when the server identifies the selection operation of the candidate service version of the business service model, it can determine the target service version according to the result of the selection operation, so as to match the corresponding message queue according to the above target service version, thereby realizing the simultaneous operation of multiple versions of the business service model and the simultaneous management of multiple versions of the business service model. It can also realize the smooth upgrade and grayscale release of the business service model through scheduling through different traffic distribution algorithms, which can improve the development efficiency of the business service model and the efficiency and convenience of dynamic adjustment of server capacity.
[0054] Step 202: determine the corresponding message queue according to the target service version, and obtain the request volume and corresponding load volume of each service node based on the message queue.
[0055] It is understandable that different message queues are deployed with corresponding service nodes, and the number of service nodes is flexibly set according to user needs in actual applications and is not limited here. Specifically, the server can determine the corresponding message queue according to the target service version, so that the request volume of each service node and the load volume of the corresponding service node can be obtained based on the message queue.
[0056] Step 203: determine the current capacity status of the server according to each request amount and the corresponding load amount.
[0057] Among them, the current capacity state includes the state to be expanded, the state to be reduced, and the normal state. It can be understood that the state to be expanded is used to indicate that the server currently needs to be expanded; the state to be reduced is used to indicate that the server currently needs to be reduced; and the normal state is used to indicate that the server is currently in a normal operating state. Specifically, the server can determine the current capacity state of the server based on the request volume of each service node and the load volume of the corresponding service node.
[0058] In one embodiment, if Figure 3 As shown, judging the current capacity status of the server according to each request amount and the corresponding load amount includes steps 301 to 303.
[0059] Step 301, counting the total number of requests and the total load.
[0060] Step 302: In response to the total request amount being greater than a first preset total request amount or the total load amount being greater than a first preset total load amount, it is determined that the current capacity state is a state to be expanded.
[0061] Step 303: In response to the total request amount being less than or equal to the second preset total request amount and the total load amount being less than the second preset total load amount, it is determined that the current capacity state is a state to be reduced.
[0062] Among them, the total request amount is the sum of each request amount; the total load amount is the sum of each load amount; the second preset total request amount is less than the first preset total request amount; the second preset total load amount is less than the first preset total load amount.
[0063] Specifically, the server can count the sum of all request amounts, that is, the total request amount, and the sum of all load amounts, that is, the total load amount; then, when the server recognizes that the total request amount is greater than the first preset total request amount or the total load amount is greater than the first preset total load amount, it means that the current capacity of the server is insufficient, that is, the server currently needs to be expanded, so the current capacity state can be determined to be a state to be expanded; at the same time, when the server recognizes that the total request amount is less than or equal to the second preset total request amount and the total load amount is less than the second preset total load amount, it means that the current capacity of the server is too large, that is, the server currently needs to be reduced, so the current capacity state can be determined to be a state to be reduced.
[0064] In this embodiment, the total number of requests and the total number of loads are counted; then, in response to the total number of requests being greater than the first preset total number of requests or the total number of loads being greater than the first preset total number of loads, the current capacity state is determined to be a state to be expanded; at the same time, in response to the total number of requests being less than or equal to the second preset total number of requests and the total number of loads being less than the second preset total number of loads, the current capacity state is determined to be a state to be reduced, thereby achieving accurate judgment of the current capacity state of the server, improving the monitoring efficiency of the current capacity state of the server, and facilitating dynamic adjustment of the server capacity.
[0065] In one embodiment, if Figure 4 As shown, judging the current capacity status of the server according to each request amount and the corresponding load amount includes steps 401 to 405.
[0066] Step 401, calculate the average value of the request amount according to each request amount, and calculate the total load amount according to each load amount.
[0067] The average request amount is the average of each request amount, and the total load is the sum of each load amount. Specifically, the server can calculate the average request amount according to each request amount, and calculate the total load according to each load amount.
[0068] Step 402: Calculate a first request amount threshold value according to the request amount average value and a first adjustment factor, and calculate a second request amount threshold value according to the request amount average value and a second adjustment factor.
[0069] The first adjustment factor is smaller than the second adjustment factor. Specifically, the server may calculate the first request volume threshold according to the average request volume and the first adjustment factor, and calculate the second request volume threshold according to the average request volume and the second adjustment factor.
[0070] In a specific example, the first adjustment factor may be but is not limited to 90%, and the second adjustment factor may be but is not limited to 110%. The above are only specific examples and can be flexibly set according to user needs in actual applications and are not limited here.
[0071] Step 403: Calculate a first load threshold according to the maximum load amount and the third adjustment factor, and calculate a second load threshold according to the maximum load amount and the fourth adjustment factor.
[0072] Among them, the third adjustment factor is greater than the fourth adjustment factor, and the maximum total load is the maximum value of the total load of the server; it can be understood that the maximum total load is determined according to the specific configuration parameters, type and brand of the server, and is flexibly set according to user needs in actual applications, and is not limited here. The server can calculate the first load threshold according to the maximum total load and the third adjustment factor, and calculate the second load threshold according to the maximum total load and the fourth adjustment factor.
[0073] In a specific example, the third adjustment factor may be but is not limited to 80%, and the fourth adjustment factor may be but is not limited to 20%. The above are only specific examples and can be flexibly set according to user needs in actual applications and are not limited here.
[0074] Step 404: In response to the request amount being greater than the first request amount threshold or the total load being greater than the first load threshold, it is determined that the current capacity state is a state to be expanded.
[0075] Specifically, when the server recognizes that the request volume is greater than the first request volume threshold or the total load is greater than the first load threshold, it means that the current capacity of the server is insufficient, that is, the server currently needs to be expanded, so it can be determined that the current capacity state is a state to be expanded. The above process can also be used to accurately predict whether the current capacity state is in a state to be expanded.
[0076] Step 405: In response to the request amount being less than the second request amount threshold and the total load being less than the second load threshold, it is determined that the current capacity state is a state to be reduced.
[0077] Specifically, when the server recognizes that the request volume is less than the second request volume threshold and the total load is less than the second load threshold, it means that the current capacity of the server is too large, that is, the server currently needs to be reduced in capacity, so it can be determined that the current capacity state is a state to be reduced in capacity. The above process can also be used to accurately predict whether the current capacity state is in a state to be reduced in capacity.
[0078] In this embodiment, an average value of the request amount is calculated based on each request amount, and a total load is calculated based on each load amount; then, a first request amount threshold is calculated based on the request amount average value and a first adjustment factor, and a second request amount threshold is calculated based on the request amount average value and a second adjustment factor; then, the first load threshold is calculated based on the maximum total load and a third adjustment factor, and the second load threshold is calculated based on the maximum total load and a fourth adjustment factor; then, in response to the existence of a request amount greater than the first request amount threshold or a total load amount greater than the first load threshold, it is determined that the current capacity state is a state to be expanded; at the same time, in response to the existence of a request amount less than the second request amount threshold and a total load amount less than the second load threshold, it is determined that the current capacity state is a state to be reduced, thereby achieving accurate prediction of the current capacity state, improving the monitoring efficiency of the current capacity state of the server, and facilitating dynamic adjustment of the server capacity.
[0079] Step 204: In response to the current capacity state being a state to be expanded, a dynamic capacity expansion strategy is executed to switch the current capacity state from the state to be expanded to a normal state.
[0080] The dynamic capacity expansion strategy is used to dynamically expand the capacity of the server. Specifically, when the server identifies that the current capacity state is a state to be expanded, the dynamic capacity expansion strategy can be executed, so that the current capacity state is switched from the state to be expanded to the normal state.
[0081] In one embodiment, if Figure 5 As shown, executing the dynamic capacity expansion strategy includes step 501.
[0082] Step 501, increase the current capacity of the server by the preset capacity, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the to-be-expanded state to the normal state.
[0083] The server may store the preset capacity. In a specific example, the preset capacity may be, but is not limited to, a service node. The above is only a specific example. In actual applications, it may be flexibly set according to user needs and is not limited here.
[0084] Specifically, the server can increase the current capacity of the server by the preset capacity, and then return to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, and then judge the current capacity status of the server again according to each request volume and the corresponding load volume, until the current capacity status switches from the to-be-expanded state to the normal state, thereby realizing dynamic expansion of server capacity, reducing the reserve requirement ratio to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, facilitating rapid response to business requests, and avoiding resource waste while improving the dynamic adjustment efficiency of the server.
[0085] In a specific example, the preset capacity can be reduced through the virtual nodes in the cloud server. Specifically, the virtual nodes can be, but are not limited to, virtual nodes in Alibaba Cloud Elastic Container Instance (ECI), so that sufficient resource space can be quickly obtained for batch services, and resource space can be automatically released during low-peak business periods, reducing resource waste and further reducing operation and maintenance costs. The above is only a specific example, and it can be flexibly set according to user needs in actual applications, and is not limited here.
[0086] In this embodiment, the current capacity of the server is increased by the preset capacity, and the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue is returned until the current capacity state is switched from the to-be-expanded state to the normal state, thereby realizing dynamic expansion of the server capacity, reducing the reserve requirement ratio to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, facilitating rapid response to business requests, and avoiding resource waste while improving the efficiency of dynamic adjustment of the server.
[0087] In one embodiment, if Figure 6 As shown, executing the dynamic capacity expansion strategy includes steps 601 to 602.
[0088] Step 601, calculate the target increase and the target number of expansion nodes.
[0089] Among them, the target increase is the ratio of the difference in the total number of requests of the first target to the total number of requests of the first target; the difference in the total number of requests of the first target is the difference between the total number of requests of the second target and the total number of requests of the first target; the total number of requests of the second target is the sum of the requests in the current statistical cycle; the total number of requests of the first target is the sum of the requests in the previous statistical weekday; the number of target expansion nodes is the ratio of the difference in the total number of requests of the first target to the number of requests consumed by a single node; the number of requests consumed by a single node is the maximum number of requests consumed by a single service node. Specifically, the server can calculate the target increase and the number of target expansion nodes.
[0090] Step 602, in response to the target increase being greater than the increase threshold, the capacity to be expanded is calculated based on the target number of expansion nodes and the fifth adjustment factor, the current capacity of the server is increased by the capacity to be expanded, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be expanded to the normal state.
[0091] Specifically, when the server identifies that the target increase is greater than the increase threshold, it can calculate the capacity to be expanded based on the target number of expansion nodes and the fifth adjustment factor, increase the current capacity of the server by the capacity to be expanded, and return to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, until the current capacity state switches from the state to be expanded to the normal state, so that the capacity to be expanded can be accurately predicted, thereby realizing dynamic expansion of server capacity, reducing the reserve requirement to control the consumption of server resources, reducing operation and maintenance costs, improving server stability and operating fault tolerance, and facilitating rapid response to business requests, while improving the efficiency of dynamic adjustment of servers and avoiding waste of resources.
[0092] In a specific example, the number of requests consumed by a single node is 5, the sum of all requests in the previous statistical week, that is, the first target total number of requests, is 13, the sum of all requests in the current statistical period, that is, the second target total number of requests, is 30, the difference between the second target total number of requests and the first target total number of requests, that is, the first target total number of requests, is 17, and the target increase is 3.4. If the increase threshold is 2 and the fifth adjustment factor is 200%, it means that the target increase is greater than the increase threshold, and the product of the target increase and the fifth adjustment factor can be calculated to be 6.8, and the capacity to be expanded can be calculated to be 7 service nodes based on the target number of expansion nodes and the fifth adjustment factor, so that the current capacity of the server can be increased by 7 service nodes. The above is only a specific example, which can be flexibly set according to user needs in actual applications and is not limited here.
[0093] In this embodiment, the target increase and the target number of expansion nodes are calculated; then, in response to the target increase being greater than the increase threshold, the capacity to be expanded is calculated according to the target number of expansion nodes and the fifth adjustment factor, the current capacity of the server is increased by the capacity to be expanded, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be expanded to the normal state, so that the capacity to be expanded can be accurately predicted, thereby realizing dynamic expansion of server capacity, reducing the reserve requirement ratio to control the consumption of server resources, reducing operation and maintenance costs, improving server stability and operating fault tolerance, and facilitating rapid response to business requests, while improving the efficiency of dynamic adjustment of servers and avoiding waste of resources.
[0094] Step 205 , in response to the current capacity state being a state to be reduced, executing a dynamic capacity reduction strategy to switch the current capacity state from the state to be reduced to a normal state.
[0095] The dynamic capacity reduction strategy is used to dynamically reduce the capacity of the server. Specifically, when the server identifies that the current capacity state is a state to be reduced, the dynamic capacity reduction strategy can be executed, so that the current capacity state is switched from the state to be reduced to the normal state.
[0096] In one embodiment, if Figure 5 As shown, executing the dynamic scaling-in strategy includes step 502 .
[0097] Step 502, reduce the current capacity by a preset capacity, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the to-be-reduced state to the normal state.
[0098] The server may store the preset capacity. In a specific example, the preset capacity may be, but is not limited to, a service node. The above is only a specific example. In actual applications, it may be flexibly set according to user needs and is not limited here.
[0099] Specifically, the server can reduce the current capacity by the preset capacity, and then return to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, and then judge the current capacity status of the server again according to the request volume and the corresponding load volume, until the current capacity status switches from the to-be-reduced state to the normal state, thereby realizing dynamic capacity reduction of the server capacity, reducing the reserve requirement to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, facilitating rapid response to business requests, and avoiding resource waste while improving the dynamic adjustment efficiency of the server.
[0100] In a specific example, the preset capacity can be reduced through the virtual nodes in the cloud server. Specifically, the virtual nodes can be, but are not limited to, virtual nodes in Alibaba Cloud Elastic Container Instance (ECI), so that sufficient resource space can be quickly obtained for batch services, and resource space can be automatically released during low-peak business periods, reducing resource waste and further reducing operation and maintenance costs. The above is only a specific example, and it can be flexibly set according to user needs in actual applications, and is not limited here.
[0101] In this embodiment, the current capacity is reduced by the preset capacity, and the process returns to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, until the current capacity state is switched from the to-be-reduced state to the normal state, thereby realizing dynamic capacity reduction of the server capacity, reducing the reserve requirement ratio to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operating fault tolerance of the server, facilitating rapid response to business requests, and avoiding waste of resources while improving the efficiency of dynamic adjustment of the server.
[0102] In one embodiment, if Figure 6 As shown, executing the dynamic shrinking strategy includes steps 603 to 604.
[0103] Step 603: Calculate the target reduction and the target number of nodes to be reduced.
[0104] Among them, the target reduction is the ratio of the second target request total difference to the first target request total difference; the second target request total difference is the difference between the first target request total difference and the second target request total difference; the target number of reduced nodes is the ratio of the second target request total difference to the single-node consumption request amount; specifically, the server can calculate the target reduction and the target number of reduced nodes.
[0105] Step 604, in response to the target reduction being greater than the reduction threshold, calculate the capacity to be reduced based on the target number of reduced nodes and the sixth adjustment factor, reduce the current capacity of the server by the capacity to be reduced, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state switches from the state to be reduced to the normal state.
[0106] Specifically, when the server identifies that the target reduction is greater than the reduction threshold, it can calculate the capacity to be reduced according to the target number of reduction nodes and the sixth adjustment factor, and reduce the current capacity of the server by the capacity to be reduced, and return to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, until the current capacity state switches from the state to be reduced to the normal state, so that the capacity to be reduced can be accurately predicted, thereby realizing dynamic reduction of server capacity, controlling the consumption of server resources, reducing operation and maintenance costs, improving server stability and operating fault tolerance, and facilitating rapid response to business requests, while improving the efficiency of dynamic adjustment of servers and avoiding waste of resources.
[0107] In this embodiment, the target reduction and the target number of nodes to be reduced are calculated; then, in response to the target reduction being greater than the reduction threshold, the capacity to be reduced is calculated according to the target number of nodes to be reduced and the sixth adjustment factor, and the current capacity of the server is reduced by the capacity to be reduced, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be reduced to the normal state, so that the capacity to be reduced can be accurately predicted, thereby realizing dynamic reduction of server capacity, reducing the reserve requirement to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, and facilitating rapid response to business requests, while improving the efficiency of dynamic adjustment of the server and avoiding waste of resources.
[0108] In the above-mentioned method for dynamic adjustment of server capacity, in response to the selection operation of the candidate service version of the business service model, the target service version is determined; wherein the target service version is determined according to the result of the selection operation; then, the corresponding message queue is determined according to the target service version, and the request volume and the corresponding load volume of each service node are obtained based on the message queue; then, the current capacity state of the server is judged according to each request volume and the corresponding load volume; wherein the current capacity state includes a state to be expanded, a state to be reduced and a normal state; then, in response to the current capacity state being a state to be expanded, a dynamic capacity expansion strategy is executed to switch the current capacity state from the state to be expanded to the normal state; at the same time, in response to the current capacity state being a state to be reduced, a dynamic capacity reduction strategy is executed to switch the current capacity state from the state to be reduced to the normal state, thereby realizing automatic dynamic adjustment of server capacity, reducing the reserve requirement to control the consumption of server resources, reducing operation and maintenance costs, improving the stability and operation fault tolerance of the server, and being conducive to rapid response to business requests, while improving the efficiency of dynamic adjustment of servers and avoiding resource waste.
[0109] In one embodiment, if Figure 7 As shown, the current capacity state also includes the minimum capacity state; wherein, before judging the current capacity state of the server according to each request amount and the corresponding load amount, steps 701 to 702 are also included.
[0110] Step 701, in response to the server being in a non-low-frequency request state, querying the working state of the activator.
[0111] Among them, the low-frequency request state is used to indicate that the total number of requests of the server during the monitoring period is less than or equal to the minimum total number of requests; the total number of requests is the sum of the total number of requests; the working state includes the on state and the off state. It can be understood that when the server recognizes that the server is in a non-low-frequency request state, it can query the working state of the activator.
[0112] In a specific example, the minimum total request amount may be but is not limited to zero, and the monitoring period may be but is not limited to 1 week, 1 day or 1 hour. The above are only specific examples and can be flexibly set according to user needs in actual applications and are not limited here.
[0113] In a specific example, the activator is in a closed state when the server is in a low-frequency request state, thereby reducing the current capacity of the server to zero service nodes, thereby saving server resources to the greatest extent. The above is only a specific example. In actual applications, it is flexibly set according to user needs and is not limited here.
[0114] Step 702, in response to the working state being the closed state, the control activator outputs an automatic capacity expansion request, and returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue.
[0115] The automatic capacity expansion request is used to request that the current capacity state be controlled to the minimum capacity state. In a specific example, the minimum capacity state of the server may be, but is not limited to, the state that the current capacity of the server maintains one service node. The above is only a specific example, and in actual applications, it is flexibly set according to user needs and is not limited here.
[0116] Specifically, when the server recognizes that the working state is closed, the control activator outputs an automatic capacity expansion request, thereby requesting that the current capacity state be controlled to the minimum capacity state, that is, the current capacity of the server is activated for capacity expansion operation, and returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, so as to further judge the current capacity state of the server according to each request amount and the corresponding load amount to complete the subsequent dynamic adjustment of the server capacity, thereby avoiding waste of server resources to the greatest extent.
[0117] In this embodiment, in response to the server being in a non-low-frequency request state, the working state of the activator is queried; then, in response to the working state being a closed state, the activator is controlled to output an automatic capacity expansion request, and returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, thereby avoiding waste of server resources to the greatest extent.
[0118] In one embodiment, if Figure 7 As shown, after querying the working status of the activator, step 703 is also included.
[0119] Step 703, in response to the working state being the on state, return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue.
[0120] Specifically, when the server recognizes that the working status is on, it directly returns to the step of obtaining the request volume and the corresponding load volume of each service node based on the message queue, completes the update of the request volume and the corresponding load volume of each service node, and further judges the current capacity status of the server according to each request volume and the corresponding load volume to complete the subsequent dynamic adjustment of the server capacity, thereby avoiding waste of server resources to the greatest extent.
[0121] In this embodiment, in response to the working state being the on state, the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, thereby improving the convenience and accuracy of dynamic adjustment of server capacity.
[0122] It should be understood that although Figure 2-7The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-7 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0123] In one embodiment, Figure 8 As shown, a device for dynamically adjusting server capacity is provided, and the device includes a version determination module 810, an information acquisition module 820, a state judgment module 830, a dynamic capacity expansion module 840 and a dynamic capacity reduction module 850.
[0124] Among them, the version determination module 810 is used to determine the target service version in response to the selection operation of the candidate service version of the business service model; wherein the target service version is determined according to the result of the selection operation; the information acquisition module 820 is used to determine the corresponding message queue according to the target service version, and obtain the request volume and the corresponding load volume of each service node based on the message queue; the state judgment module 830 is used to judge the current capacity state of the server according to each request volume and the corresponding load volume; wherein the current capacity state includes a state to be expanded, a state to be reduced and a normal state; the dynamic expansion module 840 is used to execute a dynamic expansion strategy in response to the current capacity state being a state to be expanded, so as to switch the current capacity state from the state to be expanded to the normal state; the dynamic reduction module 850 is used to execute a dynamic reduction strategy in response to the current capacity state being a state to be reduced, so as to switch the current capacity state from the state to be reduced to the normal state.
[0125] In one of the embodiments, the current capacity state also includes a minimum capacity state; wherein the above-mentioned device also includes an activator control module.
[0126] Among them, the activator control module is used to query the working status of the activator in response to the server being in a non-low-frequency request state; wherein, the low-frequency request state is used to characterize that the total number of requests of the server during the monitoring period is less than or equal to the minimum total number of requests; the total number of requests is the sum of each request amount; the working state includes an on state and a off state; the activator control module is used to control the activator to output an automatic capacity expansion request in response to the working state being the off state, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue; the automatic capacity expansion request is used to request that the current capacity state be controlled to the minimum capacity state.
[0127] In one embodiment, the activator control module is used to return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue in response to the working state being the on state.
[0128] In one embodiment, the state determination module 830 includes a first determination unit.
[0129] Among them, the first judgment unit is used to count the total number of requests and the total number of loads; wherein, the total number of requests is the sum of each request amount; the total number of loads is the sum of each load amount; the first judgment unit is used to respond to the total number of requests being greater than the first preset total number of requests or the total number of loads being greater than the first preset total number of loads, and determine that the current capacity state is a state to be expanded; the first judgment unit is used to respond to the total number of requests being less than or equal to the second preset total number of requests and the total number of loads being less than the second preset total number of loads, and determine that the current capacity state is a state to be reduced; wherein, the second preset total number of requests is less than the first preset total number of requests; the second preset total number of loads is less than the first preset total number of loads.
[0130] In one embodiment, the state determination module 830 includes a second determination unit.
[0131] Among them, the second judgment unit is used to calculate the average request amount according to each request amount, and calculate the total load according to each load amount; wherein the average request amount is the average value of each request amount; the total load is the sum of each load total; the second judgment unit is used to calculate the first request amount threshold according to the average request amount and the first adjustment factor, and calculate the second request amount threshold according to the average request amount and the second adjustment factor; wherein the first adjustment factor is less than the second adjustment factor; the second judgment unit is used to calculate the first load threshold according to the maximum load total and the third adjustment factor, and calculate the second load threshold according to the maximum load total and the fourth adjustment factor; wherein the third adjustment factor is greater than the fourth adjustment factor; the second judgment unit is used to determine that the current capacity state is a state to be expanded in response to the existence of a request amount greater than the first request amount threshold or the total load is greater than the first load threshold; the second judgment unit is used to determine that the current capacity state is a state to be reduced in response to the existence of a request amount less than the second request amount threshold and the total load is less than the second load threshold.
[0132] In one embodiment, the dynamic expansion module 840 includes a first dynamic expansion unit.
[0133] Among them, the first dynamic capacity expansion unit is used to increase the current capacity of the server by the preset capacity, and return to the step of obtaining the request volume and corresponding load volume of each service node based on the message queue until the current capacity state is switched from the to-be-expanded state to the normal state.
[0134] In one embodiment, the dynamic capacity reduction module 850 includes a first dynamic capacity reduction unit.
[0135] Among them, the first dynamic capacity reduction unit is used to reduce the current capacity by a preset capacity, and return to the step of obtaining the request amount and corresponding load amount of each service node based on the message queue until the current capacity state is switched from the to-be-reduced state to the normal state.
[0136] In one embodiment, the dynamic expansion module 840 includes a second dynamic expansion unit.
[0137] Among them, the second dynamic expansion unit is used to calculate the target increase and the target number of expansion nodes; wherein the target increase is the ratio of the first target request total difference to the first target request total; the first target request total difference is the difference between the second target request total and the first target request total; the second target request total is the sum of each request in the current statistical period; the first target request total is the sum of each request in the previous statistical week; the target number of expansion nodes is the ratio of the first target request total difference to the single-node consumption request amount; the single-node consumption request amount is the maximum request amount consumed by a single service node; the second dynamic expansion unit is used to respond to the target increase being greater than the increase threshold, calculate the capacity to be expanded according to the target expansion node number and the fifth adjustment factor, increase the current capacity of the server by the capacity to be expanded, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state switches from the state to be expanded to the normal state.
[0138] In one embodiment, the dynamic capacity reduction module 850 includes a second dynamic capacity reduction unit.
[0139] Among them, the second dynamic capacity reduction unit is used to calculate the target reduction and the target number of reduced nodes; wherein, the target reduction is the ratio of the second target request total difference to the first target request total; the second target request total difference is the difference between the first target request total and the second target request total; the target number of reduced nodes is the ratio of the second target request total difference to the request amount consumed by a single node; the second dynamic capacity reduction unit is used to respond to the target reduction being greater than the reduction threshold, calculate the capacity to be reduced according to the target number of reduced nodes and the sixth adjustment factor, reduce the current capacity of the server by the capacity to be reduced, and return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state switches from the state to be reduced to the normal state.
[0140] For the specific definition of the device for dynamically adjusting server capacity, please refer to the definition of the method for dynamically adjusting server capacity in the above text, which will not be repeated here. Each module in the above-mentioned device for dynamically adjusting server capacity can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0141] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. 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 data on the request amount and the corresponding load amount of each service node. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for dynamically adjusting server capacity is implemented.
[0142] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0143] In a third aspect, a computer device is provided. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of any method in the above method embodiments are implemented.
[0144] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any method in the above method embodiments are implemented.
[0145] 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, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0146] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for dynamically adjusting server capacity, the method comprising: In response to a selection operation of a candidate service version of a business service model, determining a target service version; wherein the target service version is determined according to a result of the selection operation; Determine a corresponding message queue according to the target service version, and obtain a request amount and a corresponding load amount of each service node based on the message queue; Determine the current capacity state of the server according to each of the request amounts and the corresponding load amount; wherein the current capacity state includes a state to be expanded, a state to be reduced, and a normal state; In response to the current capacity state being the to-be-expanded state, executing a dynamic capacity expansion strategy to switch the current capacity state from the to-be-expanded state to the normal state; In response to the current capacity state being the to-be-shrinked state, executing a dynamic shrinking strategy to switch the current capacity state from the to-be-shrinked state to the normal state; Wherein, judging the current capacity state of the server according to each of the request amounts and the corresponding load amounts includes: Calculating a request amount average value according to each of the request amounts, and calculating a total load amount according to each of the load amounts; wherein the request amount average value is an average value of each of the request amounts; and the total load amount is a sum of each of the total load amounts; Calculate a first request amount threshold value according to the request amount average value and a first adjustment factor, and calculate a second request amount threshold value according to the request amount average value and a second adjustment factor; wherein the first adjustment factor is smaller than the second adjustment factor; Calculating a first load threshold according to the maximum load amount and a third adjustment factor, and calculating a second load threshold according to the maximum load amount and a fourth adjustment factor; wherein the third adjustment factor is greater than the fourth adjustment factor; In response to the request amount being greater than the first request amount threshold or the total load being greater than the first load threshold, determining that the current capacity state is the to-be-expanded state; In response to the request amount being less than the second request amount threshold and the total load being less than the second load threshold, it is determined that the current capacity state is the to-be-reduced capacity state.
2. The method according to claim 1, characterized in that The current capacity state also includes a minimum capacity state; wherein, before determining the current capacity state of the server according to each of the request amounts and the corresponding load amount, the method further includes: In response to the server being in a non-low-frequency request state, querying the working state of the activator; wherein the low-frequency request state is used to indicate that the total number of requests of the server during the monitoring period is less than or equal to the minimum total number of requests; the total number of requests is the sum of the total number of requests; the working state includes an on state and an off state; In response to the working state being the closed state, the activator is controlled to output an automatic capacity expansion request, and returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue; the automatic capacity expansion request is used to request that the current capacity state be controlled to the minimum capacity state.
3. The method according to claim 2, characterized in that The querying of the working status of the activator further includes: In response to the working state being the on state, return to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue.
4. The method according to claim 1, characterized in that The determining the current capacity state of the server according to each of the request amounts and the corresponding load amount includes: Counting the total number of requests and the total number of loads; wherein the total number of requests is the sum of the number of requests; the total number of loads is the sum of the number of loads; In response to the total request amount being greater than a first preset total request amount or the total load amount being greater than a first preset total load amount, determining that the current capacity state is the state to be expanded; In response to the total request amount being less than or equal to the second preset request amount and the total load amount being less than the second preset load amount, the current capacity state is determined to be the to-be-reduced state; wherein the second preset request amount is less than the first preset request amount; and the second preset load amount is less than the first preset load amount.
5. The method according to claim 1, characterized in that Different target service versions are identified by version identification numbers or version labels.
6. The method according to claim 1, characterized in that The execution of the dynamic expansion strategy includes: The current capacity of the server is increased by the preset capacity, and the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue is returned until the current capacity state is switched from the to-be-expanded state to the normal state.
7. The method according to claim 6, characterized in that The execution of the dynamic shrinking strategy includes: The current capacity is reduced by the preset capacity, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the to-be-reduced state to the normal state.
8. The method according to claim 1, characterized in that The execution of the dynamic expansion strategy includes: Calculate the target increase and the target number of expansion nodes; wherein the target increase is the ratio of the first target total request difference to the first target total request; the first target total request difference is the difference between the second target total request and the first target total request; the second target total request is the sum of the requests in the current statistical period; the first target total request is the sum of the requests in the previous statistical weekday; the target number of expansion nodes is the ratio of the first target total request difference to the single node consumption request; the single node consumption request is the maximum request consumed by a single service node; In response to the target increase being greater than the increase threshold, the capacity to be expanded is calculated according to the target number of expansion nodes and the fifth adjustment factor, the current capacity of the server is increased by the capacity to be expanded, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be expanded to the normal state.
9. The method according to claim 1, characterized in that: The execution of the dynamic shrinking strategy includes: Calculate the target reduction and the target number of nodes to be reduced; wherein the target reduction is the ratio of the second target request total difference to the first target request total; the second target request total difference is the difference between the first target request total and the second target request total; the target number of nodes to be reduced is the ratio of the second target request total difference to the single node consumption request amount; In response to the target reduction being greater than a reduction threshold, the capacity to be reduced is calculated according to the target number of nodes to be reduced and the sixth adjustment factor, the current capacity of the server is reduced by the capacity to be reduced, and the process returns to the step of obtaining the request amount and the corresponding load amount of each service node based on the message queue, until the current capacity state is switched from the state to be reduced to the normal state.
10. A device for dynamically adjusting server capacity, characterized in that: The device comprises: A version determination module, configured to determine a target service version in response to a selection operation of a candidate service version of a business service model; wherein the target service version is determined according to a result of the selection operation; An information acquisition module, used to determine a corresponding message queue according to the target service version, and acquire a request amount and a corresponding load amount of each service node based on the message queue; A state judgment module, used to judge the current capacity state of the server according to each of the request amounts and the corresponding load amount; wherein the current capacity state includes a state to be expanded, a state to be reduced, and a normal state; A dynamic capacity expansion module, configured to execute a dynamic capacity expansion strategy in response to the current capacity state being the to-be-expanded state, so as to switch the current capacity state from the to-be-expanded state to the normal state; A dynamic capacity reduction module, configured to execute a dynamic capacity reduction strategy in response to the current capacity state being the to-be-reduced capacity state, so as to switch the current capacity state from the to-be-reduced capacity state to the normal state; Wherein, the state judgment module includes a second judgment unit; The second judgment unit is used to calculate the average request amount according to each of the request amounts, and to calculate the total load according to each of the load amounts; wherein the average request amount is the average value of each of the request amounts; and the total load is the sum of the total loads; the second judgment unit is used to calculate the first request amount threshold according to the average request amount and the first adjustment factor, and to calculate the second request amount threshold according to the average request amount and the second adjustment factor; wherein the first adjustment factor is less than the second adjustment factor; the second judgment unit is used to calculate the first load threshold according to the maximum load amount and the third adjustment factor, and to calculate the second load threshold according to the maximum load amount and the fourth adjustment factor; wherein the third adjustment factor is greater than the fourth adjustment factor; the second judgment unit is used to determine that the current capacity state is the to-be-expanded state in response to the existence of the request amount being greater than the first request amount threshold or the total load being greater than the first load threshold; the second judgment unit is used to determine that the current capacity state is the to-be-reduced state in response to the existence of the request amount being less than the second request amount threshold and the total load being less than the second load threshold.
11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Improvements in and relating to service oriented architecture
CN101288091A
AI-as-a-service implementation method and device, medium and equipment
CN116048734A
