CN-116302540-B - Resource management method, device, electronic equipment and medium
Abstract
The disclosure provides a resource management method, a device, electronic equipment and a medium, relates to the technical field of computers, and particularly relates to the technical field of equipment management and application management. The method comprises the steps of determining whether node expansion or node contraction is needed for a node set, selecting nodes from node inventory according to the order of low price to high price if the node expansion or the node contraction is needed for the node set, taking the selected nodes as idle dynamic nodes, adding the idle dynamic nodes into the node set until the number of the idle dynamic nodes in the node set is a preset number, wherein the service application is not operated in the nodes in the node inventory and the idle dynamic nodes. If the node contraction is determined to be needed, deleting the nodes from the idle dynamic nodes of the node set according to the order of the price from high to low until the number of the idle dynamic nodes in the node set is a preset number. Thus realizing more targeted node expansion and contraction capacity.
Inventors
- Shi nansheng
- LI ZHE
- CAO JIAO
Assignees
- 北京百度网讯科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20230321
Claims (20)
- 1. A resource management method, comprising: Determining whether node expansion or node contraction is required for the node set; If the node expansion is determined to be needed for the node set, selecting nodes from node inventory according to the order from low price to high price, taking the selected nodes as idle dynamic nodes, and adding the nodes into the node set until the number of the idle dynamic nodes in the node set is a preset number, wherein the nodes in the node inventory and the idle dynamic nodes do not run service applications; If the node contraction is determined to be needed to be carried out on the node set, deleting the nodes from idle dynamic nodes of the node set according to the order from high price to low price until the number of the idle dynamic nodes in the node set is the preset number, wherein the node set further comprises used dynamic nodes, and service applications are run in the used dynamic nodes; Determining whether a target node exists in idle dynamic nodes added into the node set when the current node expands, wherein the price of the target node is lower than that of the used dynamic nodes; If so, migrating the business application copy in the used dynamic node to the target node; and updating the used dynamic node to be an idle dynamic node, and updating the target node to be the used dynamic node.
- 2. The method of claim 1, the set of nodes further comprising a used fixed node in which a business application is running and an idle fixed node in which no business application is running, the price of the used fixed node being lower than the price of the used dynamic node, the price of the idle fixed node being lower than the price of the idle dynamic node, the method further comprising, prior to the determining whether there is a target node in the idle dynamic nodes that join the set of nodes at the time of the node expansion: determining whether a target copy is operated in the used dynamic node, wherein the target copy is a copy which is created for the currently operated business application for the first time; if yes, determining whether the residual memory of the used fixed node is larger than or equal to the rated memory required by the target copy; If the target copy is greater than or equal to the used fixed node, migrating the target copy to the used fixed node; If the target copy is smaller than the fixed node, the target copy is migrated to an idle fixed node, and the idle fixed node is updated to be a used fixed node.
- 3. The method of claim 1, after the selecting the node as an idle dynamic node and joining the node set until the number of idle dynamic nodes in the node set is a preset number, the method further comprising: according to the configuration quantity of various preset dependent environment types counted in the current counting period, screening a first preset number of target types according to the sequence from high to low of the configuration quantity; Aiming at each target type, screening a second preset number of dependent environments according to the configuration quantity of each dependent environment of the target type counted in the current counting period and the sequence from high to low of the configuration quantity; grouping idle dynamic nodes added into the node set during capacity expansion of the current node according to the proportion of configuration quantities of various target types in the current statistical period; And aiming at each group of idle dynamic nodes, configuring a second preset number of dependent environments corresponding to a specified type in the group of idle dynamic nodes, wherein the specified type is a target type corresponding to a proportion item to which the group of idle dynamic nodes belong.
- 4. The method of claim 3, after said configuring a second predetermined number of dependent environments corresponding to a specified type within each set of idle dynamic nodes, the method further comprising: and mounting the mirror image storage paths of the group of idle dynamic nodes to a distributed file system aiming at each group of idle dynamic nodes, so that when the group of idle dynamic nodes create a copy of the service application, the mirror image of the service application is obtained from the distributed file system under the condition that the mirror image of the service application is not stored locally, wherein the mirror image is used for creating the copy of the service application.
- 5. The method of claim 4, the method further comprising: Detecting whether the mirror image data amount in the distributed file system reaches a threshold value; If yes, deleting the unused mirror images and the mirror images with the time length from the last time of use to the current time being greater than a time length threshold in the distributed file system.
- 6. The method of claim 1, the set of nodes further comprising an idle fixed node, a used fixed node, and a used dynamic node, business applications not running within the idle fixed node, business applications running within the used fixed node and the used dynamic node, the used fixed node having a price that is lower than a price of the used dynamic node, the idle fixed node having a price that is lower than a price of the idle dynamic node, the method further comprising: And under the condition that the copy needs to be created for one business application for the first time, sequentially determining whether the residual memory of a node is greater than or equal to the rated memory required by the copy according to the sequence from the used fixed node, the idle fixed node and the used dynamic node to the idle dynamic node until the residual memory of any node is greater than or equal to the rated memory required by the copy is determined, and creating the copy in the node.
- 7. The method of claim 1, wherein the set of nodes further comprises used dynamic nodes having business applications running therein, the method further comprising: Under the condition that one service application running currently needs to be expanded, determining whether the used dynamic node meets a first configuration condition aiming at each copy needing to be expanded by the service application, wherein the first configuration condition comprises that the residual memory of the node is larger than or equal to the rated memory required by the copy, and the dependent environment of node configuration comprises the dependent environment required by the copy; If yes, creating the copy in the used dynamic node; If not, determining whether a first idle dynamic node meeting the first configuration condition exists; if the first idle dynamic node exists, the copy is created in the first idle dynamic node.
- 8. The method of claim 7, after the determining whether there is a first idle dynamic node that satisfies the first configuration condition, the method further comprising: If the first idle dynamic node does not exist, determining whether the used dynamic node meets a second configuration condition, wherein the second configuration condition comprises that the residual memory of the node is larger than or equal to the rated memory required by the copy; If yes, creating the copy in the used dynamic node; If not, determining whether a second idle dynamic node meeting the second configuration condition exists; if the second idle dynamic node exists, the copy is created in the second idle dynamic node.
- 9. The method of any one of claims 1-8, further comprising: And deleting the copies with the specified volume reduction number from each specified copy of the service application under the condition that the currently running service application is determined to be required to be volume reduced, wherein the dependent environment of node configuration of the specified copies is different from the dependent environment required by the copies of the service application.
- 10. A resource management device, comprising: The determining module is used for determining whether node expansion or node contraction is needed to be carried out on the node set; The node capacity expansion module is used for selecting nodes from node stock according to the order of low price to high price if the determining module determines that the node capacity expansion is required for the node set, taking the selected nodes as idle dynamic nodes and adding the nodes into the node set until the number of the idle dynamic nodes in the node set is a preset number, wherein the nodes in the node stock and the idle dynamic nodes do not operate business applications; The node capacity reduction module is used for deleting nodes from idle dynamic nodes in the node set according to the order of the price from high to low if the determining module determines that the node capacity reduction is required to be carried out on the node set, until the number of the idle dynamic nodes in the node set is the preset number, and the node set further comprises used dynamic nodes, wherein service applications are run in the used dynamic nodes; the judging module is used for determining whether a target node exists in idle dynamic nodes added into the node set when the current node expands, and the price of the target node is lower than that of the used dynamic nodes; the migration module is used for migrating the business application copy in the used dynamic node to the target node if the judging result of the judging module is that the business application copy exists; And the updating module is used for updating the used dynamic node into an idle dynamic node and updating the target node into the used dynamic node.
- 11. The apparatus of claim 10, the set of nodes further comprising a used fixed node having a business application running therein and an idle fixed node having no business application running therein, the price of the used fixed node being lower than the price of the used dynamic node and the price of the idle fixed node being lower than the price of the idle dynamic node, the apparatus further comprising: The judging module is further configured to determine, before determining whether a target node exists in an idle dynamic node added to the node set when the node is expanded, whether a target copy is running in the used dynamic node, where the target copy is a copy created for a currently running service application for the first time; The judging module is further configured to determine whether remaining memory of the used fixed node is greater than or equal to a rated memory required by the target copy if yes; The migration module is further configured to migrate the target copy to the used fixed node if the determination result of the determination module is greater than or equal to the determination result; And the migration module is further configured to migrate the target copy to an idle fixed node if the determination result of the determination module is smaller than the determination result, and update the idle fixed node to be a used fixed node.
- 12. The apparatus of claim 10, the apparatus further comprising: the screening module is used for screening a first preset number of target types according to the configuration quantity of various preset dependent environment types counted in the current counting period and the sequence from high to low according to the configuration quantity after the selected node is used as an idle dynamic node and the node set is added until the number of the idle dynamic nodes in the node set is the preset number; The screening module is further used for screening a second preset number of dependent environments according to the configuration quantity of each dependent environment of the target type counted in the current counting period and the sequence from high to low of the configuration quantity; The grouping module is used for grouping idle dynamic nodes added into the node set during capacity expansion of the current node according to the proportion of the configuration quantity of various target types in the current statistical period; The configuration module is used for configuring a second preset number of dependent environments corresponding to the designated type in the group of idle dynamic nodes aiming at each group of idle dynamic nodes, wherein the designated type is a target type corresponding to a proportion item to which the group of idle dynamic nodes belong.
- 13. The apparatus of claim 12, the apparatus further comprising: The mounting module is configured to mount, for each group of idle dynamic nodes, a mirror image storage path of the group of idle dynamic nodes to a distributed file system after a second preset number of dependent environments corresponding to a specified type are configured in the group of idle dynamic nodes, so that when the group of idle dynamic nodes create a copy of a service application, the mirror image of the service application is obtained from the distributed file system without storing the mirror image of the service application locally, wherein the mirror image is used for creating the copy of the service application.
- 14. The apparatus of claim 13, the apparatus further comprising: the detection module is used for detecting whether the mirror image data volume in the distributed file system reaches a threshold value or not; and the deleting module is used for deleting the unused mirror images in the distributed file system and the mirror images with the time length from the last time of use to the current time being greater than a time length threshold value if the detection result of the detecting module is yes.
- 15. The apparatus of claim 10, the set of nodes further comprising an idle fixed node, a used fixed node, and a used dynamic node, no business applications running within the idle fixed node, the used fixed node and the used dynamic node running within the business applications, the used fixed node having a price that is lower than a price of the used dynamic node, the idle fixed node having a price that is lower than a price of the idle dynamic node, the apparatus further comprising: And the creation module is used for sequentially determining whether the residual memory of a node is greater than or equal to the rated memory required by the copy according to the sequence from the used fixed node, the idle fixed node and the used dynamic node to the idle dynamic node under the condition that the copy needs to be created for one business application for the first time until the residual memory of any node is greater than or equal to the rated memory required by the copy is determined, and creating the copy in the node.
- 16. The apparatus of claim 10, the set of nodes further comprising a used dynamic node having a business application running therein, the apparatus further comprising: The judging module is used for determining whether the used dynamic node meets a first configuration condition or not according to each copy which is required to be expanded by the service application and is required to be expanded by the service application when determining that the currently running service application is required to be expanded, wherein the first configuration condition comprises that the residual memory of the node is larger than or equal to the rated memory required by the copy, and the dependence environment of the node configuration comprises the dependence environment required by the copy; the creation module is used for creating the copy in the used dynamic node if the judging result of the judging module is satisfied; the judging module is further configured to determine whether a first idle dynamic node that meets the first configuration condition exists; the creating module is further configured to create the copy in the first idle dynamic node if the determination result of the determining module is the first idle dynamic node.
- 17. The apparatus of claim 16, the apparatus further comprising: The judging module is further configured to determine, after the determining whether a first idle dynamic node that meets the first configuration condition exists, if the first idle dynamic node does not exist, whether the used dynamic node meets a second configuration condition, where the second configuration condition includes that a remaining memory of a node is greater than or equal to a rated memory required by the copy; the creation module is further configured to create the copy in the used dynamic node if the determination result of the determination module is satisfied; the judging module is further configured to determine whether a second idle dynamic node that meets the second configuration condition exists if the second idle dynamic node does not meet the second configuration condition; the creating module is further configured to create the copy in the second idle dynamic node if the determination result of the determining module is the second idle dynamic node.
- 18. The apparatus according to any one of claims 10-17, further comprising: and the deleting module is used for deleting the copies with the specified volume reduction number from each specified copy of the service application under the condition that the currently running service application needs volume reduction, wherein the dependent environment of the node configuration of the specified copies is different from the dependent environment required by the copies of the service application.
- 19. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
- 20. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-9.
Description
Resource management method, device, electronic equipment and medium Technical Field The present disclosure relates to the field of computer technologies, and in particular, to the technical field of device management and application management. Background With the increasing popularity of serverless (SERVERLESS) technology, more and more platform-type products based on SERVERLESS technology are being created that can provide function computing services, apply full-hosted services, or flexible container services, etc. The application full-hosting service is based on a container orchestration engine (Kubernetes) and container technology, can host the application for users, and adaptively and elastically stretches the application according to the size of traffic. Disclosure of Invention The disclosure provides a resource management method, a device, electronic equipment and a medium. In a first aspect of an embodiment of the present disclosure, there is provided a resource management method, including: Determining whether node expansion or node contraction is required for the node set; If the node expansion is determined to be needed for the node set, selecting nodes from node inventory according to the order from low price to high price, taking the selected nodes as idle dynamic nodes, and adding the nodes into the node set until the number of the idle dynamic nodes in the node set is a preset number, wherein the nodes in the node inventory and the idle dynamic nodes do not run service applications; if the node contraction is determined to be needed to be carried out on the node set, deleting the nodes from the idle dynamic nodes of the node set according to the order of the price from high to low until the number of the idle dynamic nodes in the node set is the preset number. In a second aspect of the embodiments of the present disclosure, there is provided a resource management apparatus including: The determining module is used for determining whether node expansion or node contraction is needed to be carried out on the node set; The node capacity expansion module is used for selecting nodes from node stock according to the order of low price to high price if the determining module determines that the node capacity expansion is required for the node set, taking the selected nodes as idle dynamic nodes and adding the nodes into the node set until the number of the idle dynamic nodes in the node set is a preset number, wherein the nodes in the node stock and the idle dynamic nodes do not operate business applications; and the node capacity reduction module is used for deleting the nodes from the idle dynamic nodes of the node set according to the order of the price from high to low until the number of the idle dynamic nodes in the node set is the preset number if the determining module determines that the node capacity reduction is required to be carried out on the node set. In a third aspect of the disclosed embodiments, there is provided an electronic device, including: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the first aspects. A fourth aspect of embodiments of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method according to any one of the first aspects. A fifth aspect of embodiments of the present disclosure provides a computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of the first aspects. It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification. Drawings The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein: FIG. 1 is a flow chart of a method of resource management provided by an embodiment of the present disclosure; FIG. 2 is a flow chart of an application migration method provided by an embodiment of the present disclosure; FIG. 3 is a flow chart of a method of configuring a dependent environment provided by an embodiment of the present disclosure; FIG. 4 is an exemplary schematic diagram of a configuration dependent environment process provided by an embodiment of the present disclosure; FIG. 5 is an exemplary schematic diagram of a mirror sharing process provided by an embodiment of the present disclosure; FIG. 6 is a flow chart of a method of creating a copy provided by an embodiment of the present disclosure; FIG. 7 is an exemplary schematic diagram of a resource managem