Resource management method, device, electronic device and computer-readable storage medium
Patent Information
- Application Number
- CN202110910265.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-08-09
AI Technical Summary
In the prior art, user resource demand is unstable, resulting in insufficient resources during high concurrency periods and inability to meet demand. Resources are idle after demand decreases, resulting in low resource utilization.
By setting up a resource pool in the cluster, the master device obtains the resource requirements of the user terminal and reduces or expands the physical resources in the resource pool according to the target reserved value, ensuring the minimum and maximum limits of resources to improve the resource Utilization.
It effectively improves the utilization rate of resources, avoids excessive load and resource waste from resource providers, and optimizes user experience and resource management efficiency.
Smart Images

Figure CN113760543B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource management method, device, electronic device and computer-readable storage medium. Background Art
[0002] In the prior art, users' resource demands are often not stable. There will be short-term large-scale demand applications in certain time periods, and long-term small-scale demand applications in certain time periods. For example, when processing the review task of engineering drawings in the nodes in the cluster created by Huawei Cloud, there may be a sudden increase in the demand for review tasks in a certain period of time. For this short-term high concurrency situation, still using the same number of resource provision methods as usual will cause the resource provider to be overloaded, and a large number of resource demands cannot be met, thereby reducing the user experience. For another example, after the review task demand is reduced, still using the same number of resource provision methods as usual will cause the resource provider to waste resources and a large number of resources to be idle. It can be seen that the above implementation method is prone to the problem of low resource utilization. Summary of the invention
[0003] The embodiments of the present application provide a resource management method, device, electronic device and computer-readable storage medium, which can improve resource utilization.
[0004] In a first aspect, an embodiment of the present application provides a resource management method, the method being applied to a master device in a cluster, the cluster being provided with a resource pool; the method comprising:
[0005] The master device obtains a resource demand corresponding to at least one user terminal; the resource demand is used to represent the amount of physical resources required by the at least one user terminal to perform a respective task;
[0006] When the master device determines that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool, the physical resources in the resource pool are reduced according to the target reservation value; the target reservation value is used to indicate the minimum limit of the physical resources allocated to the resource pool.
[0007] In a second aspect, an embodiment of the present application provides a resource management device, the device is applied to a master device in a cluster, the cluster is provided with a resource pool; the device includes:
[0008] A resource requirement acquisition module, used to acquire the resource requirement corresponding to at least one user terminal; the resource requirement is used to represent the amount of physical resources required by the at least one user terminal to perform the respective tasks;
[0009] A capacity reduction module is used to reduce the physical resources in the resource pool according to a target reservation value when it is determined that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool; the target reservation value is used to indicate the minimum limit of the physical resources allocated to the resource pool.
[0010] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect.
[0011] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program includes a computer program for executing the method described in the first aspect.
[0012] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes: a computer program code, when the computer program code is run on a computer, the computer executes the method described in the first aspect.
[0013] It can be seen that in the embodiment of the present application, by setting a target reservation value, which is used to indicate the minimum limit of the physical resources allocated to the resource pool, the physical resources in the resource pool are reduced in capacity according to the target reservation value, thereby improving resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0015] Figure 1 A schematic diagram of the composition of a cluster provided in an embodiment of the present application;
[0016] Figure 2 A schematic diagram of a resource management method provided in an embodiment of the present application;
[0017] Figure 3 A schematic diagram of a process for reducing resource capacity provided in an embodiment of the present application;
[0018] Figure 4 A flowchart of a method for reducing capacity provided in an embodiment of the present application;
[0019] Figure 5A flowchart of a method for resource expansion provided in an embodiment of the present application;
[0020] Figure 6 A schematic diagram of the composition of a resource management device provided in an embodiment of the present application;
[0021] Figure 7 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0023] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0024] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0025] The electronic device may include a terminal or a server, which is not limited in the embodiments of the present application. The terminal includes various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices (such as smart watches, smart bracelets, pedometers, etc.), computing devices or other processing precision connected to a wireless modem. User Equipment (UE), Mobile Station (MS), terminal device, etc. For the convenience of description, the above-mentioned devices are collectively referred to as electronic devices.
[0026] First, the professional terms and concepts involved in the embodiments of the present application are introduced.
[0027] (1) Cluster
[0028] A cluster is a group of nodes, which can be physical servers or virtual machines, on which the Kubernetes platform is installed.
[0029] (2) Kubernetes
[0030] Kubernetes, or K8s for short, is an open source containerized application for managing multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient. K8s provides a mechanism for application deployment, planning, updating, and maintenance. K8s can be used to quickly deploy applications, quickly expand applications, seamlessly connect to new application functions, save resources, and optimize the use of hardware resources.
[0031] (3) Node
[0032] A node is the smallest computing hardware unit in Kubernetes. It represents a single machine in a Kubernetes cluster. In most systems, nodes include but are not limited to physical machines in a data center, or virtual machines hosted on a cloud platform. Nodes on Kubernetes include master nodes and compute nodes.
[0033] (4)Pod
[0034] Pod is the most basic operating unit of K8s, which encapsulates one or more closely related containers. Any container in the same Pod will share the same namespace and local network. Containers can easily communicate with other containers in the same Pod. Pod is used as a replication unit for Kubernetes. In the case that a single Pod instance cannot carry the load, Kubernetes can be configured to deploy a copy of the Pod to the cluster when necessary. Pod can hold multiple containers, but you should limit yourself when possible. Because when Pod is scaled up and down as a unit, all containers in a Pod must be scaled together, whether they are needed or not. This will lead to waste of resources and increased costs. To solve this problem, Pod should be kept as small as possible, usually retaining only a main process and tightly coupled auxiliary containers.
[0035] (5) Container
[0036] Containerization is a software development approach whereby an application or service, its dependencies, and its configuration (abstracted as a deployment manifest file) are packaged together as a container image. Containerized applications can be tested as a unit and deployed to a host operating system (OS) as a container image instance. That is, a container contains a complete runtime environment: in addition to the application itself, all the dependencies, libraries, other binaries, configuration files, etc. required by the application are packaged into a single package called a container image. By containerizing the application itself and its dependencies, differences caused by operating system distributions and other basic environments are abstracted away. For example, programs running on Kubernetes are packaged as Linux containers. You can add multiple programs to a single container, but if possible, you should limit yourself to one process per container. It is better to have many small containers than one large container. If each container has a tight focus, updates are easier to deploy and problems are easier to diagnose. Kubernetes does not run containers directly, but encapsulates one or more containers into Pods.
[0037] See also Figure 1 , which is a schematic diagram of the composition of a cluster provided in an embodiment of the present application.
[0038] Among them, the main device 101 and the user terminal 102 constitute the cluster 10, and the main device 101 and the user terminal 102 are both nodes. A node is a representation of a single machine in a cluster. In most systems, nodes include but are not limited to physical machines in a data center, or virtual machines hosted on a cloud platform. The main device 101 is equivalent to the main node in the cluster, which is mainly responsible for management and control. The user terminal 102 is equivalent to a workload node, that is, a computing node, which can be regarded as a group of central processing units (CPU) and random access memory (RAM) resources that can be used without distinction. A computing node may contain one or more Pods 104. The resource pool 103 is a resource pool obtained by abstracting the physical resources in the node, that is, the resource pool 103 aggregates the physical resources in the node. It should be noted that the main device and the user terminal can be the same device or different devices. For example, the main device and the user terminal can both be hosts, or the user terminal can be a host and the main device can be a server. It can be understood that the distinction between the main device and the user terminal is mainly achieved through the functions that each focuses on.
[0039] See also Figure 2, is a flow chart of a resource management method provided in an embodiment of the present application, the method is applied to a master device in a cluster, and the cluster is provided with a resource pool.
[0040] Step S201: the master device obtains a resource requirement corresponding to at least one user terminal; the resource requirement is used to represent the amount of physical resources required by the at least one user terminal to perform a respective task.
[0041] In a possible implementation, the physical resources include at least one of CPU resources, network resources, and memory resources.
[0042] It should be noted that the amount of physical resources applied for or used by the user terminal refers to the amount of physical resources applied for or used by the Pod in the user terminal.
[0043] In a possible implementation, the master device obtains the resource demand corresponding to at least one user terminal once at a preset time interval. Exemplarily, the preset time interval may be 5 minutes, that is, the master device obtains the resource demand corresponding to at least one user terminal once every 5 minutes.
[0044] In a possible implementation, the master device obtains the amount of physical resources applied for by at least one user terminal in the cluster by calling the cluster interface, and uses the amount of physical resources applied for by at least one user terminal as the resource demand. That is, the resource demand = the amount of physical resources applied for by at least one user terminal. Alternatively, the resource demand is obtained by calculating the amount of physical resources applied for by at least one user terminal. Exemplarily, the resource demand = the amount of physical resources applied for by at least one user terminal × P, where P is a value greater than 1.
[0045] It should be noted that, in the case where there are two or more user terminals applying for use of physical resources, the amount of physical resources applied for use by at least one user terminal is the sum of the amounts of physical resources applied for use by the two or more user terminals.
[0046] In actual applications, since the demand for physical resources by user terminals will continue to change, in order to ensure resource utilization, the amount of physical resources in the resource pool will also continue to expand or shrink. The amount of physical resources in the resource pool is an abstract aggregation of the physical resources of multiple user terminals, so the amount of physical resources allocated to the user terminal will also continue to change. In other words, after the user terminal applies for physical resources, it cannot use the applied physical resources permanently. After the user terminal has used up the applied physical resources and thus idled the applied physical resources, part or all of the applied physical resources will be released. Therefore, it should be noted that the amount of physical resources applied for by at least one user terminal is not the sum of the amount of physical resources applied for by at least one user terminal multiple times, but is obtained by subtracting the sum of the amount of physical resources released from the sum of the amount of physical resources applied for by at least one user terminal.
[0047] In a possible implementation, the master device obtains the amount of physical resources currently used by at least one user terminal in the cluster, and uses the amount of physical resources currently used by the at least one user terminal as the resource demand. That is, the resource demand = the amount of physical resources currently used by the at least one user terminal. Alternatively, the resource demand is obtained by calculating the amount of physical resources currently used by the at least one user terminal. Exemplarily, the resource demand = the amount of physical resources currently used by the at least one user terminal × Q, where Q is a value greater than 1.
[0048] Step S202: When the main device determines that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool, the physical resources in the resource pool are reduced according to the target reservation value; the target reservation value is used to indicate the minimum limit of the physical resources allocated to the resource pool.
[0049] Among them, the target reserved value refers to the amount of physical resources in the resource pool that are not allocated to user terminals, except for the physical resources allocated to at least one user terminal according to the resource demand of the user terminal, after the physical resources in the resource pool are scaled down. In other words, the amount of available physical resources after scaling down = target reserved value + resource demand. It should be noted that when the resource demand corresponding to the at least one user terminal is less than the amount of available physical resources in the resource pool, it means that the scaling down condition is met at this time.
[0050] In one possible implementation, a target model is trained using at least one sample data, wherein the sample data includes historical resource demands and available physical resources in the resource pool when the master device responds to the historical resource demands, and the target reservation value is determined based on the target model.
[0051] The historical resource demand is historical data of the demand for physical resources by at least one user terminal. The available physical resources in the resource pool include physical resources that have been allocated to at least one user terminal and physical resources that have not been allocated to the user terminal.
[0052] Exemplarily, if the physical resources include CPU resources and memory resources, the historical resource demand includes the historical CPU resource demand and the historical memory resource demand. It should be understood that in the case where the physical resources include CPU resources and memory resources, the historical resource demand of any sample data includes both the historical CPU resource demand and the historical memory resource demand. When the target model is trained by sample data, the input data is the historical resource demand and the historical available physical resource. When the historical resource demand is less than the historical available physical resource, the output data is the preset reserved value. Among them, the historical available physical resource is the available physical resource in the resource pool when the main device responds to the historical resource demand. Among them, the preset reserved value is a reserved value that is set autonomously and can meet the resource demand and / or performance demand of the user terminal under the premise of ensuring resource utilization. After the target model is obtained by training at least one sample data, when the historical resource demand is less than the historical available physical resource, the target reserved value can be determined according to the obtained target model. That is to say, when training the target model, the input data and the output data are both known data. After obtaining the target model, the predicted output data can be obtained by inputting data into the target model. When the resource demand is less than the available physical resource, the input data is the resource demand and the available physical resource, and the output data is the target reserved value.
[0053] After the target reserved value is obtained, the physical resources in the resource pool can be scaled down according to the target reserved value.
[0054] In one possible implementation, when the master device determines that the resource demand corresponding to the at least one user terminal is greater than or equal to the available physical resources in the resource pool, the physical resources in the resource pool are expanded according to a target upper limit value; the target upper limit value is used to indicate the maximum limit of the physical resources allocated to the resource pool.
[0055] The target upper limit value refers to the amount of physical resources in the resource pool that are not allocated to user terminals, except for the physical resources allocated to at least one user terminal according to the resource demand of the user terminal, after the physical resources in the resource pool are expanded. In other words, the amount of available physical resources after expansion = target upper limit value + resource demand. It should be noted that when the resource demand corresponding to the at least one user terminal is greater than the amount of available physical resources in the resource pool, it means that the expansion condition is met at this time.
[0056] In one possible implementation, a target model is trained using at least one sample data including historical resource demands and available physical resources in the resource pool when the master device responds to the historical resource demands, and the target upper limit value is determined based on the target model.
[0057] Exemplarily, if the physical resources include CPU resources and network resources, the historical resource demand includes the historical CPU resource demand and the historical network resource demand. It should be understood that in the case where the physical resources include CPU resources and network resources, the historical resource demand of any sample data includes both the historical CPU resource demand and the historical network resource demand. When the target model is trained by sample data, the input data is the historical resource demand and the historical available physical resource. When the historical resource demand is greater than the historical available physical resource, the output data is the preset upper limit value. Among them, the historical available physical resource is the available physical resource in the resource pool when the main device responds to the historical resource demand. Among them, the preset upper limit value is a reserved value that is set autonomously and can meet the resource demand and / or performance demand of the user terminal under the premise of ensuring resource utilization. After the target model is obtained by training at least one sample data, when the historical resource demand is greater than the historical available physical resource, the target upper limit value can be determined according to the obtained target model. That is to say, when training the target model, the input data and the output data are both known data. After obtaining the target model, the predicted output data can be obtained by inputting data into the target model. When the resource demand is greater than the available physical resource, the input data is the resource demand and the available physical resource, and the output data is the target upper limit.
[0058] In a possible implementation, after obtaining the target reserved value, the physical resources in the resource pool can be reduced in size according to the target reserved value. Figure 3 , which is a flow chart of a method for resource scaling provided in an embodiment of the present application.
[0059] The specific steps of resource reduction are as follows, including steps S301 to S303:
[0060] Step S301: Determine whether the resource pool after shrinking satisfies the expansion condition.
[0061] The method for judging whether the resource pool after shrinking meets the expansion condition is to calculate the available physical resources and resource demand in the resource pool after shrinking before shrinking. If the target upper limit value can be obtained at this time, it means that the resource pool after shrinking meets the expansion condition, otherwise it does not meet the condition. It should be understood that the sum of the target upper limit value and the resource demand is greater than the available resources, and the sum of the target reserved value and the resource demand is less than the available resources. This method can be used to judge whether the obtained value is the target reserved value or the target upper limit value.
[0062] Step S302: When the shrunk resource pool meets the expansion condition, the shrinking operation is ended.
[0063] Step S303: When the resource pool after shrinking does not meet the expansion condition, select a node to perform shrinking operation.
[0064] The specific implementation of step S303 includes steps S3031 to S3037. Figure 4 , which is a flow chart of a method for scaling down operation provided in an embodiment of the present application.
[0065] Step S3031: Mark the selected node as unschedulable and as a shrinking node.
[0066] In a possible implementation, the selected node is a CA node. When creating a cluster, a certain number of nodes need to be added to the cluster as basic nodes. CA nodes refer to nodes in the cluster that are added to the cluster through expansion operations except for basic nodes.
[0067] The method of marking the node as a shrinking node includes but is not limited to adding a label to the node.
[0068] Methods for marking the scaled-in node as unschedulable include but are not limited to marking the node with a taint, or marking the node as unschedulable using the kubectl cordon NODE command. A taint is a core object that prevents a Pod from being scheduled on a node or node group. Scheduling refers to ensuring that a suitable node is matched so that the Pod can be successfully run in the cluster.
[0069] Step S3032: evict the Pod running on the scaled-in node.
[0070] Eviction refers to actively making one or more Pods fail on a node with scarce resources.
[0071] Step S3033: Detect whether there is a running Pod on the scaled-in node.
[0072] The status of the Pod can be obtained through the Kubernetes call interface.
[0073] Step S3034: If there is no running Pod on the scaled-in node, delete the scaled-in node.
[0074] Step S3035: If there is a running Pod on the scaled-in node, determine whether the running Pod belongs to DaemonSet.
[0075] DaemonSet is a Pod controller that ensures that a copy of a Pod runs on all (or some) nodes. When a node joins the cluster, a new Pod is added for them. When a node is removed from the cluster, these Pods are also recycled. Deleting DaemonSet will delete all Pods it created. Whether a Pod belongs to DaemonSet means whether the Pod was created through DaemonSet.
[0076] Step S3036: If the running Pod belongs to DaemonSet, delete the scaled-in node.
[0077] Step S3037: If the running Pod does not belong to DaemonSet, the scaling-in operation is terminated.
[0078] In a possible implementation, after the target upper limit value is obtained, the physical resources in the resource pool may be expanded according to the target upper limit value.
[0079] See also Figure 5 , is a flow chart of a method for resource expansion provided in an embodiment of the present application. The specific steps of resource expansion are as follows, including steps S501 to S505:
[0080] Step S501: Determine whether there is a node that is being shrunk.
[0081] The node being shrunk is the node marked as a shrinking node.
[0082] Step S502: if there is a node that is being shrunk, restore the node that is being shrunk to a normal state.
[0083] In a possible implementation, when there are multiple nodes that are being shrunk, the number of shrunk nodes that are restored to a normal state is determined based on resource demand.
[0084] Step S503: If there is no node being shrunk, determine whether the number of nodes being expanded has reached the upper limit.
[0085] The meaning of whether the expanded nodes have reached the upper limit includes but is not limited to whether the number of expanded nodes has reached the upper limit or whether the total number of nodes in the cluster after expansion has reached the upper limit, which is not limited in the present embodiment. The upper limit is a preset value.
[0086] Step S504: When the number of nodes to be expanded reaches the upper limit, the expansion operation is terminated.
[0087] Step S505: When the number of nodes to be expanded does not reach the upper limit, create a node and add the created node to the cluster.
[0088] In one possible implementation, when the cluster is created based on Huawei Cloud, the node creation interface can be called through the Software Development Kit (SDK) provided by Huawei Cloud, and the command for the node to join the cluster can be preset in the interface parameters. After the node is created, the registration operation can be completed by itself to add the created node to the cluster. The node that joins the cluster through the expansion operation is marked as a CA node.
[0089] In a possible implementation, the number of node clusters created in one capacity expansion operation may be one or more, which is determined according to the amount of physical resources provided by each node and the amount of resource demand.
[0090] In a possible implementation, the node creation status is detected cyclically, and when the node joins the cluster normally or the expansion operation exceeds a preset time, the expansion operation is terminated.
[0091] It should be noted that the detection of the expansion operation exceeding the preset time is generally caused by the long time of node creation, but because the initialization script is configured when the node is created, the node will eventually complete the registration and join the cluster. In other words, ending the expansion operation means ending the detection of the expansion result this time, and does not affect the final result of completing the expansion.
[0092] It should be noted that the expansion and reduction of physical resources is achieved by adding nodes to the cluster and deleting nodes from the cluster.
[0093] The device involved in the embodiment of the present application is described below with reference to the accompanying drawings.
[0094] See also Figure 6 , is a schematic diagram of the composition of a resource management device provided in an embodiment of the present application. The resource management device 600 includes:
[0095] The resource requirement acquisition module 601 is used to acquire the resource requirement corresponding to at least one user terminal; the resource requirement is used to represent the amount of physical resources required by the at least one user terminal to perform its respective tasks;
[0096] The capacity reduction module 602 is used to reduce the physical resources in the resource pool according to the target reservation value when it is determined that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool; the target reservation value is used to indicate the minimum limit of the physical resources allocated to the resource pool.
[0097] Optionally, the resource management device 600 further includes:
[0098] The expansion module 603 is used to expand the physical resources in the resource pool according to a target upper limit value when the main device determines that the resource demand corresponding to the at least one user terminal is greater than or equal to the available physical resources in the resource pool; the target upper limit value is used to indicate the maximum limit of the physical resources allocated to the resource pool.
[0099] Optionally, the resource management device 600 further includes:
[0100] A training target model module 604 is used to train a target model using at least one sample data, wherein the sample data includes a historical resource demand and an available physical resource in the resource pool when the master device responds to the historical resource demand;
[0101] The processing module 605 is used to determine the target reserved value according to the target model; or
[0102] It is also used to determine the target upper limit value according to the target model.
[0103] Optionally, the physical resources include at least one of CPU resources, network resources, and memory resources.
[0104] The specific implementation of the resource management device 600 can be found in Figure 2-Figure 5 The corresponding method steps will not be described in detail here.
[0105] See also Figure 7 , is a schematic diagram of the composition of an electronic device provided in an embodiment of the present application.
[0106] The electronic device 100 may include: a processor 110, a memory 120; wherein the processor 110, the memory 120 and the communication interface 130 are connected via a bus 140, the memory 120 is used to store instructions, and the processor 110 is used to execute the instructions stored in the memory 120 to implement the above Figure 2-Figure 5 The corresponding method steps.
[0107] The processor 110 is used to execute the instructions stored in the memory 120 to control the communication interface 130 to receive and send signals and complete the steps in the above method. The memory 120 can be integrated in the processor 110 or can be set separately from the processor 110.
[0108] As an implementation, the function of the communication interface 130 may be implemented by a transceiver circuit or a dedicated transceiver chip. The processor 110 may be implemented by a dedicated processing chip, a processing circuit, a processor or a general-purpose chip.
[0109] As another implementation method, it is possible to use a general-purpose computer to implement the electronic device provided in the embodiment of the present application. That is, the program code that implements the functions of the processor 110 and the communication interface 130 is stored in the memory 120, and the general-purpose processor implements the functions of the processor 110 and the communication interface 130 by executing the code in the memory 120.
[0110] For the concepts, explanations, detailed descriptions and other steps involved in the terminal and related to the technical solution provided in the embodiments of the present application, please refer to the description of the method steps executed by the device in the aforementioned method or other embodiments, which will not be repeated here.
[0111] As another implementation of this embodiment, a computer-readable storage medium is provided, on which instructions are stored. When the instructions are executed, the method in the above method embodiment is executed.
[0112] As another implementation of this embodiment, a computer program product including instructions is provided, and when the instructions are executed, the method in the above method embodiment is performed.
[0113] Those skilled in the art will appreciate that for ease of description, Figure 7 Only one memory and processor are shown. In an actual electronic device, there may be multiple processors and memories. The memory may also be referred to as a storage medium or a storage device, etc., which is not limited in the embodiments of the present application.
[0114] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
[0115] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0116] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor.
[0117] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0118] In addition to the data bus, the bus may also include a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, various buses are marked as buses in the figure.
[0119] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0120] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.
[0121] In various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0122] Those skilled in the art will appreciate that the various illustrative logical blocks (ILBs) and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0123] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0126] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0127] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A resource management method, characterized in that: The method is applied to a master device in a cluster, the cluster is provided with a resource pool, and the cluster includes at least one user terminal; the method includes: A target model is obtained by training at least one sample data, wherein the sample data includes a historical resource demand and an available physical resource amount in the resource pool when the master device responds to the historical resource demand; Determining a target reservation value according to the target model; The master device obtains a resource requirement corresponding to the at least one user terminal; the resource requirement is used to represent the amount of physical resources required by the at least one user terminal to perform a respective task; In a case where the master device determines that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool, the physical resources in the resource pool are scaled down according to the target reserved value; the target reserved value is used to indicate the minimum limit of the physical resources allocated to the resource pool, and the target reserved value refers to the amount of physical resources in the resource pool that are not allocated to the user terminal, except for the physical resources allocated to the at least one user terminal according to the resource demand of the user terminal, after the physical resources in the resource pool are scaled down, and the amount of available physical resources after scaling down is the sum of the target reserved value and the resource demand.
2. The method according to claim 1, characterized in that: The method further comprises: When the master device determines that the resource demand corresponding to the at least one user terminal is greater than or equal to the available physical resources in the resource pool, the physical resources in the resource pool are expanded according to the target upper limit value; the target upper limit value is used to indicate the maximum limit of the physical resources allocated to the resource pool, and the target upper limit value refers to the amount of physical resources in the resource pool that are not allocated to the user terminal after the physical resources in the resource pool are expanded, except for the physical resources allocated to the at least one user terminal according to the resource demand of the user terminal, and the available physical resources after expansion are the sum of the target upper limit value and the resource demand.
3. The method according to claim 1 or 2, characterized in that: The physical resources include at least one of CPU resources, network resources, and memory resources.
4. A resource management device, characterized in that: The device is applied to a master device in a cluster, the cluster is provided with a resource pool, and the cluster includes at least one user terminal; the device includes: A training target model module, used for training a target model through at least one sample data, wherein the sample data includes a historical resource demand and an available physical resource amount in the resource pool when the master device responds to the historical resource demand; A processing module, used for determining a target reservation value according to the target model; A resource requirement acquisition module, used to acquire the resource requirement corresponding to at least one user terminal; the resource requirement is used to represent the amount of physical resources required by the at least one user terminal to perform the respective tasks; A capacity reduction module is used to reduce the physical resources in the resource pool according to a target reserved value when it is determined that the resource demand corresponding to the at least one user terminal is less than the available physical resources in the resource pool; the target reserved value is used to indicate the minimum limit of the physical resources allocated to the resource pool, and the target reserved value refers to the amount of physical resources in the resource pool that are not allocated to user terminals except for the physical resources allocated to the at least one user terminal according to the resource demand of the user terminal after the physical resources in the resource pool are reduced, and the amount of available physical resources after reduction is the sum of the target reserved value and the resource demand.
5. The device according to claim 4, characterized in that The device also includes: An expansion module is used to expand the physical resources in the resource pool according to a target upper limit value when the main device determines that the resource demand corresponding to the at least one user terminal is greater than or equal to the available physical resources in the resource pool; the target upper limit value is used to indicate the maximum limit of the physical resources allocated to the resource pool, and the target upper limit value refers to the amount of physical resources in the resource pool that are not allocated to user terminals after the physical resources in the resource pool are expanded, except for the physical resources allocated to the at least one user terminal according to the resource demand of the user terminal, and the available physical resources after expansion are the sum of the target upper limit value and the resource demand.
6. The device according to claim 4 or 5, characterized in that: The physical resources include at least one of CPU resources, network resources, and memory resources.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
System resource dynamic capacity expanding and shrinking method and device, computer device and storage medium
CN109766182A