CN-122019050-A - Method, device, equipment and storage medium for configuring resources
Abstract
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for configuring resources. The method comprises the steps of obtaining historical parameters of multiple types of applications deployed in a cluster, wherein the historical parameters are used for indicating historical use conditions of Pod running corresponding applications on cluster resources, determining N groups of posterior probabilities corresponding to N application types one by one based on the historical parameters of the multiple types of applications, wherein one group of posterior probabilities corresponding to one application type comprises M posterior probabilities corresponding to M preset parameters one by one, the ith posterior probability is used for representing the adaptation degree between the corresponding application type and the ith preset parameter, 1 is less than or equal to i and less than or equal to M, M and N are positive integers, and determining configuration parameters of a target Pod based on the maximum posterior probability in one group of posterior probabilities corresponding to the application type of the application to be deployed in the N groups of posterior probabilities, wherein the target Pod is used for providing an operation environment for the application to be deployed in the cluster.
Inventors
- ZHANG FAN
Assignees
- 重庆长安汽车股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260122
Claims (10)
- 1. A method of configuring resources, the method comprising: Acquiring historical parameters of multiple types of applications deployed in a cluster, wherein the historical parameters are used for indicating historical use conditions of Pod running corresponding applications on cluster resources; Determining N groups of posterior probabilities corresponding to N application types one by one based on the historical parameters of the multi-type application, wherein the group of posterior probabilities corresponding to one application type comprises M posterior probabilities corresponding to M preset parameters one by one, and the ith posterior probability is used for representing the adaptation degree between the corresponding application type and the ith preset parameter, i is more than or equal to 1 and less than or equal to M, and M and N are both positive integers; And determining configuration parameters of a target Pod based on the maximum posterior probability in a group of posterior probabilities corresponding to the application type of the application to be deployed in the N groups of posterior probabilities, wherein the target Pod is used for providing an operation environment for the application to be deployed in the cluster.
- 2. The method of claim 1, wherein determining the configuration parameter of the target Pod based on a maximum posterior probability of a set of posterior probabilities of the N sets of posterior probabilities corresponding to an application type of the application to be deployed comprises: determining the maximum posterior probability of a group of posterior probabilities corresponding to the application type of the application to be deployed in the N groups of posterior probabilities; and taking the preset parameter corresponding to the maximum posterior probability as the configuration parameter of the target Pod.
- 3. The method according to claim 1 or 2, wherein determining a plurality of sets of posterior probabilities corresponding to N application types based on historical parameters of the plurality of classes of applications comprises: Determining M prior probabilities corresponding to the M preset parameters one by one based on the historical parameters of the multi-class application, wherein the prior probabilities are used for indicating the distribution probability of the corresponding preset parameters in the historical parameters of the multi-class application; Determining M groups of conditional probabilities corresponding to the M preset parameters one by one based on the historical parameters of the multiple types of applications, wherein the group of conditional probabilities corresponding to one preset parameter comprises N conditional probabilities corresponding to the N application types one by one, and the jth conditional probability is used for representing the probability that when the application of the jth application type is operated, the using value of Pod on cluster resources is the probability of the corresponding preset parameter, wherein j is more than or equal to 1 and less than or equal to N; and determining N groups of posterior probabilities corresponding to the N application types based on the M prior probabilities and the M groups of conditional probabilities.
- 4. The method of claim 3, wherein the step of, The determining M prior probabilities corresponding to the M preset parameters one by one based on the historical parameters of the multi-class application comprises the steps of counting the duty ratio of each preset parameter of the M preset parameters in the historical parameters to obtain the prior probability corresponding to each preset parameter; Determining M groups of conditional probabilities corresponding to the M preset parameters one by one based on the historical parameters of the multiple types of applications comprises counting probability values of N application types in the historical parameters, which are respectively used by the applications of the N application types, aiming at each preset parameter in the M preset parameters to obtain a group of conditional probabilities corresponding to each preset parameter.
- 5. The method of claim 3, wherein the determining N sets of posterior probabilities corresponding to N application types based on the M prior probabilities and the M sets of conditional probabilities comprises: And aiming at each application type, obtaining N groups of posterior probabilities corresponding to the application type based on N conditional probabilities corresponding to the application type and the N prior probabilities.
- 6. The method of any of claims 1-5, wherein prior to the obtaining historical parameters for the multiple classes of applications deployed in the cluster, the method further comprises: periodically collecting historical usage data of cluster resources by a plurality of Pod running in the cluster and providing running environments for the multi-class application; Based on the historical usage data, historical parameters of multiple classes of applications deployed in the cluster are obtained.
- 7. The method according to any one of claims 1-6, further comprising: And deploying the target Pod in the cluster based on a first configuration file of the Pod, wherein a target field in the first configuration file is a configuration parameter of the target Pod.
- 8. An apparatus for configuring resources, comprising: the system comprises an acquisition unit, a storage unit and a storage unit, wherein the acquisition unit is used for acquiring historical parameters of multiple types of applications deployed in a cluster, and the historical parameters are used for indicating historical use conditions of Pod running corresponding applications on cluster resources; The system comprises a first determining unit, a second determining unit and a third determining unit, wherein the first determining unit is used for determining N groups of posterior probabilities corresponding to N application types one by one based on historical parameters of the multi-type application, wherein the group of posterior probabilities corresponding to one application type comprises M posterior probabilities corresponding to M preset parameters one by one, and the ith posterior probability is used for representing the adaptation degree between the corresponding application type and the ith preset parameter, i is more than or equal to 1 and less than or equal to M, and M and N are positive integers; The second determining unit is used for determining configuration parameters of a target Pod based on the maximum posterior probability in a group of posterior probabilities corresponding to the application type of the application to be deployed in the N groups of posterior probabilities, wherein the target Pod is used for providing an operation environment for the application to be deployed in the cluster.
- 9. An apparatus for configuring resources, comprising: one or more processors; A memory for storing one or more programs that, when executed by the one or more processors, cause the apparatus to implement the method of any of claims 1-7.
- 10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor of a computer, causes the computer to perform the method of any of claims 1 to 7.
Description
Method, device, equipment and storage medium for configuring resources Technical Field The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer readable storage medium for configuring resources. Background With the wide application of containerization technology and clusters such as Kubernetes clusters (K8 s for short), reasonable allocation of Pod resources in the clusters becomes a key factor for guaranteeing cluster stability and resource utilization. Where Pod is the smallest scheduling unit in the cluster that is used to provide the running environment for applications deployed in the cluster. In the conventional technology, a static resource configuration mode is generally adopted to set configuration parameters for Pod, and the configuration mode causes the problem of cluster resource waste or resource contention frequently. Disclosure of Invention The embodiment of the application provides a method, a device, equipment and a computer readable storage medium for configuring resources, and particularly discloses the following technical scheme: The embodiment of the application provides a resource configuration method, which comprises the steps of obtaining historical parameters of multiple types of applications deployed in a cluster, wherein the historical parameters are used for indicating historical use conditions of Pod running corresponding applications on the cluster resources, determining N groups of posterior probabilities corresponding to N application types one by one based on the historical parameters of the multiple types of applications, wherein one group of posterior probabilities corresponding to one application type comprises M posterior probabilities corresponding to M preset parameters one by one, the ith posterior probability is used for representing the adaptation degree between the corresponding application type and the ith preset parameter, 1 is less than or equal to i and is less than or equal to M, M and N are positive integers, and determining the configuration parameters of a target Pod based on the maximum posterior probability in one group of posterior probabilities corresponding to the application type of the application to be deployed in the N groups of posterior probabilities, wherein the target Pod is used for providing an operation environment for the application to be deployed in the cluster. In the application, the maximum posterior probability represents the highest degree of adaptation between the use of the application to be deployed and the corresponding preset parameter (namely, the preset parameter is optimal in resource demand suitability of the application to be deployed). The method and the device can dynamically match the resource configuration with optimal suitability for the application to be deployed based on the historical performance of the application, thereby avoiding the application operation jamming caused by insufficient resource configuration, reducing the waste caused by excessive resource allocation and improving the automation and intelligent level of application deployment. In some embodiments, determining the configuration parameters of the target Pod based on the maximum posterior probability of a set of posterior probabilities of the N sets of posterior probabilities corresponding to the application type of the application to be deployed includes determining the maximum posterior probability of the set of posterior probabilities of the N sets of posterior probabilities corresponding to the application type of the application to be deployed, and taking the preset parameters corresponding to the maximum posterior probability as the configuration parameters of the target Pod. According to the technical means, the configuration parameters of the target Pod are more close to the actual resource demands by definitely identifying and selecting the preset parameters corresponding to the maximum posterior probability, so that the rationality of resource allocation is improved, and the resource waste or preemption problem caused by larger difference between the initial request resource data and the actual request resource data is reduced. In some embodiments, multiple sets of posterior probabilities corresponding to N application types are determined based on historical parameters of the multi-class application, wherein the multiple sets of posterior probabilities corresponding to the N application types are determined based on the historical parameters of the multi-class application, the multiple sets of posterior probabilities corresponding to the M preset parameters are determined based on the historical parameters of the multi-class application, the multiple sets of conditional probabilities corresponding to the M preset parameters are determined based on the historical parameters of the multi-class application, one set of conditional probabilities corresponding