Service resource adjustment method and server

By obtaining the resource usage of the target service in the cloud platform cluster, determining the resource recommendation amount and making reasonable adjustments, the abnormal problems caused by service resource adjustment in traditional methods are solved, and the stability and continuity of services are achieved.

CN120295751APending Publication Date: 2025-07-11青岛聚看云科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510156898.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-12
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

Traditional service resource adjustment methods may cause service operation abnormalities in cloud platform cluster environments, including request interruptions and service instability, especially when resources are insufficient or the amount of resources is increased, new Pod instances cannot be scheduled.

Method used

By obtaining the current and historical resource usage of the target service in the server cluster, determining the resource recommendation, and adjusting the resource allocation amount according to the resource usage ratio, avoiding restarting the service when increasing or decreasing the resource amount, or restarting the service when necessary to avoid insufficient resources.

Benefits of technology

It effectively avoids interruptions and instability caused by service resource adjustment, ensures the continuity and stability of service operation, and improves the rationality and efficiency of resource adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295751A_ABST
    Figure CN120295751A_ABST
Patent Text Reader

Abstract

The invention discloses a service resource adjustment method and a server. The method comprises the following steps: acquiring the resource usage amount of a target service in a server cluster at a current moment and at least one historical moment; according to the resource usage amount of at least one historical moment, determining a resource recommendation amount; determining resource adjustment information according to the ratio of the resource usage amount to the resource allocation amount of the target service at the current moment; under the condition that the resource adjustment information represents that the resource amount is increased, the resource allocation amount of the target service is increased according to the resource recommendation amount and the residual resource amount after the server where the target service is located provides resources for the service configured on the server; and under the condition that the resource adjustment information represents that the resource amount is reduced and the resource usage amount at the current moment is greater than the resource recommendation amount, restarting the target service, and determining the resource recommendation amount as the resource allocation amount of the restarted target service. By adopting the method, the resources of the service can be automatically adjusted, and the situation of service abnormity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and in particular, to a service resource adjustment method and a server. Background Art

[0002] In a cloud platform cluster environment, for example, a container cloud cluster based on Kubernetes, service resources often need to be adjusted as the business develops. For example, when the traffic scale increases, the resource amount needs to be increased; when the traffic scale decreases, the resource amount needs to be decreased.

[0003] In traditional service resource adjustment methods, it is necessary to first delete the old Pod instances and then create new Pod instances. The creation process of new Pod instances needs to go through a series of processes such as scheduling, pulling images, mounting storage, creating containers, starting containers, and passing health checks. During the creation process, service requests may be interrupted, affecting service continuity. If the server resources are insufficient, new Pod instances may not be schedulable, affecting service stability. Therefore, traditional service resource adjustment methods may cause problems with abnormal service operation. Summary of the Invention

[0004] This application provides a service resource adjustment method and a server to solve the problem of abnormal service operation caused by service resource adjustment.

[0005] In a first aspect, some embodiments provide a service resource adjustment method, the method including:

[0006] Obtain the resource usage of a target service in a server cluster at the current moment and at least one historical moment;

[0007] Determine a resource recommendation amount according to the resource usage at at least one historical moment;

[0008] Determine resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount;

[0009] In the case where the resource adjustment information indicates an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommendation amount and the remaining resources of the server where the target service is located after configuring resources for the services on itself;

[0010] In the case where the resource adjustment information indicates a decrease in the resource amount and the resource usage at the current moment is greater than the resource recommendation amount, restart the target service and determine the resource recommendation amount as the resource allocation amount of the restarted target service.

[0011] Technical effects: Some embodiments provide a service resource adjustment method. By obtaining the resource usage of a target service in the server cluster at the current moment and at least one historical moment, and determining a resource recommendation amount based on the resource usage at at least one historical moment, the resource recommendation amount can reflect the historical resource usage of the target service. Performing service resource adjustment based on the resource recommendation amount helps to avoid abnormal service operation caused by service resource adjustment. Additionally, determining resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount. When the resource adjustment information indicates an increase in the resource amount, increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resources of the server where the target service is located after providing resources for the services configured on itself. This method of directly increasing the resource allocation amount when the resource amount needs to be increased avoids the service interruption problem caused by restarting the service. When the resource adjustment information indicates a decrease in the resource amount and the resource usage at the current moment is greater than the resource recommendation amount, restarting the target service and determining the resource recommendation amount as the resource allocation amount of the restarted target service. This method of restarting the target service when the resource amount needs to be decreased and the resource usage is large avoids the service instability problem caused by insufficient service resources. Therefore, adopting this method helps to solve the problem of abnormal service operation caused by service resource adjustment.

[0012] In a second aspect, some embodiments further provide a server. The server includes a processor; the processor includes a resource recommendation service and a resource adjustment control service, where:

[0013] The resource recommendation service is configured to obtain the resource usage of a target service in the server cluster at the current moment and at least one historical moment; and determine a resource recommendation amount based on the resource usage at at least one historical moment;

[0014] The resource adjustment control service is configured to determine resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount;

[0015] The resource adjustment control service is further configured to, when the resource adjustment information indicates an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommendation amount and the remaining resources of the server where the target service is located after providing resources for the services configured on itself; and when the resource adjustment information indicates a decrease in the resource amount and the resource usage at the current moment is greater than the resource recommendation amount, restart the target service and determine the resource recommendation amount as the resource allocation amount of the restarted target service.

[0016] Technical effects: Some embodiments provide a server. The server includes a processor. The resource recommendation service of the processor determines a resource recommendation amount by obtaining the resource usage amounts of a target service at the current moment and at least one historical moment in a server cluster, and determines the resource recommendation amount based on the resource usage amounts at at least one historical moment. The resource recommendation amount can reflect the historical resource usage situation of the target service. Based on the resource recommendation amount, service resource adjustment is performed, which helps to avoid service operation anomalies caused by service resource adjustment. At the same time, the resource adjustment control service of the processor determines resource adjustment information according to the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment. When the resource adjustment information indicates an increase in the resource amount, according to the resource recommendation amount and the remaining resource amount on the server where the target service is located after providing resources for the services configured on itself, the resource allocation amount of the target service is increased. This method of directly increasing the resource allocation amount when the resource amount needs to be increased avoids the service interruption problem caused by restarting the service. In addition, when the resource adjustment information indicates a decrease in the resource amount and the resource usage amount at the current moment is greater than the resource recommendation amount, the resource adjustment control service restarts the target service and determines the resource recommendation amount as the resource allocation amount of the restarted target service. This method of restarting the target service when the resource amount needs to be decreased and the resource usage amount is large avoids the service instability problem caused by insufficient service resources. Therefore, this server helps to solve the problem of service operation anomalies caused by service resource adjustment. Brief Description of the Drawings

[0017] To more clearly illustrate the technical solutions in the embodiments of the present application or in the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0018] Figure 1 It is a schematic diagram of data interaction between a display device and a server provided by some embodiments of the present application;

[0019] Figure 2 It is a schematic flowchart of creating a Pod instance provided by some embodiments of the present application;

[0020] Figure 3 It is a schematic flowchart of a service resource adjustment method provided by some embodiments of the present application;

[0021] Figure 4 It is a schematic diagram of the composition of a server provided by some embodiments of the present application;

[0022] Figure 5 It is a schematic flowchart of creating a Pod instance provided by some other embodiments of the present application;

[0023] Figure 6 Schematic diagram of the sub - process of S400 provided for some embodiments of this application;

[0024] Figure 7 Schematic diagram of the sub - process of S200 provided for some embodiments of this application;

[0025] Figure 8 Schematic diagram of the sub - process of S100 provided for some embodiments of this application;

[0026] Figure 9 Schematic diagram of the process of the service resource adjustment method provided for some other embodiments of this application;

[0027] Figure 10 Internal structure diagram of the computer device provided for some embodiments of this application. Detailed implementation mode

[0028] The embodiments will be described in detail below, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation modes described in the following embodiments do not represent all implementation modes consistent with this application. They are only examples of systems and methods consistent with some aspects of this application detailed in the claims.

[0029] It should be noted that the brief description of the terms in this application is only for facilitating the understanding of the following described implementation modes, rather than intending to limit the implementation modes of this application. Unless otherwise specified, these terms should be understood in their ordinary and common meanings.

[0030] The terms "first", "second", "third", etc. in the specification, claims and above - mentioned drawings of this application are used to distinguish similar or like objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that such terms can be interchanged under appropriate circumstances.

[0031] The terms "comprising" and "having" and any variations thereof are intended to cover but not exclusively include. For example, a product or device comprising a series of components does not necessarily have to be limited to all the clearly listed components, but may include other components not clearly listed or inherent to these products or devices.

[0032] The term "module" refers to any known or later - developed hardware, software, firmware, artificial intelligence, fuzzy logic or a combination of hardware or / and software code that can perform functions related to that element.

[0033] In the embodiments of the present application, the display device 200 generally refers to a device with the capabilities of screen display and data processing. For example, the display device 200 includes, but is not limited to, smart TVs, mobile terminals, computers, monitors, advertising screens, wearable devices, virtual reality devices, augmented reality devices, etc.

[0034] Figure 1 FIG. is a schematic diagram of data interaction between a display device and a server provided in some embodiments of the present application. As Figure 1 shown, the display device 200 and the server 400 perform data communication through various communication methods. The display device 200 is allowed to communicate and connect through a local area network (LAN), a wireless local area network (WLAN), and other networks.

[0035] As Figure 1 also shown, the user can operate the display device 200 through touch operations, a mobile terminal 300, and a control device 100. For example, the control device 100 can be a remote control, a stylus, a gamepad, etc.

[0036] The mobile terminal 300 can be used as a control device for performing human-computer interaction between the user and the display device 200. The mobile terminal 300 can also be used as a communication device for establishing a communication connection with the display device 200 to perform data interaction. In some embodiments, the mobile terminal 300 and the display device 200 can install software applications and achieve connection communication through a network communication protocol to achieve the purpose of one-to-one control operations and data communication. It is also possible to transmit the audio and video content displayed on the mobile terminal 300 to the display device 200 to achieve a synchronous display function.

[0037] The display device 200 can provide a broadcast receiving TV function and can also additionally provide a smart network TV function with computer support functions, including but not limited to, network TV, smart TV, Internet Protocol TV (IPTV), etc.

[0038] In the rapid development of cloud computing and distributed systems, as a mainstream container orchestration platform, the resource management ability of Kubernetes is mainly realized through Pod specification definitions. In traditional solutions, when adjusting service resources, the service needs to be updated, and the corresponding Pod instances of the service need to be deleted and new instances need to be created. The creation process of new Pod instances needs to go through a series of processes such as scheduling, pulling images, mounting storage, creating containers, starting containers, and passing health checks. Refer to Figure 2Schematic diagram of the process of creating a Pod instance. The user initiates an instance creation request by executing the kubectl command through the request initiation module and authenticates through kuberconfig; through the watch interface of the scheduling module, the binding information of the Pod instance and the server is passed to the interface service unit (for example, it can be the API Server), and the binding information of the Pod instance and the server is written into the storage unit etcd through the interface service unit; at the same time, the scheduling module hands the Pod to the kubelet module of the corresponding server to run, and the kubelet module creates a Pod network by calling the first interface (for example, the CNI interface), creates and starts a container by calling the second interface (for example, the CRI interface), and if there is a mounted volume, calls the third interface (for example, the CSI interface) to create the mounting of the volume, thus realizing the creation of the Pod instance. As can be seen from Figure 2 it, there may be service interruptions during the service update period, thus affecting service continuity. In addition, new Pods need to pull images again during the service update period, which will also cause pressure on the nodes and the image repository. If the server resources are insufficient, new Pod instances may not be schedulable, affecting service stability. Therefore, the traditional service resource adjustment method may cause problems with abnormal service operation.

[0039] To address the above problems, public cloud providers offer the function of in-place Pod upgrade, that is, users can adjust service resources according to their needs without restarting the Pod. However, this method requires creating a resource type different from the Kubernetes native resources. If users need to use this in-place upgrade capability, they need to transform the service into the corresponding resource type. For a server cluster that has already extensively used Kubernetes native resources, users need to delete all services and then create services using the resource types provided by public cloud providers. Therefore, there are problems such as complex service resource adjustment and non-support for Kubernetes native resources.

[0040] In addition, Kubernetes also provides the ability to update service resources in-place for Pods, which can support service resource adjustment for services created with Kubernetes native resources. However, this method has the following defects: 1. The service resources only support one adjustment strategy, that is, to adjust service resources by restarting the container or not restarting the container. In the case of needing to increase service resources, restarting the container to adjust service resources may cause request interruption, affecting service continuity; in the case of needing to reduce service resources, directly adjusting service resources without restarting the container may cause insufficient service resources, resulting in new Pod instances possibly not being schedulable, affecting service stability. 2. There is no theoretical basis for the quantity of service resource adjustment. If users adjust service resources arbitrarily, it is very likely to cause service anomalies.

[0041] Based on this, embodiments of the present application propose a service resource adjustment method and a server. By obtaining the resource usage of a target service in the server cluster at the current moment and at least one historical moment, and determining a resource recommendation amount according to the resource usage at at least one historical moment, the resource recommendation amount can reflect the historical resource usage of the target service. Adjusting the service resources based on the resource recommendation amount helps to avoid abnormal service operation caused by service resource adjustment. Additionally, determine the resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount. When the resource adjustment information indicates an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommendation amount and the remaining resources of the server where the target service is located after providing resources for the services configured on itself. This method of directly increasing the resource allocation amount when the resource amount needs to be increased avoids the service interruption problem caused by restarting the service. When the resource adjustment information indicates a decrease in the resource amount and the resource usage at the current moment is greater than the resource recommendation amount, restart the target service and determine the resource recommendation amount as the resource allocation amount of the restarted target service. This method of restarting the target service when the resource amount needs to be decreased and the resource usage is large avoids the service instability problem caused by insufficient service resources. Therefore, adopting this method helps to solve the problem of abnormal service operation caused by service resource adjustment.

[0042] As Figure 3 shown is a schematic flowchart of a service resource adjustment method provided by some embodiments of the present application. In embodiments of the present application, the service resource adjustment method can be applied to a terminal or a server, or can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. This embodiment takes the application of this method to a server as an example for illustration, including the following S100 to S400, where:

[0043] S100. Obtain the resource usage of the target service in the server cluster at the current moment and at least one historical moment.

[0044] Among them, the server cluster refers to the server cluster of the cloud platform. For example, it can be a container cloud cluster based on Kubernetes. The server cluster includes multiple servers. Each server can be configured with at least one service, and each server provides service resources for the services configured by itself to support the operation of the services. The services configured in the server are the abstraction layers in Kubernetes, which define a logical set and the policy for accessing the services. The service allows access to a group of application programs running on one or more Pods. The service provides a stable access entry for the Pods, that is, accessing the entry address provided by the service on any server can access the Pod instances in the service. A container is a lightweight virtualization technology that packages an application program and its dependencies in an independent running environment and is a component of a Pod instance. A Pod instance is the smallest deployable and manageable unit in a Kubernetes-based container cloud cluster. It is a collection of a group of closely related containers, and these containers share network and storage resources. The Pod instances are scheduled to run on the servers, and a server can run multiple Pod instances.

[0045] The target service is the service in the server cluster that needs to be monitored for resources. The resources to be monitored include but are not limited to memory and CPU. The resource usage amount refers to the amount of resources used by the target service at a specific moment. At the same moment, there is at least one service in the server cluster that needs to be monitored for resources. This application takes any target service that needs to be monitored for resources in the server cluster as an example for illustration.

[0046] The current moment refers to the moment when the processor obtains the resource usage amount. For example, the processor can set to start from a preset moment and determine multiple acquisition moments at a preset time interval. When the current moment is any acquisition moment, the processor obtains the resource usage amounts of the target service at the current moment and at least one historical moment.

[0047] The historical moment is earlier than the current moment. The processor can obtain the resource usage amounts of the target service at all historical moments in the time period earlier than the current moment, and then flexibly select the resource usage amounts at multiple historical moments according to requirements. Alternatively, the processor can also pre-select the recording moments, obtain the resource usage amounts of the target service at the recording moments, and use the resource usage amounts obtained at each recording moment as the resource usage amounts at at least one historical moment.

[0048] In some embodiments, as Figure 4 shown is the schematic diagram of the composition of the server provided by some embodiments of this application. Among them, a resource recommendation service 401 is deployed in the processor, which is used to obtain the resource usage amounts of the target service in the server cluster at the current moment and at least one historical moment.

[0049] S200. Determine a resource recommendation amount based on the resource usage amounts at at least one historical moment.

[0050] Among them, the resource recommendation amount is used to adjust the resources for the target service. The processor determines the resource recommendation amount based on the resource usage amounts at at least one historical moment, and the resource recommendation amount can reflect the resource usage situation of the target service at at least one historical moment. Exemplarily, the processor can use the average value, median value, or mode, etc. of the resource usage amounts at at least one historical moment as the resource recommendation amount. In this way, the resource recommendation amount can be based on the resource usage situation at the historical moment, and it is highly reasonable to adjust the service resources based on the resource recommendation amount. Compared with the user's arbitrary adjustment of service resources, it is beneficial to avoid service anomalies.

[0051] In some embodiments, refer to Figure 4 , the resource recommendation service 401 is responsible for determining the resource recommendation amount based on the resource usage amounts at at least one historical moment.

[0052] S300. Determine resource adjustment information based on the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment.

[0053] Among them, the resource allocation amount refers to the quantity of resources allocated by the server to the target service. The resource amounts allocated to each service in the server may be different. Since the processor may adjust the resource allocation amounts of various services, the processor should obtain the resource allocation amount of the target service at the current moment.

[0054] The ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is used to represent the usage ratio of resources in the allocation amount. The maximum value of the resource usage amount is the resource allocation amount.

[0055] The resource adjustment information is used to represent whether the resource amount needs to be adjusted. When the resource amount needs to be adjusted, the resource adjustment information can include either increasing the resource amount or decreasing the resource amount. For example, when the traffic scale increases, the resource adjustment information can be to increase the resource amount; when the traffic scale decreases, the resource adjustment information can be to decrease the resource amount; when the traffic scale remains unchanged, the resource adjustment information can be to keep the resource amount unchanged.

[0056] In some embodiments, refer to Figure 4 , the processor further includes a resource adjustment control service 402, which is used to determine the resource adjustment information based on the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment.

[0057] S400. When the resource adjustment information indicates an increase in the amount of resources, increase the resource allocation amount of the target service according to the resource recommended amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; when the resource adjustment information indicates a decrease in the amount of resources and the resource usage amount at the current moment is greater than the resource recommended amount, restart the target service and determine the resource recommended amount as the resource allocation amount of the restarted target service.

[0058] Among them, in some embodiments, referring to Figure 4 , the resource adjustment control service 402 is further configured to perform automatic resource adjustment, including when the resource adjustment information indicates an increase in the amount of resources, increasing the resource allocation amount of the target service according to the resource recommended amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; when the resource adjustment information indicates a decrease in the amount of resources and the resource usage amount at the current moment is greater than the resource recommended amount, restart the target service and determine the resource recommended amount as the resource allocation amount of the restarted target service.

[0059] At least one service is configured in the server where the target service is located, and the server allocates resources to each service respectively. The resource usage amount of each service is often lower than the resource allocation amount provided by the server for the service. Therefore, there are usually some remaining unused resources in the server. The remaining resource amount corresponding to each service is the difference between the resource allocation amount and the resource usage amount of the service. The processor sums up the remaining resource amounts corresponding to all services in the server to obtain the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself.

[0060] When the resource adjustment information indicates an increase in the amount of resources, the processor can increase the resource allocation amount of the target service according to the resource recommended amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself. In this case where an increase in the amount of resources is required, directly increasing the resource allocation amount of the target service without restarting the service is beneficial to avoiding problems such as service interruption and mirror library pressure caused by restarting the service, and is beneficial to ensuring the continuity of service operation; in addition, the adjustment of the resource allocation amount is based on the resource recommended amount and the remaining resource amount, ensuring the rationality of resource adjustment and avoiding problems such as resource waste caused by excessive resource allocation or abnormal service operation caused by insufficient resource allocation.

[0061] That the resource usage amount at the current moment is greater than the resource recommended amount indicates that the target service needs to use more resources at the current moment. If the resource allocation amount of the target service is directly reduced to the resource recommended amount, problems such as Pod instances being unable to be scheduled may occur. Therefore, when the resource adjustment information indicates an increase in the amount of resources, it is necessary to further consider whether the resource usage amount at the current moment is greater than the resource recommended amount.

[0062] When the resource adjustment information indicates a reduction in the amount of resources and the resource usage at the current moment is greater than the recommended resource amount, the processor needs to restart the target service and determine the recommended resource amount as the resource allocation amount for the restarted target service to avoid service anomalies caused by directly adjusting resources.

[0063] Restarting the target service mainly involves restarting the Pod instance corresponding to the target service. As Figure 5 shown is a schematic flowchart of creating a Pod instance provided by some other embodiments of the present application. Among them, the processor includes a Pod instance creation module, including a control unit (for example, it can be a VPA Conteoller), an interface service unit (for example, it can be an API Server), an aggregator (for example, it can be a Metrics Server), a historical data storage unit, a Pod creation unit, etc. The interface service unit is used to obtain a Pod instance creation request through the aggregator, and the request carries the amount of resources required for the Pod instance; the historical data storage unit is used to store the request and the corresponding amount of resources; the control unit calculates the recommended amount in response to the Pod instance creation request and sends it to the Pod creation unit; the Pod creation unit is used to create a Pod instance that matches the recommended amount.

[0064] In the embodiments of the present application, by obtaining the resource usage of the target service in the server cluster at the current moment and at least one historical moment, and determining the recommended resource amount according to the resource usage at at least one historical moment, the recommended resource amount can reflect the historical resource usage of the target service. Adjusting the service resources based on the recommended resource amount is beneficial to avoiding service operation anomalies caused by service resource adjustment; in addition, determining the resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount, when the resource adjustment information indicates an increase in the amount of resources, increasing the resource allocation amount of the target service according to the recommended resource amount and the remaining resources of the server where the target service is located after providing resources for the services configured on itself. This method of directly increasing the resource allocation amount when the amount of resources needs to be increased avoids the problem of service interruption caused by restarting the service; when the resource adjustment information indicates a reduction in the amount of resources and the resource usage at the current moment is greater than the recommended resource amount, restarting the target service and determining the recommended resource amount as the resource allocation amount for the restarted target service. This method of restarting the target service when the amount of resources needs to be reduced and the resource usage is large avoids the problem of service instability caused by insufficient service resources; therefore, adopting this method is beneficial to solving the problem of service operation anomalies caused by service resource adjustment.

[0065] In some embodiments, as Figure 6 shown, increasing the resource allocation amount of the target service according to the recommended resource amount and the remaining resources of the server where the target service is located after providing resources for the services configured on itself includes:

[0066] S602. Determine the resource adjustment amount according to the resource recommendation amount and the resource allocation amount;

[0067] S604. When the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is not less than the resource adjustment amount, increase the resource allocation amount of the target service to the resource recommendation amount.

[0068] Wherein, the resource adjustment amount refers to the amount of resources required to increase the current resource allocation amount of the target service to the resource recommendation amount. The processor may use the difference between the resource recommendation amount and the resource allocation amount as the resource adjustment amount.

[0069] The remaining resource amount of the server where the target service is located after providing resources for the services configured on itself not being less than the resource adjustment amount indicates that the remaining resource amount of the server is sufficient to adjust the resources of the target service. Therefore, when the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is not less than the resource adjustment amount, the processor increases the resource allocation amount of the target service to the resource recommendation amount.

[0070] For example, if the resource allocation amount of the target service at the current moment is 100, the resource usage amount is 90, the resource recommendation amount is 120, and the remaining resource usage amount is 40, the resource allocation amount can be directly adjusted to 120 to ensure the normal operation of the service.

[0071] In the embodiments of the present application, when the processor needs to increase the resource amount, it compares the remaining resource amount of the server with the resource adjustment amount. When it is determined that the remaining resource amount is sufficient to adjust the resources of the target service, it directly increases the resource allocation amount of the target service to the resource recommendation amount. Without restarting the service, it is beneficial to avoid problems such as service interruption and mirror library pressure caused by restarting the service, and is beneficial to ensuring the continuity of service operation; in addition, the adjustment of the resource allocation amount is based on the resource recommendation amount and the remaining resource amount, which is beneficial to avoiding problems such as abnormal service operation caused by unreasonable resource allocation.

[0072] In some embodiments, the service resource adjustment method further includes: when the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is less than the resource adjustment amount, return to the step of obtaining the resource usage amounts of the target service at the current moment and at least one historical moment in the server cluster and continue to execute until the updated resource adjustment information indicates an increase in the resource amount, and the updated remaining resource amount is not less than the updated resource adjustment amount, then increase the resource allocation amount of the target service to the updated resource recommendation amount.

[0073] Among them, the remaining resource volume of the server where the target service is located after configuring resources for the services on itself is less than the resource adjustment volume, indicating that the remaining resource volume of the server is insufficient to adjust the resources of the target service. Therefore, the processor can wait for the next resource adjustment cycle. In the new resource adjustment cycle, if the updated resource adjustment information indicates an increase in the resource volume and the updated remaining resource volume is not less than the updated resource adjustment volume, the resource allocation volume of the target service is increased to the updated resource recommendation volume to achieve automatic resource adjustment.

[0074] For example, the resource allocation volume of the target service at the current moment is 100, the resource usage volume is 90, the resource recommendation volume is 120, and the remaining resource usage volume is 20. Then, it is necessary to wait for the next resource adjustment cycle again. If the remaining resource volume in the new resource adjustment cycle exceeds 30, the resource allocation volume can be adjusted to 120.

[0075] In the embodiments of the present application, when the processor needs to increase the resource volume, if the remaining resource volume of the server is insufficient to adjust the resources of the target service, it waits for the next resource adjustment cycle without restarting the service, avoiding service interruption. At the same time, when the resource adjustment conditions are met in the new resource adjustment cycle, automatic resource adjustment is performed, which is beneficial to ensuring the continuity of the service.

[0076] In some embodiments, the service resource adjustment method further includes: when the resource adjustment information indicates a decrease in the resource volume and the resource usage volume at the current moment is not greater than the resource recommendation volume, reducing the resource allocation volume of the target service to the resource recommendation volume.

[0077] Among them, the resource usage volume at the current moment not being greater than the resource recommendation volume indicates that the target service needs less resource volume at the current moment. If the resource allocation volume of the target service is reduced to the resource recommendation volume, it does not affect the normal operation of the service. Therefore, when the resource adjustment information indicates a decrease in the resource volume and the resource usage volume at the current moment is not greater than the resource recommendation volume, the processor reduces the resource allocation volume of the target service to the resource recommendation volume.

[0078] For example, the resource allocation volume of the target service at the current moment is 100, the resource usage volume is 15, and the resource recommendation volume is 40. The resource allocation volume can be directly adjusted to 40, which can ensure the normal operation of the service.

[0079] In the embodiments of the present application, when the resource adjustment information indicates a decrease in the resource volume and the resource usage volume at the current moment is not greater than the resource recommendation volume, the processor directly reduces the resource allocation volume of the target service to the resource recommendation volume without restarting the service, which does not affect the normal operation of the service and avoids problems such as service interruption and mirror library pressure caused by restarting the service.

[0080] In some embodiments, such asFigure 7 As shown, determining a resource recommendation amount according to the resource usage amounts at at least one historical moment includes:

[0081] S702, sorting the resource usage amounts at at least one historical moment in ascending order.

[0082] S704, determining multiple target resource usage amounts that are sorted within a preset range among the sorted multiple resource usage amounts.

[0083] S706, determining a resource recommendation amount based on the multiple target resource usage amounts.

[0084] Wherein, in order to ensure that the resource recommendation amount can cover the resource usage amounts at most historical moments, the embodiments of the present application propose to sort the resource usage amounts at at least one historical moment in ascending order, and select multiple target resource usage amounts that are sorted within a preset range among the sorted multiple resource usage amounts. The preset range is a continuous position interval, which can be flexibly selected according to actual needs. For example, the middle position range (e.g., 5% to 95% range), or the position range close to the minimum value (e.g., 0 to 99% range), or the resource usage amounts in the position range close to the maximum value (e.g., 1 to 100% range), etc. can be selected.

[0085] The processor determines the resource recommendation amount based on the multiple target resource usage amounts, and can use the average value, median, or mode, etc. of the multiple target resource usage amounts as the resource recommendation amount.

[0086] In the embodiments of the present application, the processor sorts the resource usage amounts at at least one historical moment in ascending order, and selects multiple target resource usage amounts that are sorted within a preset range therefrom, which is beneficial to ensuring that the multiple target resource usage amounts can cover the resource usage amounts at most historical moments. Determining the resource recommendation amount based on the multiple target resource usage amounts is beneficial to ensuring that the resource recommendation amount can reflect the resource usage situation at historical moments and improving the rationality of resource adjustment based on the resource recommendation amount.

[0087] In some embodiments, determining resource adjustment information according to the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment includes: when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is less than a first preset ratio, determining that the resource adjustment information represents a reduction in the resource amount; when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is greater than a second preset ratio, determining that the resource adjustment information represents an increase in the resource amount; the first preset ratio is less than the second preset ratio.

[0088] Among them, the ratio between the resource usage amount and the resource allocation amount of the target service at the same moment should be less than 1. The larger the ratio, the more resources are used, indicating that there may be an increase in traffic; the smaller the ratio, the fewer resources are used, indicating that there may be a decrease in traffic.

[0089] The processor is pre-set with a first preset ratio and a second preset ratio, both of which are less than 1, and the first preset ratio is less than the second preset ratio. For example, the first preset ratio can be 20%, and the second preset ratio can be 80%.

[0090] When the ratio is less than the first preset ratio, the processor determines that the resource adjustment information represents a reduction in the resource amount; when the ratio is greater than the second preset ratio, the processor determines that the resource adjustment information represents an increase in the resource amount. For example, when the ratio is 15%, the processor determines that the resource adjustment information represents a reduction in the resource amount; when the ratio is 90%, the processor determines that the resource adjustment information represents an increase in the resource amount.

[0091] In the embodiments of the present application, the processor determines the resource adjustment information by comparing the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment with the first preset ratio or the second preset ratio. When the ratio is less than the first preset ratio, it indicates that less resources are used and the resource amount needs to be reduced; when the ratio is greater than the second preset ratio, it indicates that more resources are used and the resource amount needs to be increased. This method of determining the resource adjustment information is beneficial to promptly identifying the services that require resource adjustment.

[0092] In some embodiments, as Figure 8 shown, obtaining the resource usage amounts of the target service in the server cluster at the current moment and at least one historical moment includes:

[0093] S802, in response to a service resource monitoring request, determine the target service to be monitored and the monitoring time interval in the server cluster;

[0094] S804, according to the monitoring time interval, obtain the resource usage amounts of the target service at the current moment and at least one historical moment.

[0095] Among them, the processor can monitor the resource usage amount of the target service according to the preset monitoring time interval. The service resource monitoring request is a request initiated by the user to the server for monitoring the target service. In some embodiments, the service monitoring request carries the service identifier of the target service to be monitored and the monitoring time interval, and the processor determines the target service to be monitored and the monitoring time interval by parsing the service monitoring request.

[0096] The processor obtains the resource usage of the target service at the current moment and at least one historical moment according to the monitoring time interval. The processor takes the moment when the service resource monitoring request is received as the starting moment, determines multiple acquisition moments according to the monitoring time interval, and when the current moment is any acquisition moment, obtains the resource usage of the target service at the current moment and at least one historical moment.

[0097] Exemplarily, the historical moments can be multiple moments within one week before the current moment. The monitoring time interval can be 2 seconds.

[0098] In some embodiments, referring to Figure 4 , the processor further includes a resource management service 403, which is used to store at least one of the resource recommendation value, resource usage, resource adjustment information, resource allocation amount of the target service at the current moment, and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself in the database.

[0099] In some embodiments, the service resource monitoring request is used to indicate the monitoring of all services in the server cluster to obtain the resource usage of each service at the current moment and at least one historical moment; the resource management service 403 is further used to summarize and statistically analyze the resource usage of each service according to the subsystem dimension, tenant dimension, cluster dimension, node dimension, etc. The resource usage includes at least one of the resource recommendation value, resource usage, resource adjustment information, resource allocation amount of each service at the current moment, and the remaining resource amount of the server where the service is located after providing resources for the services configured on itself. Among them, the subsystem dimension refers to all services under the entire namespace, the tenant dimension refers to the services corresponding to a single tenant, the cluster dimension refers to all services under the entire server cluster, and the node dimension refers to the services corresponding to a single server.

[0100] In the embodiments of the present application, the processor responds to the service resource monitoring request and monitors the resource usage based on the target service and the monitoring time interval indicated by the service resource monitoring request. The service resource monitoring request can be initiated according to user needs, improving the flexibility of monitoring the target service.

[0101] In some embodiments, the service resource adjustment method further includes: before increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself, adding the target service to the resource increase work queue; when taking out the target service from the resource increase work queue, performing the step of increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself.

[0102] In some embodiments, the service resource adjustment method further includes: before restarting the target service and determining the resource recommended amount as the resource allocation amount for the restarted target service, adding the target service to the resource reduction work queue; when taking out the target service from the resource reduction work queue, performing the steps of restarting the target service and determining the resource recommended amount as the resource allocation amount for the restarted target service.

[0103] In the above embodiments, by adding the target service that needs to increase resources and the target service that needs to reduce resources to the corresponding work queues respectively, it is convenient to adjust the resources of each service in the work queues sequentially in order.

[0104] The embodiments of the present application also provide a server. The implementation solutions for solving problems provided by this server are similar to the implementation solutions described in the above method. Therefore, the specific limitations in one or more of the following server embodiments can refer to the limitations on the service resource adjustment method in the above text, and will not be elaborated here.

[0105] In some embodiments, the server includes a processor for executing the above service resource adjustment method. Refer to Figure 4 , the processor includes a resource recommendation service and a resource adjustment control service, where:

[0106] The resource recommendation service is used to obtain the resource usage amounts of the target service in the server cluster at the current moment and at least one historical moment; determine the resource recommended amount according to the resource usage amounts at at least one historical moment;

[0107] The resource adjustment control service is used to determine the resource adjustment information according to the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment;

[0108] The resource adjustment control service is further used to, when the resource adjustment information indicates an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommended amount and the remaining resource amount on the server where the target service is located after providing resources for the services configured on itself; when the resource adjustment information indicates a decrease in the resource amount and the resource usage amount at the current moment is greater than the resource recommended amount, restart the target service and determine the resource recommended amount as the resource allocation amount for the restarted target service.

[0109] The above-mentioned server includes a processor. The resource recommendation service of the processor determines the resource recommendation amount by obtaining the resource usage amounts of the target service in the current moment and at least one historical moment in the server cluster, and determines the resource recommendation amount based on the resource usage amounts at at least one historical moment. The resource recommendation amount can reflect the historical resource usage situation of the target service. Adjusting the service resources based on the resource recommendation amount helps to avoid abnormal service operation caused by service resource adjustment. At the same time, the resource adjustment control service of the processor determines the resource adjustment information according to the ratio between the resource usage amount and the resource allocation amount of the target service in the current moment. When the resource adjustment information indicates an increase in the resource amount, the resource allocation amount of the target service is increased according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself. This method of directly increasing the resource allocation amount when the resource amount needs to be increased avoids the service interruption problem caused by restarting the service. In addition, when the resource adjustment information indicates a decrease in the resource amount and the resource usage amount in the current moment is greater than the resource recommendation amount, the resource adjustment control service restarts the target service and determines the resource recommendation amount as the resource allocation amount of the restarted target service. This method of restarting the target service when the resource amount needs to be decreased and the resource usage amount is large avoids the service instability problem caused by insufficient service resources. Therefore, this server helps to solve the problem of abnormal service operation caused by service resource adjustment.

[0110] In some embodiments, the resource adjustment control service is further configured to determine the resource adjustment amount according to the resource recommendation amount and the resource allocation amount; when the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is not less than the resource adjustment amount, increase the resource allocation amount of the target service to the resource recommendation amount.

[0111] In some embodiments, the resource adjustment control service is further configured to, when the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is less than the resource adjustment amount, return to the step of obtaining the resource usage amounts of the target service in the current moment and at least one historical moment in the server cluster and continue to execute until the updated resource adjustment information indicates an increase in the resource amount and the updated remaining resource amount is not less than the updated resource adjustment amount, and then increase the resource allocation amount of the target service to the updated resource recommendation amount.

[0112] In some embodiments, the resource adjustment control service is further configured to, when the resource adjustment information indicates a decrease in the resource amount and the resource usage amount in the current moment is not greater than the resource recommendation amount, decrease the resource allocation amount of the target service to the resource recommendation amount.

[0113] In some embodiments, a resource recommendation amount is determined according to the resource usage amounts at at least one historical moment. The resource recommendation service is further configured to sort the resource usage amounts at at least one historical moment in descending order; determine multiple target resource usage amounts within a preset range among the sorted multiple resource usage amounts; and determine the resource recommendation amount based on the multiple target resource usage amounts.

[0114] In some embodiments, resource adjustment information is determined according to the ratio between the resource usage amount and the resource allocation amount of a target service at the current moment. The resource adjustment control service is further configured to: determine that the resource adjustment information represents a reduction in the resource amount when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is less than a first preset ratio; determine that the resource adjustment information represents an increase in the resource amount when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is greater than a second preset ratio; and the first preset ratio is less than the second preset ratio.

[0115] In some embodiments, the resource usage amounts of a target service in a server cluster at the current moment and at at least one historical moment are obtained. The resource recommendation service is further configured to: in response to a service resource monitoring request, determine the target service to be monitored and the monitoring time interval in the server cluster; and obtain the resource usage amounts of the target service at the current moment and at at least one historical moment according to the monitoring time interval.

[0116] In some embodiments, the server further includes a resource management service; the resource management service is configured to store the resource usage amount and the resource recommendation amount of the target service at the current moment in a database; the resource adjustment control service is further configured to query, through the resource management service, the resource usage amount and the resource recommendation amount of the target service at the current moment from the database, and when the resource adjustment information represents an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; and when the resource adjustment information represents a reduction in the resource amount and the resource usage amount at the current moment is greater than the resource recommendation amount, restart the target service and determine the resource recommendation amount as the resource allocation amount of the restarted target service.

[0117] In some embodiments, the resource management service is further configured to add the target service to a resource increase work queue before increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; the resource adjustment control service is further configured to, when taking out the target service from the resource increase work queue, execute the step of increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself.

[0118] In some embodiments, the resource management service is further configured to add the target service to a resource reduction work queue before restarting the target service and determining the resource recommended amount as the resource allocation amount for the restarted target service; the resource adjustment control service is further configured to, when taking out the target service from the resource reduction work queue, perform the step of restarting the target service and determining the resource recommended amount as the resource allocation amount for the restarted target service.

[0119] Each of the services in the above-mentioned processor can be implemented in whole or in part through software, hardware, and their combination. Each of the above-mentioned modules can be embedded in the processor in the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above-mentioned modules.

[0120] To illustrate the service resource adjustment method and the server in this solution in detail, the following uses a most detailed embodiment for illustration:

[0121] The service resource adjustment method proposed in the embodiments of this application is applied to a server, and the server can be a container cloud cluster based on Kubernetes. The server includes a processor, and the processor includes a resource recommendation service, a resource adjustment control service, and a resource management service. As Figure 9 shown is a schematic flowchart of the service resource adjustment method provided in some other embodiments of this application. The method includes the following steps:

[0122] 1. Deploy the resource recommendation service, which is responsible for listening to all services or target services in the cluster, and calculating a resource recommendation value based on the resource usage of the service at the current moment and at least one historical moment (for example, the actual CPU and memory resource usage of the service in the past week). This resource recommendation value can cover the resource usage of the service at most historical moments (for example, it can cover 99% of the historical moments).

[0123] 2. Develop and deploy the resource management service, which is responsible for storing resource recommendation values, resource usage, etc. at the service level in a database table. It can also perform summary statistics on the resource usage at the subsystem dimension, tenant dimension, cluster dimension, node dimension, etc.

[0124] 3. Develop the resource adjustment control service, which is mainly responsible for automatically adjusting resource configurations and supporting different resource adjustment information for service resources.

[0125] 3.1. The resource adjustment control service supports the service to set different restart information for the same type of resource. For example, when the resource amount needs to be increased, the container is not restarted; when the resource amount needs to be decreased, the container is restarted. Based on the resource usage of the service at the current moment and in combination with the resource recommended amount, it is judged whether the resource adjustment information is to increase the resource amount or decrease the resource amount, and the corresponding restart information is matched.

[0126] 3.2. The resource adjustment control service calls the interface of the resource management service to query the services with too low or too high resource utilization rates in the entire server cluster. Among them, when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is less than the first preset ratio, it is determined that the resource utilization rate of the target service is too low, and the resource adjustment information is determined to indicate a reduction in the resource amount; when the ratio between the resource usage amount and the resource allocation amount of the target service at the current moment is greater than the second preset ratio, it is determined that the resource utilization rate of the target service is too high, and the resource adjustment information is determined to indicate an increase in the resource amount. These services have resource waste or resource shortage and need resource adjustment. These are respectively added to the resource increase work queue and the resource decrease work queue.

[0127] 3.3. The resource adjustment control service takes out services from each work queue one by one for processing. Combining the resource usage amount of the service at the current moment and the resource adjustment value, if the resource adjustment information indicates an increase in the resource amount, it is necessary to simultaneously determine whether the remaining resources of the server where the service Pod is located meet the resource adjustment requirements, that is, when the remaining resources of the server where the target service is located after providing resources for the services configured on itself are not less than the resource adjustment amount, the resource allocation amount of the target service is increased to the resource recommended amount; if not, the service is skipped and the next service is continued to be processed. The services with adjustment failures wait for the next processing cycle to continue processing. If the resource adjustment information indicates a reduction in the resource amount, it is necessary to judge in different scenarios. If the resource usage amount at the current moment is not greater than the resource recommended amount, it can be directly adjusted. If the resource usage amount at the current moment is greater than the resource recommended amount, in this case, the container needs to be restarted, and the container restart policy needs to be set when adjusting the service resource configuration.

[0128] The service resource adjustment method and server provided in this embodiment determine the resource recommendation amount by obtaining the resource usage amounts of the target service in the current moment and at least one historical moment in the server cluster. Based on the resource usage amounts at at least one historical moment, the resource recommendation amount can reflect the historical resource usage situation of the target service. Adjusting the service resources based on the resource recommendation amount helps to avoid abnormal service operations caused by service resource adjustment. Additionally, the resource adjustment information is determined according to the ratio between the resource usage amount of the target service in the current moment and the resource allocation amount. When the resource adjustment information indicates an increase in the resource amount, the resource allocation amount of the target service is increased according to the resource recommendation amount and the remaining resource amount on the server where the target service is located after providing resources for its own configured services. This method of directly increasing the resource allocation amount when the resource amount needs to be increased avoids the service interruption problem caused by restarting the service. When the resource adjustment information indicates a decrease in the resource amount and the resource usage amount in the current moment is greater than the resource recommendation amount, the target service is restarted, and the resource recommendation amount is determined as the resource allocation amount of the restarted target service. This method of restarting the target service when the resource amount needs to be decreased and the resource usage amount is large avoids the problem of unstable service caused by insufficient service resources. Therefore, adopting this method helps to solve the problem of abnormal service operations caused by service resource adjustment.

[0129] In an exemplary embodiment, a computer device is provided. This computer device can be a server, and its internal structure diagram can be as Figure 10 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of this computer device is used to provide computing and control capabilities. The memory of this 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 this computer device is used to store the resource usage amounts, resource recommendation amounts, resource adjustment information, etc. of the target service in the current moment and at least one historical moment. The input / output interface of this computer device is used to exchange information between the processor and external devices. The communication interface of this computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a service resource adjustment method.

[0130] Those skilled in the art can understand, Figure 10The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0131] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0132] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0133] In an embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0135] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. 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 methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.

[0136] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, 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, it should be considered to be within the scope recorded in the present application.

[0137] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A service resource adjustment method, characterized in that The method includes: Obtaining the resource usage of a target service in the server cluster at the current moment and at least one historical moment; Determining a resource recommendation amount according to the resource usage amounts at at least one historical moment; Determining resource adjustment information according to the ratio between the resource usage amount of the target service at the current moment and the resource allocation amount; When the resource adjustment information indicates an increase in the resource amount, increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; When the resource adjustment information indicates a decrease in the resource amount and the resource usage amount at the current moment is greater than the resource recommendation amount, restarting the target service and determining the resource recommendation amount as the resource allocation amount of the restarted target service.

2. The method according to claim 1, wherein The increasing the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself includes: Determining a resource adjustment amount according to the resource recommendation amount and the resource allocation amount; When the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is not less than the resource adjustment amount, increasing the resource allocation amount of the target service to the resource recommendation amount.

3. The method according to claim 2, wherein The method further includes: When the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is less than the resource adjustment amount, returning to the step of obtaining the resource usage of the target service in the server cluster at the current moment and at least one historical moment and continuing to execute until the updated resource adjustment information indicates an increase in the resource amount and the updated remaining resource amount is not less than the updated resource adjustment amount, and increasing the resource allocation amount of the target service to the updated resource recommendation amount.

4. The method according to claim 1, wherein The method further includes: When the resource adjustment information indicates a decrease in the resource amount and the resource usage amount at the current moment is not greater than the resource recommendation amount, reducing the resource allocation amount of the target service to the resource recommendation amount.

5. The method according to claim 1, wherein The determining the resource recommendation amount according to the resource usage amounts at at least one historical moment includes: Sorting the resource usage amounts at at least one historical moment in ascending order; Determining a plurality of target resource usage amounts within a preset range among the sorted plurality of resource usage amounts; Determining the resource recommendation amount based on the plurality of target resource usage amounts.

6. The method according to claim 1, wherein The determining the resource adjustment information according to the ratio between the resource usage amount of the target service at the current moment and the resource allocation amount includes: When the ratio between the resource usage amount of the target service at the current moment and the resource allocation amount is less than a first preset ratio, determining that the resource adjustment information indicates a decrease in the resource amount; When the ratio between the resource usage amount of the target service at the current moment and the resource allocation amount is greater than a second preset ratio, determining that the resource adjustment information indicates an increase in the resource amount; the first preset ratio is less than the second preset ratio.

7. The method according to claim 1, characterized in that, The obtaining the resource usage of the target service in the server cluster at the current moment and at least one historical moment includes: In response to a service resource monitoring request, determine the target service to be monitored and the monitoring time interval in the server cluster; Obtain the resource usage of the target service at the current moment and at least one historical moment according to the monitoring time interval.

8. A server, characterized in that, The server includes a processor; the processor includes a resource recommendation service and a resource adjustment control service, where: The resource recommendation service is used to obtain the resource usage of the target service in the server cluster at the current moment and at least one historical moment; determine the resource recommendation amount according to the resource usage at at least one historical moment; The resource adjustment control service is used to determine resource adjustment information according to the ratio between the resource usage of the target service at the current moment and the resource allocation amount; The resource adjustment control service is further used to, when the resource adjustment information indicates an increase in the resource amount, increase the resource allocation amount of the target service according to the resource recommendation amount and the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself; when the resource adjustment information indicates a decrease in the resource amount and the resource usage at the current moment is greater than the resource recommendation amount, restart the target service and determine the resource recommendation amount as the resource allocation amount of the restarted target service.

9. The server according to claim 8, wherein The resource adjustment control service is further used to determine the resource adjustment amount according to the resource recommendation amount and the resource allocation amount; when the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is not less than the resource adjustment amount, increase the resource allocation amount of the target service to the resource recommendation amount.

10. The server according to claim 9, characterized in that, The resource adjustment control service is further used to: When the remaining resource amount of the server where the target service is located after providing resources for the services configured on itself is less than the resource adjustment amount, return to the step of obtaining the resource usage of the target service in the server cluster at the current moment and at least one historical moment and continue to execute until the updated resource adjustment information indicates an increase in the resource amount and the updated remaining resource amount is not less than the updated resource adjustment amount, and increase the resource allocation amount of the target service to the updated resource recommendation amount.