A resource allocation method, electronic device, and storage medium
Patent Information
- Application Number
- CN202310064745.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-16
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-01-16
AI Technical Summary
[0018]本申请实施例提供一种资源分配方法、电子设备及存储介质,该方法包括:在接收到租户节点申请资源的指令的情况下,获取租户节点的资源申请量和租户节点对应的第一剩余资源可分配量;在第一剩余资源可分配量小于资源申请量的情况下,根据资源申请量和第一剩余资源可分配量,确定资源申请量对应的资源需求量;获取与租户节点具有层级关系的第一目标租户节点;获取第一目标租户节点对应的剩余资源可分配量;并从剩余资源可分配量中,选取与资源需求量匹配的目标资源申请量,将目标资源申请量分配给租户节点。采用上述实现方案,在进行资源分配的过程中,当租户节点资源申请量大于该租户节点所剩余的资源可分配量时,根据当前租户节点所对应的剩余资源可分配量与资源申请量之间差值确定出当前租户节点对应的资源需求量,同时,获取与当前租户节点所关联的目标租户节点的剩余资源可分配量是否满足该资源需求量的需求,在满足需求时,直接从与当前租户节点相关联的目标租户节点的剩余资源可分配量中进行资源需求量的选取,采用此方式,无需再对所有的租户节点的资源进行统计后再进行资源分配,能够保证租户之间剩余资源量的灵活设置,实现云计算资源合理、高效的分配。
Smart Images

Figure CN116777127B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular to a resource allocation method, electronic device, and storage medium. Background Technology
[0002] In the field of cloud computing, underlying resources such as cloud servers, bare metal, networks, and storage are shared, and theoretically all tenants can obtain and use the requested resources.
[0003] Typically, after acquiring the total amount of cloud computing resources, a certain number of resource quotas are assigned to different tenants. When a tenant requests resources, the system only needs to verify the relationship between the requested resource amount and the remaining allocable amount of the set resource quota. If the remaining allocable amount is greater than the requested resource amount, the tenant is allowed to request resources. The remaining allocable amount refers to the difference between the current tenant's pre-allocated resource quota and the amount of resources already used. This method, to a certain extent, restricts tenants to requesting and using cloud computing resources only within the set resource quota. It lacks flexibility in setting resource quotas and can easily lead to invalid quotas occupying resource allocation for extended periods, affecting the rational and efficient allocation of cloud computing resources. Summary of the Invention
[0004] In view of this, the embodiments of this application aim to provide a resource allocation method, electronic device and storage medium that can flexibly set resource quotas when resource quotas are limited, so as to achieve reasonable and efficient allocation of cloud computing resources.
[0005] To achieve the above objectives, the technical solution of this application is implemented as follows:
[0006] In a first aspect, embodiments of this application provide a resource allocation method, the method comprising:
[0007] Upon receiving an instruction from a tenant node to request resources, obtain the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node;
[0008] If the first remaining allocable resource quantity is less than the resource request quantity, the resource demand corresponding to the resource request quantity is determined based on the resource request quantity and the first remaining allocable resource quantity.
[0009] Obtain the first target tenant node that has a hierarchical relationship with the tenant node;
[0010] Obtain the remaining allocable resources corresponding to the first target tenant node; and select the target resource request quantity that matches the resource demand from the remaining allocable resources, and allocate the target resource request quantity to the tenant node.
[0011] Secondly, embodiments of this application provide an electronic device, the electronic device comprising:
[0012] The acquisition unit is used to acquire the resource request amount of the tenant node and the first remaining allocable amount of resources corresponding to the tenant node when it receives the instruction of the tenant node to request resources;
[0013] The determining unit is used to determine the resource demand corresponding to the resource request based on the resource request and the first remaining allocable resources when the first remaining allocable resources are less than the resource request.
[0014] The acquisition unit is further configured to acquire a first target tenant node that has a hierarchical relationship with the tenant node; and acquire the remaining allocable resources corresponding to the first target tenant node;
[0015] The selection unit is used to select a target resource request quantity that matches the resource demand quantity from the remaining allocable resources, and allocate the target resource request quantity to the tenant node.
[0016] Thirdly, embodiments of this application provide an electronic device, which includes: a processor, a memory, and a communication bus; the processor implements the above-mentioned resource allocation method when executing a running program stored in the memory.
[0017] Fourthly, embodiments of this application provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described resource allocation method.
[0018] This application provides a resource allocation method, electronic device, and storage medium. The method includes: upon receiving an instruction from a tenant node to request resources, obtaining the resource request amount of the tenant node and a first remaining allocable resource amount corresponding to the tenant node; if the first remaining allocable resource amount is less than the resource request amount, determining the resource demand corresponding to the resource request amount based on the resource request amount and the first remaining allocable resource amount; obtaining a first target tenant node with a hierarchical relationship to the tenant node; obtaining the remaining allocable resource amount corresponding to the first target tenant node; and selecting a target resource request amount that matches the resource demand from the remaining allocable resource amount, and allocating the target resource request amount to the tenant node. By adopting the above implementation scheme, during the resource allocation process, when the resource request of a tenant node exceeds the remaining allocable resources of that tenant node, the resource requirement of the current tenant node is determined based on the difference between the remaining allocable resources and the resource request. At the same time, it is determined whether the remaining allocable resources of the target tenant node associated with the current tenant node meet the resource requirement. If the requirement is met, the resource requirement is directly selected from the remaining allocable resources of the target tenant node associated with the current tenant node. Using this method, it is not necessary to count the resources of all tenant nodes before resource allocation, which can ensure the flexible setting of the remaining resources among tenants and realize the reasonable and efficient allocation of cloud computing resources. Attached Figure Description
[0019] Figure 1 A resource allocation method flow provided in the embodiments of this application Figure 1 ;
[0020] Figure 2 This application provides a flowchart for automatically adjusting resource quotas for multiple tenant nodes.
[0021] Figure 3 A resource allocation method flow provided in the embodiments of this application Figure 2 ;
[0022] Figure 4 A schematic diagram of the structure of an electronic device 1 provided in this application embodiment. Figure 1 ;
[0023] Figure 5 A schematic diagram of the structure of an electronic device 1 provided in this application embodiment. Figure 2 . Detailed Implementation
[0024] To gain a more detailed understanding of the features and technical content of the embodiments of this application, the technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments. The accompanying drawings are for reference only and are not intended to limit the embodiments of this application.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to be limiting of this application.
[0026] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first / second / third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein.
[0027] In the cloud computing field, underlying resources such as cloud servers, bare metal servers, networks, and storage are shared, and theoretically, all tenants can obtain and use the requested resources. However, given limited resources, how to efficiently and rationally allocate resources is a problem that must be solved in cloud computing resource management.
[0028] In existing technologies, after acquiring the total amount of cloud computing resources, a certain resource quota is typically assigned to each tenant node. After the resource quota is set, when a tenant node requests resources, the electronic device verifies the requested resource amount against the remaining allocable amount of its set resource quota. If the remaining allocable amount of the tenant node's corresponding resource quota is greater than the requested amount, the resource request is allowed. The remaining allocable amount of the resource quota refers to the difference between the current tenant node's set resource quota and the amount of resources already used. However, this method, to a certain extent, restricts tenant nodes to requesting and using cloud computing resources only within a limited quota range. It lacks flexibility in setting resource quotas and can easily lead to invalid resource quotas occupying resource allocation for extended periods, affecting the rational and efficient allocation of cloud computing resources.
[0029] In summary, the following technical problems still exist in the existing technology for allocating cloud computing resource quotas:
[0030] (1) Resource quota settings are not flexible enough. After a tenant node is created, a certain number of resource quotas are usually set for each tenant node. However, it is impossible to predict the resource usage of the tenant node, so the allocation of resource quotas is generally not reasonable. If a tenant node does not have enough resource quota when applying for resources, the quota occupancy of all tenant nodes must first be statistically analyzed. The resource usage and quota occupancy of each tenant node are compared, and the quota of the current tenant node is increased based on the comparison results. The manual statistical analysis and processing process is cumbersome and time-consuming, which will affect the efficiency of resource activation in urgent situations.
[0031] (2) Some tenant nodes applied for a large amount of cloud computing resource quotas, but did not use them for the time being, occupying a lot of unnecessary resource quota space, which caused other tenant nodes to be unable to apply for resources due to insufficient resource quotas.
[0032] To address the technical problems in the prior art, embodiments of this application provide a resource allocation method, such as... Figure 1 As shown, the method may include:
[0033] S101. Upon receiving an instruction from a tenant node to request resources, obtain the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node.
[0034] In this embodiment, the cloud computing resource quota allocation method supports resource quota allocation for multi-level tenant nodes. When creating multi-level tenant nodes, the tenant node corresponding to the root node is first created, and the resource quota of the tenant node at the root node is initialized.
[0035] In this embodiment of the application, after creating the tenant node corresponding to the root node, multi-level tenant nodes are created under the tenant node corresponding to the root node as descendant nodes of the root node, and resource quota initialization operations are performed on the multi-level tenant nodes corresponding to the created descendant nodes.
[0036] It should be noted that the allocation of resource quotas for the root node and its descendant nodes corresponding to tenant nodes can be selected according to the actual situation, and no specific restrictions are made in this application.
[0037] For example, suppose the tenant node at the root node is A, and multi-level tenant nodes B and C are created under node A. B and C are the descendant nodes of A. If the child node of A is B, and the child node of B is C, then the parent node of B is A, that is, the parent node is A, and the next level node is C, that is, the child node is C.
[0038] In this embodiment of the application, each time a lower-level tenant node is created, the depth between that tenant and the lower-level tenant node is stored in the storage structure.
[0039] For example, four levels of tenants, A, B, C, and D, are created, and the storage structure is shown in Table 1:
[0040] Table 1 Storage Structure for Multi-Level Tenants
[0041] A B 1 B C 1 A C 2 C D 1 B D 2 A D 3
[0042] It should be noted that, as shown in Table 1, A is the parent tenant node, i.e., the root node, and B, C, and D are the descendant nodes of A. Among them, the child node of A is B, the child node of B is C, and the child node of C is D.
[0043] In this embodiment of the application, the upper-level tenant node and lower-level tenant node associated with each tenant node can be obtained from the multi-level tenant storage structure.
[0044] In this embodiment of the application, when a resource is requested to be created under a certain N-level tenant node, when the terminal receives the resource request instruction issued by the N-level tenant node, the terminal responds to the instruction, first obtains the resource request amount of the tenant node and the first remaining allocable amount of the tenant node, and checks whether the conditions for making a resource request are met based on the obtained resource request amount and the first remaining allocable amount of the resource.
[0045] It should be noted that N, i.e., the tenant node, can be any level of tenant node in the storage structure. Specifically, it can be selected according to the actual situation, and no specific limitation is made in this application.
[0046] In this embodiment of the application, when checking whether the first remaining allocable resource quantity of the tenant node meets the resource application conditions, it can be done by checking whether the first remaining allocable resource quantity of the tenant node is greater than the resource application quantity. If the first remaining allocable resource quantity is greater than the resource application quantity, it indicates that the remaining resources corresponding to the tenant node can meet the current resource application quantity. At this time, resource application is allowed to be carried out directly.
[0047] Specifically, after obtaining the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node, if it is found that the first remaining allocable resource amount is greater than or equal to the resource request amount, the target resource request amount corresponding to the resource request amount is directly selected from the first remaining allocable resource amount.
[0048] For example, if the first remaining allocable resource amount of the tenant node is 10G, and the resource request amount of the tenant node is 5G, the resource request amount is less than the first remaining allocable resource amount, the tenant can directly make a resource request and request 5G of resources from the remaining 10G resources.
[0049] In this embodiment of the application, after obtaining the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node, if the first remaining allocable resource amount does not meet the conditions for resource request, step S102 is executed.
[0050] S102. If the first remaining allocable resource quantity is less than the resource request quantity, determine the resource demand quantity corresponding to the resource request quantity based on the resource request quantity and the first remaining allocable resource quantity.
[0051] In this embodiment of the application, after obtaining the first remaining allocable amount of resources and the corresponding resource request amount of the tenant who made the resource request, it is verified that the first remaining allocable amount of resources of the tenant is less than the resource request amount. At this time, it indicates that the first remaining allocable amount of resources of the tenant is insufficient to make the resource request amount. At this time, the resource demand corresponding to the resource request amount is determined based on the first remaining allocable amount of resources of the tenant and the resource request amount.
[0052] In this embodiment of the application, the resource demand can be calculated as the difference between the resource request amount and the first remaining allocable resource amount, and the calculated difference is used as the resource demand.
[0053] For example, if tenant A has 10G of remaining allocable resources, and a service created by tenant A requires 15G, then tenant A's remaining allocable resources are insufficient to apply for resources. In this case, for the 15G of resources applied for by tenant A, tenant A currently needs an additional 15G-10G=5G of resources.
[0054] S103. Obtain the first target tenant node that has a hierarchical relationship with the tenant node.
[0055] In this embodiment of the application, when the first remaining allocable amount of resources of the tenant node currently requesting resources is less than the amount of resources requested, the first target tenant node with a hierarchical relationship with the tenant node requesting resources is found from the storage structure.
[0056] It should be noted that the first target tenant node can be a superior tenant node associated with the tenant node requesting resources, or a subordinate tenant node associated with the tenant node requesting resources.
[0057] For example, in the storage structure shown in Table 1, suppose the second-level tenant node B requests resources, but the remaining allocable resources of tenant node B are less than the requested amount. In this case, the lower-level tenant node or the upper-level tenant node of tenant node B can be obtained. That is, in Table 1, the upper-level tenant node of tenant node B is tenant node A, and the lower-level tenant nodes of tenant node B are tenant node C and tenant node D.
[0058] S104. Obtain the remaining allocable resources corresponding to the first target tenant node; and select the target resource request quantity that matches the resource demand from the remaining allocable resources, and allocate the target resource request quantity to the tenant node.
[0059] In this embodiment of the application, when the first target tenant node is a subordinate tenant node corresponding to the tenant node requesting resources, the remaining allocable resources corresponding to the subordinate tenant node are determined. When the remaining allocable resources corresponding to the subordinate tenant node meet the resource demand, the corresponding resource demand is selected from the remaining allocable resources of the subordinate tenant node, and the corresponding resource demand is subtracted from the remaining allocable resources of the subordinate tenant node. At the same time, the corresponding resource demand is added to the tenant node requesting resources.
[0060] Specifically, in this embodiment, the first target tenant node includes the lower-level tenant node corresponding to the tenant node. Obtaining the remaining allocable resources corresponding to the first target tenant node and selecting the target resource request quantity that matches the resource demand from the remaining allocable resources may involve obtaining the second remaining allocable resources corresponding to the lower-level tenant node. If the second remaining allocable resources are greater than or equal to the resource demand, the target resource request quantity that matches the resource demand is selected from the second remaining allocable resources.
[0061] It should be noted that there can be one or more subordinate tenant nodes.
[0062] In this embodiment of the application, when the first remaining resource allocation amount corresponding to the tenant node that applied for the resource is insufficient, the storage structure is first traversed to find all the subordinate tenant nodes corresponding to the tenant node. That is, when the first target tenant node is a subordinate tenant node corresponding to the tenant node, the subordinate tenant node found from the storage structure corresponds to the tenant node.
[0063] For example, as shown in Table 1, when tenant node B makes a resource request, the remaining allocable resources of tenant node B are insufficient. At this time, the subordinate tenant nodes corresponding to tenant node B are searched from Table 1, namely C and D in Table 1.
[0064] In this embodiment of the application, after traversing and finding all the subordinate tenant nodes of the tenant node, the weight value of all subordinate tenant nodes is determined, and all the found subordinate tenant nodes are stored in a queue in ascending order of weight value.
[0065] In this embodiment of the application, the second remaining resource allocation amount corresponding to each lower-level tenant node is obtained sequentially in the queue according to the weight value from high to low.
[0066] It should be noted that the second remaining resource allocation amount is the remaining resources of each subordinate tenant node after deducting the resources already used.
[0067] In this embodiment, after obtaining the second remaining allocable resource quantity corresponding to each lower-level tenant node, the relationship between the second remaining allocable resource quantity and the resource demand quantity for each lower-level tenant node is determined sequentially. When the second remaining allocable resource quantity is greater than or equal to the resource demand quantity, the corresponding resource demand quantity is directly selected from the second remaining allocable resource quantity and added to the tenant node requesting resources. That is, when the second remaining allocable resource quantity is greater than or equal to the resource demand quantity, the resource demand quantity is subtracted from the second remaining allocable resource quantity of the lower-level tenant node that meets the demand, and the resource demand quantity is added to the first remaining allocable resource quantity corresponding to the tenant node requesting resources. The change records of the first and second remaining allocable resource quantities are saved.
[0068] In this embodiment of the application, when determining the relationship between the second remaining allocable resources and the resource demand corresponding to each lower-level tenant node, the comparisons are made sequentially according to the weight values of the lower-level tenants from high to low. When the second remaining allocable resources of the first higher-level tenant node do not meet the resource demand, the second remaining allocable resources of the second higher-level tenant node are selected for comparison with the resource demand. This process is repeated until none of the lower-level tenant nodes meet the resource demand.
[0069] For example, as shown in Table 1, when tenant node B requests resources, the remaining allocable resources of tenant node B are insufficient. At this time, the lower-level tenant nodes corresponding to tenant node B are found to be C and D from Table 1, and the second remaining allocable resources of C and D are obtained respectively. If the weight value of C is higher than that of D, the second remaining allocable resources corresponding to C are compared with the resource demand. If the second remaining allocable resources corresponding to C can meet the resource demand, the corresponding resource demand is selected from the second remaining allocable resources corresponding to C and added to B. If the second remaining allocable resources corresponding to C do not meet the resource demand, the second remaining allocable resources corresponding to D are compared with the resource demand, and so on. The implementation process is the same as the above implementation process, and will not be elaborated here.
[0070] In this embodiment of the application, the first target tenant node also includes the upper-level tenant node corresponding to the tenant node. After obtaining the second remaining allocable amount of resources corresponding to the lower-level tenant node, the size relationship between the second remaining allocable amount of resources and the resource demand is determined. If the second remaining allocable amount of resources is less than the resource demand, the third remaining allocable amount of resources corresponding to the upper-level tenant node is obtained. From the third remaining allocable amount of resources, the target resource request amount that matches the resource demand is selected.
[0071] It should be noted that the number of upstream tenant nodes can also be one or more.
[0072] In this embodiment, after obtaining the second remaining allocable resources corresponding to the lower-level tenant node, the second remaining allocable resources corresponding to all the obtained lower-level tenant nodes are compared with the resource demand. If the second remaining allocable resources corresponding to all the lower-level tenant nodes do not meet the resource demand, that is, all the lower-level tenant nodes corresponding to the tenant node requesting resources do not meet the requirements, then the first target tenant node is determined to be the upper-level tenant node corresponding to the tenant node requesting resources.
[0073] In this embodiment of the application, when the second remaining resource allocation amount corresponding to the lower-level tenant nodes of the tenant node that applied for the resource does not meet the requirements, the upper-level tenant nodes corresponding to the tenant node that applied for the resource are traversed upwards, that is, all the upper-level tenant nodes of the tenant node are determined, and the obtained upper-level tenant nodes are stored in the queue in descending order of weight value.
[0074] For example, as shown in Table 1, if the tenant node requesting resources is C, then all the parent tenant nodes of C are found to be A and B.
[0075] In this embodiment of the application, after determining the upper-level tenant node, the third remaining allocable resource quantity corresponding to all upper-level tenant nodes is obtained, and the target resource request quantity matching the resource demand quantity is selected from the third remaining allocable resource quantity.
[0076] In this embodiment of the application, after obtaining the third remaining allocable resource quantity corresponding to the upper-level tenant node, before selecting the target resource application quantity matching the resource demand quantity from the third remaining allocable resource quantity, it is also necessary to obtain the first weight value corresponding to the tenant node and the second weight value corresponding to the upper-level tenant node; if the second weight value is less than the first weight value, the target resource application quantity matching the resource demand quantity is selected from the third remaining allocable resource quantity; if the second weight value is greater than or equal to the first weight value, a resource application failure message is prompted.
[0077] In this embodiment of the application, after obtaining the upper-level tenant node and the third remaining allocable resource corresponding to the upper-level tenant node, it is not possible to directly compare the obtained third remaining allocable resource with the resource demand. It is also necessary to further compare the weight values of the tenant node requesting resources and the upper-level tenant node. Based on the weight values, it is determined whether the resource demand can be selected from a certain upper-level tenant node.
[0078] In this embodiment of the application, when selecting the resource demand from the third resource allocable quantity corresponding to the upper-level tenant node, the second weight value corresponding to the upper-level tenant node and the first weight value corresponding to the tenant node applying for the resource are first determined. If the first weight value is greater than the second weight value, the resource demand can be selected from the upper-level tenant node. If the first weight value is less than or equal to the second weight value, the resource demand cannot be selected from the upper-level tenant node, that is, the resource application fails.
[0079] For example, if tenant node C requests resources and its parent tenant nodes are A and B, if the weight values of A and B are both greater than C, then C cannot select the resource requirement from A and B, i.e., the resource request fails; if the weight value of C is greater than the weight value of A, and the weight value of A is greater than the weight value of B, then C can select the resource requirement from A and B.
[0080] In this embodiment of the application, selecting a target resource application quantity that matches the resource demand quantity from the third remaining allocable resource quantity may involve determining whether the third remaining allocable resource quantity is greater than the resource demand quantity; if the third remaining allocable resource quantity is greater than or equal to the resource demand quantity, then a target resource application quantity that matches the resource demand quantity is selected from the third remaining allocable resource quantity; if the third remaining allocable resource quantity is less than the resource demand quantity, then a resource application failure message is displayed.
[0081] In this embodiment of the application, when it is determined that the weight value of the upper-level tenant node is less than the weight of the tenant requesting resources, the resource demand can be selected from the upper-level tenant node. Specifically, it is first determined whether the third remaining allocable resource corresponding to the upper-level tenant node is greater than the resource demand. If the third remaining allocable resource is greater than or equal to the resource demand, the target resource request quantity that matches the resource demand is selected from the third remaining allocable resource corresponding to the upper-level tenant.
[0082] It should be noted that when selecting the target resource request amount from the third remaining allocable resources corresponding to the upper-level tenant node, two conditions must be met: first, the weight value of the upper-level tenant node is less than the weight value of the tenant node requesting the resource; and second, the third remaining allocable resources corresponding to the upper-level tenant node must be greater than or equal to the resource demand amount. Only then can the resource demand amount be selected from the upper-level tenant node.
[0083] In this embodiment, if the weight value of the upper-level tenant node is less than the weight value of the tenant node requesting resources, but the third remaining allocable resource amount is less than the resource demand, a resource request failure message is displayed, i.e., the resource request fails. At this time, if there are multiple upper-level tenant nodes with weight values less than the weight value of the tenant node requesting resources, the third remaining allocable resource amount corresponding to the next upper-level tenant node stored in the queue is compared with the resource demand. The specific comparison process is the same as the above method and will not be repeated here.
[0084] For example, if tenant node C requests resources, and its parent tenant nodes are A and B, and if C's weight value is greater than A's weight value, and A's weight value is greater than B's weight value, then C can first select the resource requirement from B. Specifically, assuming the resource requirement is 5G, it is determined whether the third remaining allocable resource corresponding to B is greater than 5G. If the third remaining allocable resource corresponding to B is greater than or equal to 5G, then 5G is subtracted from the third remaining allocable resource corresponding to B, and the subtracted 5G is added to C. If the third remaining allocable resource corresponding to B is less than 5G, it indicates that the third remaining allocable resource corresponding to B is insufficient, and the resource requirement is selected from C. The specific selection process can refer to the process of selecting the resource requirement from B, and will not be repeated here.
[0085] It should be noted that if none of the upstream tenant nodes meet the requirements, resource requests will not be allowed, and a resource request failure message will be displayed.
[0086] It should be noted that when a tenant node requests resources, it first checks whether the remaining available resources of its subordinate tenant nodes meet the requirements. If they do, the required resources are selected from the remaining available resources of the subordinate tenant nodes. If not, it checks whether the remaining available resources of its superior tenant nodes meet the requirements. If they do, the required resources are selected from the remaining available resources of the superior tenant nodes. If not, the resource request fails.
[0087] It should be noted that if the tenant node requesting resources does not have any subordinate tenant nodes, it will directly determine whether the superior tenant node of the tenant node meets the conditions. If the conditions are met, the resource demand will be selected from the remaining available resources of the superior tenant node.
[0088] It should be noted that the resource allocation method provided in this application embodiment addresses the problem of insufficient flexibility in initializing resource quota settings by proposing an automatic adjustment method for cloud computing resource quota allocation. This method supports resource quota management for multi-level tenant nodes. When a tenant node requests resources, if the resource quota is insufficient, it can "borrow" the missing resource quota from lower-level tenant nodes or upper-level tenant nodes with a lower weight value. This eliminates the need for manually analyzing the quota information of all tenant nodes and then reallocating the resource quota, making resource allocation and resource quota management more flexible.
[0089] Optionally, before obtaining the resource request volume of a tenant node and the first remaining allocable resource corresponding to the tenant node, the adjusted resource request frequency and adjusted priority of multiple tenant nodes can be obtained at preset time intervals; wherein, each tenant node among the multiple tenant nodes is associated with at least one tenant node with a hierarchical relationship; based on the adjusted resource request frequency and adjusted priority, multiple adjusted weight values of multiple tenant nodes are determined; based on the multiple adjusted weight values and a preset weight threshold, one or more target weight values less than the preset weight threshold are found from the multiple adjusted weight values; and multiple second target tenant nodes corresponding to one or more target weight values are determined; the available resource adjustment volume corresponding to the multiple second target tenant nodes is obtained; based on the available resource adjustment volume, the remaining allocable resource corresponding to the other tenant nodes, excluding the second target tenant nodes, is adjusted sequentially according to a preset allocation ratio.
[0090] In this embodiment of the application, the remaining allocable resources corresponding to each of the multiple tenant nodes stored in the storage structure, i.e., the preset tree structure, are adjusted at preset time intervals.
[0091] It should be noted that multiple tenant nodes refer to all tenant nodes stored in the preset tree structure. The way to obtain multiple tenant nodes is to start traversing from the root node in the preset tree structure until the last level of the tenant node in the storage structure has no lower-level tenant nodes, thus completing the traversal search and obtaining all tenant nodes stored in the storage structure.
[0092] In this embodiment of the application, when adjusting the remaining allocable resources corresponding to each of the multiple tenant nodes contained in the storage structure, the process first starts from the root node in the storage structure and calculates the weight value corresponding to each of the tenant nodes contained in the storage structure.
[0093] In this embodiment of the application, when determining the weight values corresponding to all tenant nodes in the storage structure, the adjusted resource request frequency and adjusted priority of multiple tenant nodes can be obtained; based on the adjusted resource request frequency and adjusted priority, the adjusted weight values corresponding to multiple tenant nodes are determined.
[0094] It should be noted that each of the multiple tenant nodes is associated with at least one tenant node that has a hierarchical relationship.
[0095] It should be noted that the frequency and priority of resource requests for each tenant node change within the preset time period.
[0096] In this embodiment, the resource request frequency can be determined by counting the number of times multiple tenant nodes request resources within a certain period, calculating the median of the number of resource requests by multiple tenant nodes, and dividing the number of resource requests for each tenant node by the median. The result of this division is defined as the request frequency of the multiple tenant nodes, denoted as A. i .
[0097] It should be noted that the application frequency A i It will change over time.
[0098] For example, as shown in Table 1, there are four initial tenant nodes A, B, C, and D. If the number of requests for initial tenant node A is 10, the number of requests for initial tenant node B is 15, the number of requests for initial tenant node C is 15, and the number of requests for initial tenant node D is 20, the median of the four nodes is taken as 15. The request frequency of tenant node A is obtained by dividing the number of resource requests for initial tenant node A (10) by the median (15). Similarly, the request frequencies of initial tenant nodes B, C, and D can be calculated.
[0099] In this embodiment of the application, when determining the priority of multiple tenant nodes stored in the storage structure, their priority is set to 1 by default, denoted as P. i .
[0100] It should be noted that priority can also be adjusted by operations and management personnel according to their permissions for multiple initial tenant nodes.
[0101] In this embodiment, after obtaining the adjusted application frequency and adjusted priority of multiple tenant nodes within a preset time period, the adjusted weight values of the multiple tenant nodes can be determined based on their respective adjusted application frequencies and adjusted priorities. Specifically, the weight values of the multiple tenant nodes can be calculated using formula (1), as shown below:
[0102] W i =A i *ratio+P i (1-ratio) (1)
[0103] Here, ratio is the ratio of weight values, which can be a number in the range [0,1] that can be customized according to different scenarios. Specifically, it can be selected according to the actual situation, and no specific limitation is made in this application.
[0104] It should be noted that A in this context... i and P i As a variable, it changes over time.
[0105] In this embodiment of the application, the adjusted weight values corresponding to the multiple tenant nodes stored in the storage structure can be calculated by the above formula (1).
[0106] In this embodiment of the application, after determining multiple adjusted weight values, the average of the multiple adjusted weight values is calculated, and the average is used as a preset weight threshold.
[0107] In this embodiment of the application, the adjusted weight values corresponding to multiple tenant nodes are compared with the determined average, one or more target weight values that are less than the average are counted, and multiple second target tenant nodes corresponding to one or more target weight values are determined.
[0108] In this embodiment, the remaining allocable resources corresponding to multiple second target tenant nodes are obtained and summed, denoted as SUM. quota Simultaneously, the weight values corresponding to multiple second-target tenant nodes are summed, denoted as SUM. W .
[0109] For example, suppose there are 5 initial tenant nodes, namely A, B, C, D and E. Calculate the weight values of the 5 initial tenant nodes and determine the average value. If the weight values of A, C and D are less than the average value, obtain the remaining allocable resources corresponding to A, C and D respectively, sum the remaining allocable resources corresponding to A, C and D, and sum the weight values corresponding to A, C and D.
[0110] In this embodiment, after obtaining the remaining allocable resources corresponding to multiple second target tenant nodes, the remaining allocable resources corresponding to each of the multiple second target tenant nodes are released according to a pre-set ratio. This can be understood as releasing corresponding resources sequentially from the multiple second target tenant nodes according to a pre-set ratio; these resources can be a portion of the remaining allocable resources of the multiple second target tenant nodes. The sum of the released resources from each second target tenant node is used as the available resource adjustment amount and stored in the resource quota pool.
[0111] In this embodiment, all tenant nodes in the statistical storage structure whose weight values are greater than a preset weight threshold are counted. These tenant nodes are then arranged in order of their corresponding weight values. After sorting by weight value, the target resource adjustment amount is determined from the available resource adjustment amount according to a preset allocation ratio, based on the available resource adjustment amount.
[0112] For example, suppose there are 100G of resources in the resource quota pool. B and D are to be allocated according to a preset allocation ratio. If 30% is allocated to B, then B's resource amount can be increased by 30G.
[0113] In this application embodiment, the preset weight threshold can be the average of the weight values corresponding to all tenant nodes in the storage structure, or it can be a pre-set threshold. Specifically, it can be selected according to the actual situation, and no specific limitation is made in this application.
[0114] In this embodiment of the application, the weight values can be arranged in descending order.
[0115] In this embodiment of the application, the preset allocation ratio can be determined by the weight value of the tenant node and SUM. W The ratio, i.e. (W) i / SUM W )×SUM quota According to (W) i / SUM W )×SUM quota The calculation results are incremented sequentially by the remaining allocable resources corresponding to tenant nodes whose weight values are greater than the preset weight threshold.
[0116] In this embodiment, when adjusting resource usage, the remaining available resource adjustment amount is calculated in real time until the remaining amount of available resource adjustment is less than the minimum unit of resource usage. Finally, changes to the resource quotas of all initial tenant nodes also need to be recorded.
[0117] It should be noted that as time changes, the application frequency and priority of tenant nodes will change, and consequently, the weight value of each tenant node will also change. As a result, the second target tenant node determined based on the changing weight value will also change accordingly. Therefore, it will monitor in real time which tenant nodes have applied for resources but have not used them for a long time. The resources contained in the tenant nodes that have applied for resources but have not used them for a long time will be monitored in real time and the resources will be released in real time so that the released resources can be allocated to tenant nodes with higher resource application frequency.
[0118] Based on the above embodiment of adjusting the resource quota corresponding to each tenant node stored in the preset tree structure, this application embodiment provides a flowchart for automatically adjusting resource quotas, as follows: Figure 2 As shown, its execution process is as follows:
[0119] 1. Obtain the stored tenant node 1, tenant node 2, tenant node 3, ..., tenant node n from the preset tree structure;
[0120] 2. Obtain the resource request frequency and priority for multiple tenant nodes;
[0121] 3. Calculate multiple weight values for multiple tenant nodes based on their resource request frequency and priority;
[0122] 4. Based on multiple weight values and a preset weight threshold, determine one or more target weight values that are less than the preset weight threshold from the multiple weight values;
[0123] 5. Determine multiple second target tenant nodes corresponding to one or more target weight values; and obtain the available resource adjustment amount corresponding to the multiple second target tenant nodes, and store the available resource adjustment amount in the resource quota pool;
[0124] 6. Determine the target resource adjustment amount from the available resource adjustment amount according to the preset allocation ratio;
[0125] 7. Based on the target resource adjustment amount, adjust the remaining allocable resources of the remaining tenant nodes other than the second target tenant node.
[0126] It should be noted that, in response to the issue of resource quota space occupancy, this application embodiment supports automatic adjustment of cloud computing resource quotas. Based on the activity and priority of tenant nodes applying for resources, long-term unused resource quotas are released, and resource quotas for tenant nodes with higher activity are increased, making the allocation of cloud computing resources more reasonable and management more convenient.
[0127] In summary, the automatic adjustment method for cloud computing resource quota verification and adaptive allocation and management proposed in this application supports quota management for multi-level tenant nodes. When a tenant node requests resources, if the resource quota is insufficient, it can borrow the missing resource quota from lower-level tenant nodes or upper-level tenant nodes with lower weight values. This eliminates the need for manually analyzing the resource quota information of all tenant nodes and reallocating the quotas, making resource application and quota management more flexible. Furthermore, the technical solution in this application supports automatic adjustment of cloud computing resource quotas, releasing long-unused resource quotas and increasing the resource quotas of tenant nodes with higher application frequencies based on the frequency and priority of resource requests, making the allocation of cloud computing resources more reasonable and management more convenient.
[0128] Compared with the prior art, the technical solution of this application has the following advantages:
[0129] (1) Supports resource quota management for multi-level tenant nodes. When the resource quota is insufficient, the resource quota of other tenant nodes can be "borrowed" according to the weight value, making the management of resource quota more flexible.
[0130] (2) Release long-term unused resource quotas based on the frequency and priority of tenant nodes requesting resources, so that the allocation of resource quotas is more reasonable.
[0131] It is understood that, in the resource allocation method provided in this application embodiment, when the resource request amount of a tenant node is greater than the remaining allocable resources of that tenant node, the resource demand of the current tenant node is determined based on the difference between the remaining allocable resources of the current tenant node and the resource request amount. At the same time, it is determined whether the remaining allocable resources of the target tenant node associated with the current tenant node meet the resource demand. If the demand is met, the resource demand is directly selected from the remaining allocable resources of the target tenant node associated with the current tenant node. Using this method, it is not necessary to count the resources of all tenant nodes before resource allocation, which can ensure the flexible setting of the remaining resources among tenants and realize the reasonable and efficient allocation of cloud computing resources.
[0132] Based on the above embodiments, this application provides a resource allocation method, such as... Figure 3 As shown, the specific steps include:
[0133] 1. Upon receiving an instruction from a tenant node to request resources, obtain the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node;
[0134] 2. Check if the first remaining allocable resource quantity is greater than or equal to the resource request quantity; if yes, proceed to step 3; if no, proceed to step 4.
[0135] 3. Resource application successful, end;
[0136] 4. Determine the resource demand corresponding to the resource request quantity based on the resource request quantity and the first remaining allocable resource quantity;
[0137] 5. Traverse the child tenant nodes corresponding to the tenant node, determine the weight value of the child tenant node, and add the child tenant node to the queue according to the weight value;
[0138] 6. Sequentially retrieve the second remaining allocable resource amount corresponding to the next-level tenant node from the queue;
[0139] 7. Check whether the second remaining allocable resource quantity corresponding to the lower-level tenant node is greater than or equal to the resource demand; if yes, proceed to step 8; if no, proceed to step 9.
[0140] 8. Allow resource requests and select the target resource request quantity corresponding to the resource demand from the lower-level tenant nodes; End;
[0141] 9. Determine if there are any lower-level tenant nodes in the queue. If yes, proceed to step 7; otherwise, proceed to step 10.
[0142] 10. Traverse the parent tenant nodes of this tenant node; obtain the third remaining allocable resource corresponding to the parent tenant node;
[0143] 11. Check whether the third remaining allocable resource corresponding to the upper-level tenant node is greater than or equal to the resource requirement. If yes, proceed to step 12; otherwise, proceed to step 13.
[0144] 12. Allow resource requests and select the target resource request quantity corresponding to the resource demand from the third remaining allocable resource quantity; End;
[0145] 13. Determine if there are any parent tenant nodes in the queue. If yes, proceed to step 11; otherwise, proceed to step 14.
[0146] 14. Resource requests are not permitted; End.
[0147] Based on the above embodiments, another embodiment of this application provides an electronic device 1, such as... Figure 4 As shown, the electronic device 1 includes:
[0148] The acquisition unit 10 is used to acquire the resource request amount of the tenant node and the first remaining allocable amount of resources corresponding to the tenant node when it receives an instruction from the tenant node to request resources.
[0149] The determining unit 11 is used to determine the resource demand corresponding to the resource request amount based on the resource request amount and the first remaining allocable resource amount when the first remaining allocable resource amount is less than the resource request amount.
[0150] The acquisition unit 10 is further configured to acquire a first target tenant node that has a hierarchical relationship with the tenant node; and acquire the remaining allocable resources corresponding to the first target tenant node.
[0151] The selection unit 12 is used to select a target resource request quantity that matches the resource demand quantity from the remaining allocable resources, and allocate the target resource request quantity to the tenant node.
[0152] Optionally, the acquisition unit 10 is further configured to acquire the second remaining allocable amount of resources corresponding to the lower-level tenant node when the first target tenant node is a lower-level tenant node corresponding to the tenant node.
[0153] Optionally, the selection unit 12 is further configured to select a target resource request quantity that matches the resource demand quantity from the second remaining allocable resources when the second remaining allocable resources quantity is greater than or equal to the resource demand quantity.
[0154] Optionally, the determining unit 11 is further configured to determine the first target tenant node as the parent tenant node corresponding to the tenant node when the second remaining allocable resource amount is less than the resource demand amount.
[0155] Optionally, the acquisition unit 10 is further configured to acquire the third remaining allocable resource quantity corresponding to the upper-level tenant node.
[0156] Optionally, the selection unit 12 is further configured to select a target resource request quantity that matches the resource demand quantity from the third remaining allocable resource quantity.
[0157] Optionally, the acquisition unit 10 is further configured to acquire the first weight value corresponding to the tenant node and the second weight value corresponding to the parent tenant node.
[0158] Optionally, the selection unit 12 is further configured to select a target resource request quantity that matches the resource demand quantity from the third remaining allocable resource quantity if the second weight value is less than the first weight value.
[0159] Optionally, the electronic device 1 may further include: a prompting unit;
[0160] The prompting unit is used to prompt a resource application failure message if the second weight value is greater than or equal to the first weight value.
[0161] Optionally, the determining unit 11 is further configured to determine whether the third remaining allocable resource amount is greater than the resource demand amount.
[0162] Optionally, the selection unit 12 is further configured to select a target resource request quantity that matches the resource demand quantity from the third remaining allocable resource quantity if the third remaining allocable resource quantity is greater than or equal to the resource demand quantity.
[0163] Optionally, the prompting unit is further configured to prompt a resource application failure message if the third remaining allocable resource amount is less than the resource demand amount.
[0164] Optionally, the selection unit 12 is further configured to obtain the adjusted resource request frequency and adjusted priority of multiple tenant nodes at preset time intervals; wherein, each of the multiple tenant nodes is associated with at least one tenant node with a hierarchical relationship.
[0165] Optionally, the determining unit 11 is further configured to determine multiple weight values of the multiple tenant nodes after adjustment based on the adjusted resource request frequency and the adjusted priority.
[0166] Optionally, the determining unit 11 is further configured to, based on the adjusted multiple weight values and a preset weight threshold, find one or more target weight values that are less than the preset weight threshold from the adjusted multiple weight values; and determine multiple second target tenant nodes corresponding to the one or more target weight values.
[0167] Optionally, the acquisition unit 10 is further configured to acquire the available resource adjustment amount corresponding to the plurality of second target tenant nodes.
[0168] Optionally, the electronic device 1 may further include: an adjustment unit;
[0169] The adjustment unit is used to adjust the remaining allocable resources corresponding to the other tenant nodes, excluding the second target tenant node, according to the available resource adjustment amount and a preset allocation ratio.
[0170] Optionally, the selection unit 12 is further configured to select a target resource request quantity corresponding to the resource request quantity from the first remaining allocable resources if the first remaining allocable resource quantity is greater than or equal to the resource request quantity.
[0171] This application provides an electronic device that, upon receiving an instruction from a tenant node to request resources, obtains the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node; if the first remaining allocable resource amount is less than the resource request amount, determines the resource demand corresponding to the resource request amount based on the resource request amount and the first remaining allocable resource amount; obtains a first target tenant node with a hierarchical relationship to the tenant node; obtains the remaining allocable resource amount corresponding to the first target tenant node; and selects a target resource request amount matching the resource demand amount from the remaining allocable resource amount, and allocates the target resource request amount to the tenant node. Therefore, this application provides an electronic device that, when performing resource allocation... During the allocation process, when a tenant node's resource request exceeds its remaining allocable resources, the resource requirement for the current tenant node is determined based on the difference between its remaining allocable resources and the requested resources. Simultaneously, the remaining allocable resources of the target tenant node associated with the current tenant node are checked to see if they meet the required resource quantity. If they do, the resource requirement is directly selected from the remaining allocable resources of the target tenant node associated with the current tenant node. This method eliminates the need to statistically analyze the resources of all tenant nodes before resource allocation, ensuring flexible setting of remaining resources among tenants and achieving reasonable and efficient allocation of cloud computing resources.
[0172] Figure 5 This is a schematic diagram of the composition structure of an electronic device 1 provided in an embodiment of this application. In practical applications, based on the same disclosed concept of the above embodiments, such as... Figure 5 As shown, the electronic device 1 in this embodiment includes a processor 13, a memory 14, and a communication bus 15.
[0173] In specific embodiments, the aforementioned acquisition unit 10, determination unit 11, selection unit 12, prompting unit, and adjustment unit can be implemented by a processor 13 located on the electronic device 1. The processor 13 can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), CPU, controller, microcontroller, and microprocessor. It is understood that for different devices, the electronic device used to implement the above processor functions can also be other types; this embodiment does not impose specific limitations.
[0174] In this embodiment, the communication bus 15 is used to realize the connection communication between the processor 13 and the memory 14; when the processor 13 executes the running program stored in the memory 14, it implements the following resource allocation method:
[0175] Upon receiving an instruction from a tenant node to request resources, the system obtains the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node. If the first remaining allocable resource amount is less than the resource request amount, the system determines the resource demand corresponding to the resource request amount based on the resource request amount and the first remaining allocable resource amount. The system then obtains the first target tenant node that has a hierarchical relationship with the tenant node, obtains the remaining allocable resource amount corresponding to the first target tenant node, and selects the target resource request amount that matches the resource demand amount from the remaining allocable resource amount, and allocates the target resource request amount to the tenant node.
[0176] Furthermore, the processor 13 is also configured to, when the first target tenant node is a subordinate tenant node corresponding to the tenant node, obtain the second remaining allocable resource quantity corresponding to the subordinate tenant node; and when the second remaining allocable resource quantity is greater than or equal to the resource demand quantity, select a target resource request quantity that matches the resource demand quantity from the second remaining allocable resource quantity.
[0177] Furthermore, the processor 13 is also configured to, when the second remaining allocable resource amount is less than the resource demand amount, determine that the first target tenant node is the parent tenant node corresponding to the tenant node; obtain the third remaining allocable resource amount corresponding to the parent tenant node; and select a target resource request amount that matches the resource demand amount from the third remaining allocable resource amount.
[0178] Furthermore, the processor 13 is also used to obtain the first weight value corresponding to the tenant node and the second weight value corresponding to the parent tenant node; if the second weight value is less than the first weight value, select the target resource request quantity that matches the resource demand quantity from the third remaining allocable resources; if the second weight value is greater than or equal to the first weight value, then prompt a resource request failure message.
[0179] Furthermore, the processor 13 is also configured to determine whether the third remaining allocable resource quantity is greater than the resource demand quantity; if the third remaining allocable resource quantity is greater than or equal to the resource demand quantity, then select a target resource request quantity that matches the resource demand quantity from the third remaining allocable resource quantity; if the third remaining allocable resource quantity is less than the resource demand quantity, then prompt a resource request failure message.
[0180] Furthermore, the processor 13 is also configured to acquire, at preset time intervals, the adjusted resource request frequency and adjusted priority corresponding to multiple tenant nodes; wherein each of the multiple tenant nodes is associated with at least one tenant node with a hierarchical relationship; determine multiple adjusted weight values of the multiple tenant nodes based on the adjusted resource request frequency and the adjusted priority; find one or more target weight values less than the preset weight threshold from the multiple adjusted weight values based on the multiple adjusted weight values and a preset weight threshold; and determine multiple second target tenant nodes corresponding to the one or more target weight values; acquire the available resource adjustment amount corresponding to the multiple second target tenant nodes; and adjust the remaining allocable resources corresponding to the other tenant nodes (excluding the second target tenant nodes) sequentially according to the available resource adjustment amount and a preset allocation ratio.
[0181] Furthermore, the processor 13 is also configured to select a target resource request quantity corresponding to the resource request quantity from the first remaining allocable resource quantity if the first remaining allocable resource quantity is greater than or equal to the resource request quantity.
[0182] Based on the above embodiments, this application provides a storage medium storing a computer program thereon. The computer-readable storage medium stores one or more programs, which can be executed by one or more processors and applied in an electronic device. The computer program implements the resource allocation method described above.
[0183] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0184] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause an image display device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.
[0185] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A resource allocation method, characterized in that, The method includes: Upon receiving an instruction from a tenant node to request resources, the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node are obtained; If the first remaining allocable resource quantity is less than the resource request quantity, the resource demand quantity corresponding to the resource request quantity is determined based on the resource request quantity and the first remaining allocable resource quantity. Obtain a first target tenant node that has a hierarchical relationship with the tenant node; obtain the remaining allocable resources corresponding to the first target tenant node; and select a target resource request quantity that matches the resource demand quantity from the remaining allocable resources, and allocate the target resource request quantity to the tenant node. The first target tenant node includes a lower-level tenant node or a higher-level tenant node corresponding to the tenant node. The higher-level tenant node is obtained when the remaining allocable resources of the lower-level tenant node do not meet the resource request quantity, and the second weight value of the higher-level tenant node is less than the first weight value of the tenant node.
2. The method according to claim 1, characterized in that, The first target tenant node includes the subordinate tenant nodes corresponding to the tenant node; the step of obtaining the remaining allocable resources corresponding to the first target tenant node, and selecting the target resource request quantity matching the resource demand quantity from the remaining allocable resources, includes: Obtain the second remaining allocable resource quantity corresponding to the lower-level tenant node; If the second remaining allocable resource quantity is greater than or equal to the resource demand quantity, a target resource request quantity matching the resource demand quantity is selected from the second remaining allocable resource quantity.
3. The method according to claim 2, characterized in that, The first target tenant node also includes the parent tenant node corresponding to the tenant node; after obtaining the second remaining allocable resource amount corresponding to the lower-level tenant node, the method further includes: If the second remaining allocable resource quantity is less than the resource demand quantity, obtain the third remaining allocable resource quantity corresponding to the upper-level tenant node; From the third remaining allocable resource quantity, select the target resource request quantity that matches the resource demand quantity.
4. The method according to claim 3, characterized in that, After obtaining the third remaining allocable resource quantity corresponding to the upper-level tenant node, and before selecting the target resource request quantity matching the resource demand quantity from the third remaining allocable resource quantity, the method further includes: Obtain the first weight value corresponding to the tenant node and the second weight value corresponding to the parent tenant node; If the second weight value is less than the first weight value, then a target resource application quantity matching the resource demand quantity is selected from the third remaining allocable resource quantity. If the second weight value is greater than or equal to the first weight value, a resource application failure message will be displayed.
5. The method according to claim 4, characterized in that, The step of selecting a target resource request quantity that matches the resource demand quantity from the third remaining allocable resource quantity includes: Determine whether the third remaining available resource quantity is greater than the resource demand quantity; If the third remaining allocable resource quantity is greater than or equal to the resource demand quantity, then a target resource request quantity matching the resource demand quantity is selected from the third remaining allocable resource quantity. If the third remaining allocable resource is less than the resource requirement, a resource application failure message will be displayed.
6. The method according to claim 1, characterized in that, Before obtaining the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node, the method further includes: Every preset time interval, the adjusted resource request frequency and adjusted priority of multiple tenant nodes are obtained; wherein, each of the multiple tenant nodes is associated with at least one tenant node with a hierarchical relationship; Based on the adjusted resource request frequency and the adjusted priority, determine the adjusted weight values of the multiple tenant nodes; Based on the adjusted multiple weight values and a preset weight threshold, one or more target weight values less than the preset weight threshold are found from the adjusted multiple weight values; and multiple second target tenant nodes corresponding to the one or more target weight values are determined. Obtain the available resource adjustment amount corresponding to the plurality of second target tenant nodes; Based on the available resource adjustment amount, the remaining resource allocation amount corresponding to the other tenant nodes, excluding the second target tenant node, is adjusted sequentially according to the preset allocation ratio.
7. The method according to claim 1, characterized in that, After obtaining the resource request amount of the tenant node and the first remaining allocable resource amount corresponding to the tenant node, the method further includes: If the first remaining allocable resource quantity is greater than or equal to the resource request quantity, a target resource request quantity corresponding to the resource request quantity is selected from the first remaining allocable resource quantity.
8. An electronic device, characterized in that, The electronic device includes: The acquisition unit is used to acquire the resource request amount of the tenant node and the first remaining allocable amount of resources corresponding to the tenant node when it receives an instruction from the tenant node to request resources. The determining unit is configured to determine the resource demand corresponding to the resource request amount based on the resource request amount and the first remaining allocable resource amount when the first remaining allocable resource amount is less than the resource request amount. The acquisition unit is further configured to acquire a first target tenant node that has a hierarchical relationship with the tenant node; acquire the remaining allocable resources corresponding to the first target tenant node; wherein, the first target tenant node includes a lower-level tenant node or a higher-level tenant node corresponding to the tenant node, the higher-level tenant node is acquired when the remaining allocable resources of the lower-level tenant node do not meet the resource request amount, and the second weight value of the higher-level tenant node is less than the first weight value of the tenant node; The selection unit is used to select a target resource request quantity that matches the resource demand quantity from the remaining allocable resources, and allocate the target resource request quantity to the tenant node.
9. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, it implements the method as described in any one of claims 1-7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Resource scheduling method and device
CN113448726A
