Resource configuration method, electronic equipment and storage medium

By monitoring the business steps and resource estimates of virtual nodes and dynamically adjusting resource quotas, the problem of low resource utilization of virtual nodes is solved, and load balancing and efficient resource utilization are achieved.

CN120335976APending Publication Date: 2025-07-18ZTE CORP
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410078757.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-18
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, the resource quota of virtual nodes cannot be dynamically adjusted once created, resulting in the host's resource utilization rate not high when serving multiple users, and the load balancing cannot be achieved.

Method used

By monitoring the business steps and resource estimates to be performed by the virtual node, the resource quota of the virtual node is dynamically adjusted to ensure that it can complete the remaining tasks and improve resource utilization.

Benefits of technology

The load balancing of virtual node resource quotas is realized, and the utilization rate of resources and task execution efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120335976A_ABST
    Figure CN120335976A_ABST
Patent Text Reader

Abstract

The invention provides a resource configuration method, electronic equipment and a storage medium. The method comprises the following steps: determining a to-be-executed service step corresponding to a virtual node; and adjusting the resource quota of the virtual node according to the resource estimated quantity corresponding to the to-be-executed service step, so that the virtual node executes the to-be-executed service step based on the adjusted resource quota. According to the invention, load-balanced dynamic allocation of the resource quota of the virtual nodes can be realized, so that the resource utilization rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of resource scheduling, and in particular, to a resource allocation method, an electronic device, and a storage medium. Background Art

[0002] A virtual node is a node partitioned on a host machine (physical machine or virtual machine) based on virtualization technology and is used to execute specific tasks.

[0003] In existing related applications, when a user has a task to run on a host machine, a virtual node with a resource quota matching the resource estimate of the task is applied to the system for creation. Once the virtual node is created, its resource quota will remain unchanged until the user task is completed and then destroyed. In this way, a virtual node is equivalent to an exclusive resource for a user, and for the scenario where a host machine serves multiple users, it is impossible to dynamically adjust the resource quotas of each virtual node for load balancing, resulting in low resource utilization. Summary of the Invention

[0004] The purpose of this application is to provide a resource allocation method, an electronic device, and a storage medium, which can achieve dynamic allocation of load balancing for the resource quotas of virtual nodes, thereby improving resource utilization.

[0005] To achieve the above purpose, the embodiments of this application are implemented as follows:

[0006] In a first aspect, a resource allocation method is provided, including:

[0007] Determine the business steps to be executed corresponding to the virtual node;

[0008] Adjust the resource quota of the virtual node according to the resource estimate corresponding to the business steps to be executed, so that the virtual node executes the business steps to be executed based on the adjusted resource quota.

[0009] In a second aspect, an embodiment of this application provides an electronic device, including: a processor; and a memory configured to store computer-executable instructions, and the computer-executable instructions, when executed, cause the processor to execute the method described in the first aspect.

[0010] In a third aspect, a computer-readable storage medium is provided, and the computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the method described in the first aspect.

[0011] The solution of this application can monitor the remaining service steps to be executed by the virtual node, and reasonably adjust the resource quota of the virtual node according to the estimated amount of resources for the remaining service steps, so as to achieve dynamic scheduling of load balancing for the resource quota of the virtual node while ensuring that the virtual node can complete the remaining service steps, and improve the utilization rate of resources. Description of the Drawings

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to these drawings.

[0013] Figure 1 Schematic diagram after a user task is assigned to a virtual node.

[0014] Figure 2 Schematic flowchart of the resource configuration method according to the embodiment of the present application.

[0015] Figure 3 The first schematic flowchart of the application of the resource configuration method according to the embodiment of the present application in a distributed system.

[0016] Figure 4 Schematic diagram of the format of the resource description file in the resource configuration method according to the embodiment of the present application.

[0017] Figure 5 The second schematic flowchart of the application of the resource configuration method according to the embodiment of the present application in a distributed system.

[0018] Figure 6 The third schematic flowchart of the application of the resource configuration method according to the embodiment of the present application in a distributed system.

[0019] Figure 7 Schematic diagram of the structure of the resource configuration device according to the embodiment of the present application.

[0020] Figure 8 Schematic diagram of the structure of the electronic device according to the embodiment of the present application. Detailed Embodiments

[0021] As described above, in the prior art, when a user has a task to run on a host, a virtual node with a resource quota matching the estimated amount of resources for the task will be applied to the system for creation.

[0022] The resource quota of a virtual node should be able to support the running of user tasks. If the user task is split into different business steps for serial execution, the resource quota of the virtual node should be the estimated resource amount corresponding to the business step with the highest performance requirement.

[0023] For example Figure 1 As shown, the user task consists of business steps 1, 2, and 3 for serial execution. Among them: the estimated resource amount for business step 1 is 1 CPU core and 1G of memory; the estimated resource amount for business step 2 is 2 CPU cores and 2G of memory; the estimated resource amount for business step 3 is 2 CPU cores and 1G of memory. The virtual node created for the user task should configure the resource quota according to the estimated resource amount of business step 2, for example Figure 1 As shown, 2 CPU cores and 2G of memory.

[0024] Currently, once a virtual node is created, its resource quota will remain unchanged until it is destroyed after the user task is executed.

[0025] Taking the Figure 1 virtual node in as an example, when the virtual node sequentially executes business steps 1 and 2, the remaining estimated resource amount for the to-be-executed business step 3 is 2 CPU cores and 1G of memory. At this time, 1G of memory will be idle in the resource configuration of the virtual node, and this 1G of idle memory is the exclusive resource of this virtual node and cannot be scheduled for use by other virtual nodes.

[0026] It can be seen that when the host serves multiple users (for example, the host adopts the architecture of a distributed system), since the resource quotas of each virtual node cannot be dynamically adjusted for load balancing, some virtual nodes will have a waste of resource quotas, and the overall resource utilization rate of the host is not high.

[0027] To address the above problems, the present application aims to propose a resource configuration scheme that can monitor the remaining business steps to be executed by a virtual node and adjust the resource quota of the virtual node according to the estimated resource amount of the remaining business steps, so as to achieve dynamic load balancing of the resource quota of the virtual node while ensuring that the virtual node can complete the remaining business steps, thereby improving the resource utilization rate.

[0028] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this specification.

[0029] An embodiment of the present application provides a resource allocation method. Figure 1 It is a flowchart of the resource allocation method, including:

[0030] S202, determining the business steps to be executed corresponding to the virtual node.

[0031] In this embodiment, a physical machine or a virtual machine is regarded as a resource body, and a virtual node is a node divided on the resource body based on virtualization technology.

[0032] When a user has a task (hereinafter collectively referred to as a user task) that needs to run on the resource body, the user can apply to the system to create a virtual node. If the system accepts the application, a virtual node is created in the resource body, and the user task is configured to be executed in the newly created virtual node.

[0033] As an exemplary introduction, in this embodiment, the resource estimation amount of each business step in the user task can be determined through historical experience or machine prediction, and the initial resource quota of the virtual node is determined according to the resource estimation amount of the largest business step.

[0034] In practical applications, the resource body can serve multiple users, and each user can apply to the resource body for at least one user task according to their own needs. For multiple user tasks applied to the resource body, this embodiment can select at least one target user task that can be executed by the current idle resources, and create corresponding virtual nodes in the resource body for each target user task, so as to allocate the business steps of each target user task to the corresponding virtual nodes for execution.

[0035] On the above basis, virtual nodes can also be created in combination with a certain user fairness principle. For example, for users who have used the resources of the resource body less frequently before, the priority of creating their virtual nodes is higher than that of users who have used the resources of the resource body more frequently before.

[0036] To this end, multiple users can be sorted in ascending order according to the resource shares they have been allocated in the resource body; then, at least one target user is selected from multiple users according to the sorting of the priorities of multiple users, and multiple user tasks are selected from all user tasks submitted by at least one target user; next, as many target user tasks that can be executed by the current idle resources as possible are selected from the selected multiple user tasks.

[0037] For ease of understanding, a simple example is introduced here. Suppose users A, B, and C have all applied to the system for user tasks. User A has applied for 2 user tasks, user B has applied for 1 user task, and user C has applied for 3 user tasks. Among them, the priority of user A is higher than that of user C, and the priority of user C is higher than that of user B. According to the sorting of user priorities, the user tasks of user 1 can be preferentially responded to create virtual nodes. If there are still idle resources after creating virtual nodes for the two user tasks of user A in the current resource body, then virtual nodes can be created for the user tasks of user C next. Similarly, if there are still idle resources after creating virtual nodes for the user tasks of user C in the resource body, then virtual nodes can be created for the user tasks of user B next.

[0038] On the above basis, this embodiment can evaluate the resource share allocated to the user in the resource body according to the user's past resource usage amount and resource usage duration for the resource body. The significance of introducing the resource usage duration in this embodiment is that some user tasks that occupy a lower virtual node resource quota but have a too long execution time can also be counted as having a higher allocated resource share.

[0039] As an exemplary introduction, a first parameter of the user's personal resource usage situation can be determined according to the resource usage amount and resource usage duration of all the virtual nodes allocated to the user in the resource body. This first parameter is the resource share allocated to the user in the resource body, and the resource share allocated to the user in the resource body is determined based on the first parameter. Or, the second parameter of the overall resource usage situation of all users in the resource body can also be determined according to the total resource usage amount and total resource usage duration of the current virtual nodes in the resource body, and the resource share allocated to the user in the resource body is determined according to the ratio between the first parameter and the second parameter.

[0040] The above is an introduction to how to create virtual nodes in the resource body. Based on this step, the business steps to be executed corresponding to the virtual nodes can be dynamically determined according to the task progress of the virtual nodes.

[0041] For example: in the case where the number of virtual nodes in the resource body changes, determine the business steps to be executed corresponding to the virtual nodes; in the case where the business steps completed by the virtual nodes are updated, determine the business steps to be executed corresponding to the virtual nodes; in the case where the resource quota adjustment interval of the virtual node exceeds the preset time, determine the business steps to be executed corresponding to the virtual nodes.

[0042] S204. Adjust the resource quota of the virtual node according to the resource estimation amount corresponding to the business step to be executed, so that the virtual node executes the business step to be executed based on the adjusted resource quota.

[0043] As one implementation, the minimum resource specification or the optimal resource specification for a virtual node to execute a business step to be executed can be determined according to the estimated amount of resources corresponding to the business step to be executed, and the resource quota of the virtual node can be adjusted to the minimum resource specification or the optimal resource specification.

[0044] Take Figure 1 the virtual node shown as an example. After the virtual node completes the execution of business steps 1 and 2, the estimated amount of resources for the remaining business step 3 is 2 CPU cores and 1 GB of memory. At this time, according to the principle of the minimum resource specification required to execute business step 3, the resource quota configuration of the virtual node can be changed from the original 2 CPU cores and 2 GB of memory to 2 CPU cores and 1 GB of memory (2 CPU cores and 1 GB of memory is the minimum resource specification for executing business step 3); alternatively, according to the optimal resource specification required to execute business step 3, the resource quota configuration of the virtual node can be changed from the original 2 CPU cores and 2 GB of memory to 2 CPU cores and 1.5 GB of memory. That is, compared with the minimum resource specification, an additional 0.5 GB of memory is reserved for use when executing business step 3, thereby improving the execution efficiency of business step 3.

[0045] It should be understood that the reduced resource quota of the virtual node can be reused as the idle resource of the resource body to be allocated to other virtual nodes in need or to create new virtual nodes.

[0046] In the case where the resource body has idle resources and there are no user tasks, the idle resources can be allocated to the virtual nodes of the resource body to be used as over-allocated resource quotas. Among them, the virtual nodes can use the over-allocated resource quotas to process user tasks faster, thereby improving the task execution efficiency.

[0047] It should be understood that the over-allocated resource quota is not included in the normal allocated resource quota of the virtual node itself. Once the resource body receives an application for a new user task, the over-allocated resource quota of the current virtual node can be released. Among them, the released over-allocated resource quota is reused as the idle resource of the resource body to provide resource support for creating virtual nodes for new user tasks.

[0048] In practical applications, the method of this embodiment can be deployed in a distributed system (especially a continuously integrated distributed system). That is, the distributed system creates virtual nodes as a resource body to provide distributed services for different users. At the same time, the distributed system dynamically adjusts the resource allocation of the virtual nodes in combination with the principles of load balancing, user fairness, and maximizing the execution of user tasks to improve the overall resource utilization rate.

[0049] The application of the method of this embodiment to a distributed system will be introduced below.

[0050] The method of this embodiment mainly includes, when applied to the scenario of a distributed system: the creation process of virtual nodes, the dynamic adjustment process of virtual node resource quotas when the free resources of a resource body are insufficient, and the dynamic adjustment process of virtual node resource quotas when the free resources of a resource body are sufficient.

[0051] Among them, Figure 3 is a schematic diagram of the creation process of virtual nodes, including:

[0052] S301, distributively accept user tasks submitted by each user.

[0053] In this embodiment, each user can submit one or more user tasks.

[0054] Normally, each user task corresponds to a resource description file, which is used to describe the estimated resource amount of each business step in the user task.

[0055] Refer to Figure 4 , Figure 4 illustrates a resource description file in a standard format. For the target user task, according to the serial execution order, the business steps are divided into business step groups 1, 2... m. That is, first execute the business steps in business step group 1, then execute the business steps in business step group 2, and so on, and finally execute the business steps in business step group m. On this basis, each business step group also corresponds to its own attribute information, which is used to indicate whether the business steps in the business step group are executed in parallel or in series.

[0056] For example, if the attribute of business step group 1 is serial execution, then it is necessary to sequentially execute business steps 1 to business step n in order; for another example, if the attribute of business step group 1 is parallel execution, then it is necessary to execute business steps 1 to business step n simultaneously.

[0057] It should be noted that Figure 4 is only used for an exemplary introduction to the resource description file and does not limit the protection scope of this specification. As other feasible methods, this embodiment can also merge the business steps that need to be executed in parallel in the user task into one business step (the remaining business steps after merging are all executed serially), and configure the expected resource specifications for each remaining business step after merging.

[0058] S302, preprocess the resource description files of each user task.

[0059] The preprocessing of this embodiment can, for user tasks that lack a resource description file or whose resource description file does not adopt the standard format, recreate the resource description file according to the following process:

[0060] 1) Structured processing: Generate a template for the resource description file of the user task in a structured manner according to the standard format of the resource description file.

[0061] 2) Information entry: For the business steps with the resource estimation amount already recorded, add the information of the resource estimation amount to the corresponding position in the template; for the business steps lacking the resource estimation amount, a suitable resource estimation amount can be determined based on the historical resource occupancy of this business step and added to the corresponding position in the template.

[0062] 3) Output: Output the resource description file in the standard format.

[0063] S303. Create a virtual node that matches the initial resource quota for the user task according to the resource description file of the user task.

[0064] It should be understood that the idle resources of the resource body are limited, and it is not possible to guarantee the creation of virtual nodes for each user task. In this embodiment, on the principle of ensuring user fairness, virtual nodes are created for as many user tasks as possible.

[0065] In the specific implementation, the user task generally focuses on one of the resources of the resource body, such as CPU, memory, and disk, etc. In this embodiment, the resource focused by the user task is defined as the dominant resource.

[0066] As a feasible implementation method, assume that the total number of resource types of the resource body is I. If the ratio between the resource share of the user task for the i-th resource and the total resource amount on the resource body is the largest, then the i-th resource can be used as the dominant resource of the user task.

[0067] Correspondingly, the dominant share is used to represent the resource usage amount corresponding to all the virtual nodes allocated to the user for the dominant resource in the resource body. The calculation formula for this dominant share is:

[0068] MRi = Oi / Ri;

[0069] In the formula, MRi is the share of the i-th resource; Oi is the resource usage amount of the user for all the allocated virtual nodes under the i-th resource; Ri is the total resource usage amount of the current virtual nodes in the resource body under the i-th resource.

[0070] Based on the dominant share, the resource usage duration already allocated by the user for the dominant resource is further introduced to obtain the "dominant share time". The calculation formula for this dominant share is:

[0071] MRTi = Oi * RunTi / (Ri * OnTi);

[0072] Wherein, RunTi is the resource usage duration of the user on all allocated virtual nodes under the i-th type of resource; OnTi is the total resource usage duration of the virtual nodes before the resource body under the i-th type of resource. Oi and RunTi are the first parameters described above, and Ri and OnTi are the second parameters described above.

[0073] It should be understood that the dominant share quantifies the resource share occupied by the user for the resource body in terms of two dimensions: the resource usage amount and the resource usage duration of the user for the dominant resource. For some user tasks that occupy a relatively low amount of the dominant resource but have a long occupation time, they can also be counted as users having occupied a relatively high resource share.

[0074] Therefore, in this embodiment, the users can be sorted by priority in ascending order of the dominant share. That is, the fewer the resource usage duration and the resource usage amount of the user task for the dominant resource in the past, the higher the priority, so as to reflect fairness among users.

[0075] In addition, as another feasible method, in this embodiment, the users can also be sorted by priority in ascending order of the usage duration for the current virtual node; or sorted by priority in descending order of the usage duration since the last virtual node, which will not be elaborated one by one here.

[0076] After sorting all users, a part of the target users can be selected in the order of priority, and the user tasks submitted by each target user can be regarded as a typical bin-packing problem as follows.

[0077] Goods: The estimated resource amount of the user task to be executed selected by each target user;

[0078] Bin: The idle resources of the current virtual node.

[0079] Through the general algorithm of the bin-packing problem, the combination with the maximum resource utilization rate can be calculated, so as to obtain which user tasks of the target users will be executed.

[0080] After that, use the idle resources of the resource body to create virtual nodes for all user tasks of the target users that will be executed.

[0081] The above is the introduction of the virtual node creation process. When the virtual node completes all business processes of the corresponding user task, it can be cancelled, and the resource quota of the cancelled virtual node will be returned to the resource body again as idle resources.

[0082] On the basis above, in this embodiment, it is also necessary to perform dynamic adjustment of resource quotas for the virtual nodes that have been created in the resource body. Among them, there are two execution logics corresponding to the dynamic adjustment of resource quotas: one is executed when the idle resources are insufficient, that is, the idle resources are not enough to create virtual nodes for all user tasks; the other is executed when the idle resources are sufficient, that is, all user tasks have created virtual nodes, and the resource body still has idle resources.

[0083] For the situation where the idle resources of the resource body are insufficient, the dynamic adjustment process of the virtual node resource quota is as Figure 5 shown, including:

[0084] S501, determine the business steps to be executed by each current virtual node in the resource body.

[0085] In this embodiment, a business step queue can be configured for each created virtual node in the resource body. The business step queue is used to place the remaining business steps to be executed by the virtual node in the execution order, as well as the corresponding ones.

[0086] For example:

[0087] Business step queue of virtual node 1: Business step 4 of user 1, Business step 5 of user 1;

[0088] Business step queue of virtual node 2: Business step 2 of user 2, Business step 3 of user 2.

[0089] Correspondingly, in this embodiment, through the business step queues of each virtual node, the business steps to be executed by each virtual node can be understood.

[0090] S502, determine the resource estimation amount corresponding to the largest business step to be executed in each virtual node.

[0091] As one implementation method, in this embodiment, the resource estimation amounts of each business step to be executed can be recorded in the business step queue. For example:

[0092] Business step queue of virtual node 1: Business step 4 of user 1 (1 CPU core / 2g memory), Business step 5 of user 1 (2 CPU cores / 4g memory);

[0093] Business step queue of virtual node 2: Business step 2 of user 2 (4 CPU cores / 8g memory), Business step 3 of user 2 (2 CPU cores / 4g memory;).

[0094] Correspondingly, the estimated resource amount corresponding to the largest to-be-executed business step can be found according to the business step queue of the virtual node. For example, the estimated resource amount of business step 5 in virtual node 1: 2 CPU cores / 4 g of memory; the estimated resource amount of business step 2 in virtual node 2: 4 CPU cores / 84 g of memory.

[0095] As another implementation manner, in this embodiment, the estimated resource amount corresponding to the largest to-be-executed business step can also be determined according to the resource description file of the user task corresponding to the virtual node. Since the information format of the resource description file has been introduced, it will not be elaborated here.

[0096] S503. For each virtual node, when the estimated resource amount corresponding to the largest to-be-executed business step is less than the current resource quota, adjust the current resource quota to the estimated resource amount corresponding to the largest to-be-executed business step.

[0097] Taking the business step queue of virtual node 1: business step 4 of user 1 (1 CPU core / 2 g of memory), business step 5 of user 1 (2 CPU cores / 4 g of memory) as an example.

[0098] Assume that the current resource quota of virtual node 1 is 4 CPU cores / 8 g of memory. As long as it is ensured that the adjusted resource quota can satisfy the execution of business step 5, for this purpose, 2 surplus CPU cores and 4 g of memory can be extracted from the previous resource quota of virtual node 1 and returned to the resource body as idle resources.

[0099] It should be understood that through the Figure 5 process shown, when the idle resources of the resource body are insufficient, the resources non-necessarily occupied by the virtual node are returned as much as possible, so as to ensure that the resource body can create virtual nodes for more user tasks.

[0100] For the case where the idle resources of the resource body are sufficient, the dynamic adjustment process of the virtual node resource quota is as Figure 6 shown, including:

[0101] S601. When there is no user task that needs to create a virtual node in the resource body currently, determine the idle resources of the resource body.

[0102] S602. Based on the proportional balance allocation method or the preemptive allocation method, allocate the idle resources to the virtual nodes of the resource body for use as over-allocated resource quotas.

[0103] Proportional balanced over-allocation means: Based on parameters such as the number of business steps to be executed by virtual nodes and the current resource quota, a certain proportion of idle resources is allocated to idle virtual nodes. For example, virtual nodes with a larger number of business steps to be executed can be allocated more over-allocation resource quotas, or idle virtual nodes with a larger current resource quota can be allocated more over-allocation resource quotas.

[0104] The preemption allocation method means: Each virtual node determines the over-allocation resource quota based on parameters such as its own number of business steps and the current resource quota, and applies for the over-allocation resource quota in a first-come, first-served manner.

[0105] S603, when receiving a new user task that requires creating a virtual node, release the over-allocation resource quota of the virtual node.

[0106] After releasing the over-allocation resource quota in this step, the following Figure 3 shown process can be executed to create a virtual node for the new user task, which will not be elaborated here.

[0107] It should be understood that through the Figure 6 shown process, when there is sufficient idle resource in the resource body, the idle resources can be flexibly allocated to each virtual node for use, thus making full use of the idle resources and improving the efficiency of virtual nodes in executing user tasks.

[0108] In summary, the method of this embodiment has the following characteristics when applied to the scenario of a distributed system:

[0109] 1) Dynamic adjustment of virtual node resource quotas: When a user task (such as building, compiling, etc.) requires a virtual node with a specified resource specification, an initial allocation is made. Subsequently, based on the business steps to be executed on this virtual node and the estimated resources of subsequent operations, the resource quota of the allocated virtual node is dynamically adjusted, so as to achieve the effect of basically matching the resource quota with the resource requirements of the business steps and avoid resource waste.

[0110] 2) User fairness in virtual node creation: Taking the resource share occupied by the user in the resource body as a reference, users are prioritized, and virtual nodes are preferably created for users with a shorter resource usage duration and / or a smaller resource usage amount as much as possible; in addition, based on user fairness, combined with the idle resources of the resource body, virtual nodes are created for more user tasks as much as possible, thereby improving resource utilization.

[0111] 3) Hyper-occupied resource quota of virtual nodes: When there are surplus idle resources in the resource body, the idle resources are allocated to virtual nodes as temporarily invokable hyper-occupied resource quotas for use, thereby improving the efficiency of virtual nodes in executing user tasks. In addition, when idle resources are needed to create new virtual nodes, the temporarily occupied resource quotas of existing virtual nodes are returned to the resource body to ensure that user tasks can be processed normally.

[0112] Corresponding to Figure 2 For the method shown, another embodiment of the present application further proposes a resource configuration device. Figure 7 It is a schematic structural diagram of the resource configuration, including:

[0113] A service step determination module 710, configured to determine the service steps to be executed corresponding to the virtual nodes.

[0114] A resource quota adjustment module 720, configured to adjust the resource quota of the virtual node according to the estimated resource amount corresponding to the service steps to be executed, so that the virtual node executes the service steps to be executed based on the adjusted resource quota.

[0115] The device of this embodiment can monitor the remaining service steps to be executed by the virtual nodes, and adjust the resource quotas of the virtual nodes according to the estimated resource amounts of the remaining service steps, so as to achieve dynamic adjustment of load balancing of the resource quotas of the virtual nodes while ensuring that the virtual nodes can complete the remaining service steps, and can improve the utilization rate of resources.

[0116] Optionally, the device of this embodiment further includes:

[0117] A virtual node creation module, before the service step determination module 710 determines the service steps to be executed corresponding to the virtual nodes, is configured to: obtain multiple user tasks of the resource body to which the virtual node belongs, where each user task includes at least one service step; select at least one target user task to be executed by the idle resources of the resource body from the multiple user tasks; respectively create corresponding virtual nodes in the resource body for each target user task, and allocate the service steps of each target user task to the corresponding virtual nodes for execution.

[0118] Optionally, the service step determination module 710 determines the service steps to be executed corresponding to the virtual nodes, including: determining the service steps to be executed corresponding to the virtual nodes when at least one of the number of virtual nodes in the resource body changes, the service steps executed by the virtual nodes are updated, and the resource quota adjustment interval of the virtual nodes exceeds a preset duration.

[0119] Optionally, before determining the business steps to be executed corresponding to the virtual node, the business step determination module 710 is further configured to: determine the estimated resource volume corresponding to the business steps to be executed according to the resource requirement information corresponding to the business steps to be executed.

[0120] Optionally, the resource quota adjustment module 720 adjusts the resource quota of the virtual node according to the estimated resource volume corresponding to the business steps to be executed, including: determining the minimum resource specification or the optimal resource specification for the virtual node to execute the business steps to be executed according to the estimated resource volume corresponding to the business steps to be executed, and adjusting the resource quota of the virtual node to the minimum resource specification or the optimal resource specification.

[0121] Optionally, the virtual node creation module obtains multiple user tasks of the resource body to which the virtual node belongs, including: determining multiple users who have submitted user tasks to the resource body; sorting the multiple users in ascending order of the resource shares allocated to them in the resource body to obtain the priorities of the multiple users; selecting at least one target user from the multiple users according to the sorting of the priorities of the multiple users, and selecting the multiple user tasks from all the user tasks submitted by the at least one target user.

[0122] Optionally, the acquisition method of the resource share by the virtual node creation module includes: determining a first parameter based on the resource usage amount and resource usage duration of all the virtual nodes allocated to the user in the resource body, and determining the resource share based on the first parameter; or determining a second parameter based on the total resource usage amount and total resource usage duration of the current virtual nodes in the resource body, and determining the resource share based on the ratio between the first parameter and the second parameter.

[0123] Optionally, the resource quota adjustment module 720 is further configured to: when there is idle resource in the resource body and there is no user task, allocate the idle resource to the virtual node based on the preemption allocation method or the proportional balance allocation method for use as the over-allocated resource quota.

[0124] Optionally, after the resource quota adjustment module 720 allocates the idle resource to the virtual node, it is further configured to: when the resource body receives a new user task, release the over-allocated resource quota of the current virtual node in the resource body.

[0125] Optionally, the resource quota adjustment module 720 is further configured to: when all the allocated service steps of the virtual node are completed, deactivate the virtual node to release the resource quota of the virtual node.

[0126] It should be noted that the resource configuration device of this embodiment can be used as Figure 2 the execution subject of the method shown, and thus can implement Figure 2 the steps and functions in the method shown.

[0127] Figure 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Please refer to Figure 8 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include a memory, such as a high-speed random access memory (Random-Access Memory, RAM), and may also include a non-volatile memory, such as at least one disk memory, etc. Of course, the electronic device may also include other hardware required for other services.

[0128] The processor, network interface, and memory can be interconnected through an internal bus, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 8 only a bidirectional arrow is used in

[0129] to represent it, but it does not mean that there is only one bus or one type of bus. Figure 7 The memory is used to store computer programs. Specifically, the computer program may include program codes, and the program codes include computer operation instructions. The memory can include a memory and a non-volatile memory, and provide the computer program to the processor. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, and forms the above-mentioned

[0130] resource configuration device shown at the logical level. Correspondingly, the processor executes the program stored in the memory and is specifically configured to perform the following operations:

[0131] Adjust the resource quota of the virtual node according to the estimated amount of resources corresponding to the business step to be executed, so that the virtual node executes the business step to be executed based on the adjusted resource quota.

[0132] The resource configuration device disclosed in the embodiments shown in this specification can be applied to a processor and implemented by the processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor or the instructions in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium 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. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.

[0133] Of course, in addition to the software implementation method, the electronic device of this specification does not exclude other implementation methods, such as a logic device or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or a logic device.

[0134] In addition, the embodiments of the present application also propose a computer-readable storage medium that stores one or more computer programs, and the one or more computer programs include instructions. When the above instructions are executed by a portable electronic device including a plurality of application programs, the portable electronic device can be enabled to execute Figure 2 the steps in the method shown, including:

[0135] Determine the business step to be executed corresponding to the virtual node.

[0136] Adjust the resource quota of the virtual node according to the estimated amount of resources corresponding to the business step to be executed, so that the virtual node executes the business step to be executed based on the adjusted resource quota.

[0137] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.

[0138] The specific embodiments of this specification are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0139] The above are only the embodiments of this specification and are not intended to limit this specification. For those skilled in the art, this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims of this specification. In addition, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this document.

Claims

1. A resource allocation method, comprising: Determining the business steps to be executed corresponding to the virtual nodes; Adjusting the resource quota of the virtual nodes according to the resource estimated amount corresponding to the business steps to be executed, so that the virtual nodes execute the business steps to be executed based on the adjusted resource quota.

2. The method according to claim 1, before determining the business steps to be executed corresponding to the virtual nodes, further comprising: Obtaining a plurality of user tasks of the resource body to which the virtual nodes belong, wherein each of the user tasks includes at least one business step; Selecting at least one target user task to be executed by the idle resources of the resource body from the plurality of user tasks; Creating corresponding virtual nodes for each of the target user tasks in the resource body, and allocating the business steps of each of the target user tasks to the corresponding virtual nodes for execution.

3. The method according to claim 2, determining the business steps to be executed corresponding to the virtual nodes, comprising: Determining the business steps to be executed corresponding to the virtual nodes in at least one of the following cases: the number of virtual nodes in the resource body changes, the business steps executed by the virtual nodes are updated, and the resource quota adjustment interval of the virtual nodes exceeds a preset duration.

4. The method according to claim 1, before determining the business steps to be executed corresponding to the virtual nodes, further comprising: Determining the resource estimated amount corresponding to the business steps to be executed according to the resource requirement information corresponding to the business steps to be executed.

5. The method according to claim 1, adjusting the resource quota of the virtual nodes according to the resource estimated amount corresponding to the business steps to be executed, comprising: Determining the minimum resource specification or the optimal resource specification for the virtual nodes to execute the business steps to be executed according to the resource estimated amount corresponding to the business steps to be executed, and adjusting the resource quota of the virtual nodes to the minimum resource specification or the optimal resource specification.

6. The method according to claim 2, obtaining a plurality of user tasks of the resource body to which the virtual nodes belong, comprising: Determining a plurality of users who have submitted user tasks to the resource body; Prioritizing the plurality of users in ascending order of the resource shares allocated to the users in the resource body to obtain the priorities of the plurality of users; Selecting at least one target user from the plurality of users according to the sorting of the priorities of the plurality of users, and selecting the plurality of user tasks from all the user tasks submitted by the at least one target user.

7. The method according to claim 6, the obtaining manner of the resource shares is as follows: Determining a first parameter based on the resource usage amount and resource usage duration of all the virtual nodes allocated to the user in the resource body, and determining the resource share based on the first parameter; Or, Determining a second parameter based on the total resource usage amount and total resource usage duration of the current virtual nodes in the resource body, and determining the resource share based on the ratio between the first parameter and the second parameter.

8. The method according to any one of claims 2 to 7 further comprises: When there are idle resources in the resource body and there are no user tasks, based on the preemption allocation method or the proportional balance allocation method, allocating the idle resources to the virtual node for use as the over-allocated resource quota.

9. After allocating the idle resources to the virtual node in the method according to claim 8, the method further comprises: When the resource body receives a new user task, releasing the over-allocated resource quota of the current virtual node of the resource body.

10. The method according to any one of claims 2 to 7 further comprises: When the virtual node has completed all the allocated service steps, canceling the virtual node to release the resource quota of the virtual node.

11. An electronic device, comprising a processor; and a memory configured to store computer-executable instructions, the computer-executable instructions, when executed, causing the processor to execute the method according to any one of claims 1-10.

12. A computer-readable storage medium for storing computer-executable instructions, the computer-executable instructions, when executed by a processor, implementing the method according to any one of claims 1-10.

Citation Information

Cited By

  • Database memory management method and device, equipment and medium

    CN120994405A