Resource allocation method and device, electronic equipment, storage medium and program product
By introducing resource pool priority templates and target resource quantity settings in the cloud platform, the resource consumption and allocation process problems caused by frequent resource allocation requirements are solved, and the automatic resource allocation and efficient allocation results are achieved.
Patent Information
- Application Number
- CN202411814498.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In complex resource allocation scenarios, users' resource allocation needs frequently occur, resulting in frequent changes in the remaining resources in the resource pool, and the resources are automatically allocated and consumed. Users need to frequently adjust resource allocation applications to adapt to dynamic resource changes, resulting in a long time-consuming and low success rate of resource allocation process.
Provides a resource allocation method, by obtaining resource allocation requests, matching the resource pool updated in real time, crawling the remaining resources of the matching resource pool, and displaying the preset resource pool priority template set, allowing users to select priority templates and set the target resource number, and enable database transactions to complete resource allocation based on the selection and setting results.
Automatic resource allocation through priority management, without the need to reserve a large amount of resources, reduce labor costs and resource occupancy, improve allocation success rate and efficiency, ensure that resource allocation results meet user needs, and improve the reliability of resource allocation.
Smart Images

Figure CN119759555A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to cloud computing technology, and in particular to a resource allocation method, a resource allocation device, an electronic device, a non-transitory computer-readable storage medium, and a computer program product. Background Art
[0002] At present, the relevant technologies mainly use cloud platforms to solve the resource allocation problem. Specifically, multiple types of resource pools can be set for each user in the cloud platform to meet the different types of resource allocation needs of the user. Users can first apply for resources on the cloud platform, and then the cloud platform will allocate resources. Users can also pre-set some resource allocation trigger conditions, and each time the trigger conditions are met, the cloud platform automatically completes the resource allocation.
[0003] In some complex resource allocation scenarios, both resource allocation methods can be supported at the same time. When users have frequent resource allocation needs, the remaining resources in each resource pool will change frequently. In extreme cases, it is possible that a user queries one or several resource pools for allocatable resources at one point in time, but when the user applies for these resources at the next moment, these resources have been consumed by automatic allocation. At this time, the user needs to resubmit a new resource application.
[0004] When faced with the above extreme situations, either sufficient resources need to be reserved in each resource pool to cope with resource consumption that occurs at any time, or users need to adjust their resource allocation applications multiple times to actively adapt to the dynamic changes of such resources. The first response method has a high resource occupancy rate, which will greatly reduce the use of the resource in other scenarios. The second response scenario requires users to submit resource allocation applications frequently, and the entire resource allocation process is time-consuming and has a low success rate. Summary of the invention
[0005] The present disclosure provides a method for resource allocation, a resource allocation apparatus, an electronic device, a non-transitory computer-readable storage medium, and a computer program product.
[0006] According to one aspect of the present disclosure, a resource allocation method is provided, comprising:
[0007] Obtaining a resource allocation request, wherein the resource allocation request includes a plurality of request items, and the request items include the type and required quantity of resources to be allocated;
[0008] Matching the resource allocation request with resource pools of various types updated in real time to obtain a matching resource pool set for satisfying at least one of the request items;
[0009] Capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set;
[0010] In response to the selection of the resource pool priority template set, a target priority template is obtained, and in response to the setting of the matching resource pool set, a target resource quantity set for at least one target resource pool is obtained;
[0011] According to the selection and setting results, a database transaction is started to complete the resource allocation process matching the resource allocation request.
[0012] According to another aspect of the present disclosure, there is also provided a resource allocation device, comprising:
[0013] A request acquisition module, used to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, and the request items include the type and required quantity of the resources to be allocated;
[0014] A resource pool matching module, used to match the resource allocation request with resource pools of various types updated in real time, and obtain a matching resource pool set for satisfying at least one of the request items;
[0015] The first display module is used to capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set;
[0016] A response module, configured to obtain a target priority template in response to the selection of the resource pool priority template set, and obtain a target resource quantity set for at least one target resource pool in response to the setting of the matching resource pool set;
[0017] The resource allocation module is used to start a database transaction to complete the resource allocation process matching the resource allocation request according to the selection and setting results.
[0018] According to another aspect of the present disclosure, there is also provided an electronic device, including:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the resource allocation method as described in any one of the embodiments of the present disclosure.
[0022] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is further provided, wherein the computer instructions are used to enable a computer to execute the resource allocation method as described in any one of the embodiments of the present disclosure.
[0023] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program is executed by a processor to implement the resource allocation method as described in any one of the embodiments of the present disclosure.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0026] Figure 1 is a schematic diagram of a resource allocation method provided according to an embodiment of the present disclosure;
[0027] Figure 2 is a schematic diagram of another resource allocation method provided according to an embodiment of the present disclosure;
[0028] Figure 3 is a schematic diagram of another resource allocation method provided according to an embodiment of the present disclosure;
[0029] Figure 4 is a structural diagram of a resource allocation device provided according to an embodiment of the present disclosure;
[0030] Figure 5 It is a block diagram of an electronic device used to implement the resource allocation method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0032] Figure 11 is a schematic diagram of a resource allocation method provided according to an embodiment of the present disclosure. The embodiment of the present disclosure can be applied to the case where a resource pool is selected for a resource allocation request, a minimum allocation quantity is met, and resources are allocated according to priority. The method can be executed by a resource allocation device, which can be implemented in hardware and / or software, and can generally be configured in an electronic device, such as a server of a cloud platform.
[0033] Correspondingly, such as Figure 1 As shown, the method may specifically include:
[0034] S110: Obtain a resource allocation request.
[0035] The resource allocation request includes multiple request items, and the request items include the type and required quantity of the resources to be allocated.
[0036] Resource allocation request can be specifically understood as: in cloud computing usage scenarios, users or applications send to the cloud platform a request for allocation of resources in the platform, such as computing resources, storage resources, network resources, financial resources in cloud payment business scenarios, or various virtual item resources. In a specific example, the user can select all required cloud platform resources, initiate a request, generate a request set, and send the request set to the backend system through the http (Hypertext Transfer Protocol) request interface for the cloud platform to receive.
[0037] Resource allocation requests contain multiple request items, which are specific resource requirements proposed by multiple users or applications. Each request item specifies the type and quantity of resource requirements, and can also include request constraints, such as the storage location of the resource and the performance requirements for the resource.
[0038] S120: Match the resource allocation request with resource pools of various types that are updated in real time, and obtain a matching resource pool set that satisfies at least one of the request items.
[0039] The matching resource pool set can be specifically understood as a set of resource pools that can be used for allocation in the cloud platform. The matching resource pool set contains one or more matching resource pools. The matching resource pool contains resources that meet the resource type and resource quantity requirements of the resource allocation request. Corresponding to the resource allocation request, the resource pool type can be divided into computing resource pool, storage resource pool, network resource pool, or capital resource pool used to meet different payment requirements in the cloud payment business scenario.
[0040] In a cloud platform, a resource pool can serve multiple users or applications at the same time, and each user or application may issue multiple resource allocation requests based on their own needs. Since these requests are concurrent, resource usage will change dynamically with the execution of each request, so the resource pool is updated in real time to reflect the current resource usage and the number of remaining available resources. When a new resource allocation request arrives, the system can quickly and accurately match the resource pool according to the requested resource type based on the latest resource pool status. It can also effectively manage and optimize the cloud platform's resources through real-time updated data from the resource pool, improve resource utilization, and ensure the reliability of resource allocation.
[0041] Generally speaking, first, in the resource allocation request, constraints can be set in the request item according to the type of each resource to be allocated, such as setting a flag or number. Correspondingly, the resource pool storing the corresponding type of resources is provided with the same flag or number. After obtaining the resource allocation request, the request items in the resource allocation request are parsed, the flag or number of the request is identified, and all resource pools specified by the user are accurately identified by the flag or number. Then, according to the number or other constraints recorded in the request item, the identified resource pool is screened, for example, by checking the node label of each resource pool for screening, these labels identify the number of resources contained in the resource pool, or identify the resource model available on the resource node, such as when the user issues a resource allocation request for the allocation request of the GPU (Graphics Processing Unit, graphics processor) resource of the XX model of the XX company, the resource node of the resource pool can identify the stored GPU model to ensure the accuracy of the screening. Finally, the matching resource pool for satisfying the request item is screened.
[0042] S130: Capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set.
[0043] The resource pool priority template set can be specifically understood as: a collection of rule templates designed to limit the order in which resource pools participate in resource allocation in order to effectively allocate and schedule resources, ensuring the normal processing of resource allocation tasks. The resource pool priority template set contains a variety of resource pool priority rule templates, such as the default system resource pool priority rule template and the user-defined resource pool priority rule template. Each resource pool priority rule template contains the corresponding resource pool scheduling order rule. By capturing and displaying the remaining resource quantity of each matching resource pool and the preset resource pool priority template, users can manually select the resource allocation method based on their own resource allocation needs, ensure that the resource allocation results meet user needs, and improve the reliability of resource allocation.
[0044] The specific crawling method is to take a network snapshot of the remaining resource quantity of each matching resource pool at the current moment to obtain the crawling result.
[0045] The resource pool priority can be specifically prioritized according to the allocation range supported by the resource pool and the number of remaining available resources in the resource pool. For example, if a resource pool only supports a smaller resource allocation range or is a dedicated resource pool for a specific resource allocation request, and the number of remaining resources is small, in order to fully utilize the resources in the resource pool, it can be given a higher priority. When the remaining resources of the dedicated resource pool are insufficient to meet the request, other matching dedicated resource pools or general resource pools that support a wider range of resource allocation can be used to perform secondary allocation for the unfinished resource allocation request. These resource pools are usually designed to be more flexible and can handle various types of resource requests. In addition, the priority of the resource pool can also be formulated based on the performance indicators of the resource pool (such as resource utilization, average response time or average waiting time, etc.) or resource scheduling strategies (such as the shortest job priority strategy, the shortest remaining time priority strategy or the time slice rotation strategy, etc.).
[0046] In a specific example, the cloud platform can query the fully customized resource pool priority template set maintained according to the account ID, return the remaining number of resources matching the resource pool at the current moment and the resource pool priority template set to the front-end page for display, where the resource pool priority template includes not only the template maintained by the user, but also the system default template. The user checks to confirm the resource pool priority template used in this resource allocation request.
[0047] S140. In response to the selection of the resource pool priority template set, obtain a target priority template, and in response to the setting of the matching resource pool set, obtain a target resource quantity set for at least one target resource pool.
[0048] S150: According to the selection and setting results, a database transaction is started to complete a resource allocation process matching the resource allocation request.
[0049] The target resource quantity can be specifically understood as: the limit on the proportion or quantity of resources that the matching resource pools in the matching resource pool set must use when participating in the resource allocation process, that is, the minimum resource quantity or the minimum resource proportion. Users can manually set the target resource quantity for one or more matching resource pools in the matching resource pool set according to their own resource allocation needs. For resource pools that set the target resource quantity, internal priority sorting can be performed according to the target priority template selected by the user. When the user does not select a priority template, the target priority template uses the system default priority template, thereby determining the order of each resource pool in the process of meeting the target resource quantity. After all target resource quantity requirements are met, if there are still unmet resource allocation requests, the resource pools can be prioritized according to the target priority template, and the remaining resource allocation requests can be processed according to the priority.
[0050] When the user sets the target resource quantity, the resource pool with the target resource quantity set has a higher priority than the resource pool without the target resource quantity set. That is, in the process of processing resource allocation requests, the target resource quantity restrictions of each corresponding resource pool are met first according to the internal priority, and then other resource pools are considered for resource allocation. When the user does not set the target resource quantity, it is equivalent to that the minimum resource quantity used by each resource pool is unlimited, or the minimum resource quantity used is 0. The resource pool can directly sort the priorities according to the target priority template and process the resource allocation request according to the priority.
[0051] In a specific example, based on the specific information of the remaining resource quantity of each matching resource pool in the matching resource pool set and in combination with the resource allocation requirements, the user selectively inputs the minimum resource quantity used for each matching resource pool, that is, the target resource quantity. Selectivity means that it is not necessary to input. You can input the target resource quantity of some matching fund pools, or you can not input the target resource quantity at all. If you do not input it, the system will automatically allocate resources. The minimum means that in order to process this batch of resource allocation requests, a matching resource pool at least participates in the allocation of the corresponding number of resources. Obviously, since the background is constantly processing concurrent resource allocation requests, it may cause the remaining available resources to be insufficient when the current request is actually processed, which is less than the input target resource quantity. At this time, the system throws an exception and returns to the front-end page to indicate that the request processing failed. That is, the minimum means that it would rather fail to process this request, and the resource allocation quantity of this fund pool cannot be lower than the target resource quantity. Obviously, based on the target resource quantity mechanism, users can customize how each resource in the resource allocation request is allocated through the matching resource pool. For example, if the resource allocation request has 30,000 resources in total, users can split these 30,000 resources separately and enter the target resource quantity fields of different matching resource pools to achieve the purpose of fully controlling the use of certain matching resource pools for allocation, which has great flexibility. The user sends the resource allocation request set, the target priority template selected for this resource allocation, the matching resource pool set, and the corresponding target resource quantity to the system backend to start the database transaction to complete the resource allocation process that matches the resource allocation request.
[0052] The technical solution of the disclosed embodiment is achieved by obtaining a resource allocation request; matching the resource allocation request with various types of resource pools updated in real time, obtaining a matching resource pool set for satisfying at least one of the request items; capturing the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and displaying the captured result and the preset resource pool priority template set; in response to the selection of the resource pool priority template set, obtaining the target priority template, and in response to the setting of the matching resource pool set, obtaining the target resource quantity set for at least one target resource pool; according to the selection and setting results, starting a database transaction to complete the resource allocation process that matches the resource allocation request. By designing priorities to achieve automatic resource allocation, there is no need to reserve a large number of resources, reducing labor costs and resource occupancy, improving allocation success rate and efficiency, supporting users to set the target resource quantity, ensuring that the resource allocation results meet user needs, and improving the reliability of resource allocation.
[0053] Figure 2It is a schematic diagram of another resource allocation method provided according to an embodiment of the present disclosure. This embodiment concretizes the operation of "matching the resource allocation request with various types of resource pools updated in real time to obtain a matching resource pool set for satisfying at least one of the request items" in the above embodiment as follows: "Parse the request item in the resource allocation request; map the field value of the parsed request field to the requirement field value of the attribute field corresponding to the resource pool, wherein the attribute field contains the type attribute of the resource pool; organize the requirement field value of each attribute field to obtain a query condition set of or relationship; obtain the initial hit resource pool that hits at least one query condition in the query condition set in each resource pool; obtain the target resource pool whose remaining number of resources is not zero in the initial hit resource pool to form the matching resource pool set".
[0054] Correspondingly, such as Figure 2 As shown, the method may specifically include:
[0055] S210: Obtain a resource allocation request.
[0056] The resource allocation request includes multiple request items, and the request items include the type and required quantity of the resources to be allocated.
[0057] S220: Parse the request item in the resource allocation request.
[0058] Optionally, each request item in the resource allocation request may be parsed separately.
[0059] S230: Map the field value of the parsed request field to the required field value of the attribute field corresponding to the resource pool.
[0060] The attribute field includes the type attribute of the resource pool.
[0061] The field value of the request field can be specifically understood as: the specific request information filled in by the user when submitting a resource allocation request, that is, the resource request information contained in the request item. The attribute field corresponding to the resource pool can be specifically understood as: the field value that describes the characteristics and status of the resource pool, such as the type attribute of the resource pool, the number of available resources, or the default priority of the resource pool. The requirement field value of the attribute field can be specifically understood as: the field format that needs to be converted when constructing a mapping relationship between the field value of the request field and the attribute field corresponding to the resource pool.
[0062] After receiving the resource allocation request set, the cloud platform aggregates and removes duplicate request information, that is, it traverses the resource allocation request set, parses the parameters related to the resource pool, and converts them into a series of corresponding conditions that can be used for database SQL queries, including resource pool attribute fields.
[0063] In a specific example, when the attribute field recorded in the resource allocation request is requestMonth=202409, the field can be mapped to the requirement field value corresponding to the resource pool sourcePoolType=normal request month request resource and sourceReferId=yearMonth202409.
[0064] S240: Organize the required field values of the attribute fields to obtain a query condition set of the OR relationship.
[0065] The query condition set can be specifically understood as: a set of conditions that can be used for database SQL queries. The required field values obtained can be merged and connected through the or relationship as the query condition set.
[0066] S250: Acquire, from each of the resource pools, an initial hit resource pool that hits at least one query condition in the query condition set.
[0067] S260: From the initial hit resource pool, obtain a target resource pool whose number of remaining resources is not zero to form the matching resource pool set.
[0068] In each resource pool, filter according to the query condition set, and obtain the resource pool that meets at least one of the conditions as the initial hit resource pool. When the number of remaining available resources in the initial hit resource pool is not zero, it means that it can participate in processing at least one resource allocation request in the resource allocation request set, and the initial hit resource pool is used as the target resource pool, and all the obtained target resource pools form a matching resource pool set.
[0069] S270: Capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set.
[0070] S280. In response to a target priority template selected in the resource pool priority template set and a target resource quantity set for at least one target resource pool in the matching resource pool set, a database transaction is started to complete a resource allocation process that matches the resource allocation request.
[0071] The technical solution of the disclosed embodiment is to obtain a resource allocation request. The request item in the resource allocation request is parsed, and the field value of the parsed request field is mapped to the demand field value of the attribute field corresponding to the resource pool, and the demand field value of each attribute field is organized to obtain a query condition set of or relationship, and an initial hit resource pool that hits at least one query condition in the query condition set is obtained in each of the resource pools; in the initial hit resource pool, a target resource pool with a non-zero number of remaining resources is obtained to form the matching resource pool set. By parsing the field value of the request field and determining the query condition through the mapping relationship with the demand field value in the resource pool, the matching resource pool set is screened out for resource allocation in combination with the remaining available quantity, thereby realizing automated resource allocation, reducing labor costs and resource occupancy, and improving allocation efficiency.
[0072] In an optional implementation of this embodiment, starting a database transaction to complete a resource allocation process matching the resource allocation request according to the selection and setting result may include:
[0073] After the database transaction is started, the database transaction is locked for each type of resource pool;
[0074] Matching the resource allocation request with the resource pools of various types locked by the database transaction to obtain a locked resource pool set for satisfying at least one of the request items;
[0075] Sorting the locked resource pool set according to the target priority template to obtain a priority resource pool set;
[0076] Acquire the target resource quantity in each target resource pool, and perform resource allocation for the resource allocation request;
[0077] According to the remaining amount of resources in each resource pool in the priority resource pool set, secondary resource allocation is performed on the unsatisfied request items in the resource allocation request.
[0078] The locked resource pool set can be specifically understood as: after the database transaction is locked, the set of resource pools that meet at least one resource allocation request is screened. On this basis, the resource pools in the locked resource pool are prioritized according to the target priority template, and the resulting set is the priority resource pool set.
[0079] Generally speaking, since the resource pool needs to deduct the corresponding resource quantity after the resource allocation is completed during the resource allocation process, the resource quantity deduction is a strong database transaction operation, that is, when performing the deduction operation, all related database operations must either succeed or fail, thereby avoiding data inconsistency. In a specific example, before any query and calculation related to resource allocation is performed in the background, it is necessary to open the database transaction and lock the user ID (identifier) to prevent concurrent deductions from causing resource pool resource quantity deduction errors. After obtaining the priority resource pool set, when there is a resource pool with a target resource quantity set in the priority resource pool set, the target resource quantity is first obtained from each target resource pool to perform a resource allocation for the resource allocation request to meet the minimum resource usage requirement.
[0080] Then, according to the remaining resource quantity of each resource pool in the priority resource pool set, the resources in the resource pool are obtained according to the priority to perform secondary resource allocation for the unsatisfied request items in the resource allocation request. When the target resource quantity is not set for the resource pools in the priority resource pool set, the resources in the resource pool can be obtained according to the priority to perform resource allocation for the request items in the resource allocation request.
[0081] By locking the resource allocation database transaction and building a corresponding priority resource pool set for resource allocation based on this, data consistency and accuracy can be achieved when performing resource quantity deduction operations, thereby enhancing the reliability of resource allocation and user trust.
[0082] In another optional implementation of this embodiment, sorting the locked resource pool set according to the target priority template to obtain the priority resource pool set may include:
[0083] When it is verified that the locked resource pool set meets the resource pre-allocation condition according to the matching resource pool set and the quantity of each target resource, the locked resource pool set is sorted according to the target priority template to obtain the priority resource pool set.
[0084] The pre-allocation condition can be specifically understood as: the restriction condition set by the user on the resource pool in the matching resource pool set before the resource allocation database transaction is locked.
[0085] Generally speaking, due to the concurrent resource allocation requests that are constantly processed in the background, the resource pools contained in the locked resource pool set obtained when the resource allocation database transaction is locked may be different from the resource pools in the matching resource pool set obtained before the database transaction is locked. If the user sets a limited constraint condition for the resource pool in the matching resource pool set before the database transaction is locked, such as the target resource quantity, and the locked resource pool set does not contain the resource pool, the resource allocation request processing will definitely fail due to failure to meet the target resource quantity requirement set by the user. In addition, concurrent processing of resource allocation requests may also cause the number of available resources of the resource pool with the target resource quantity in the locked resource pool set to be insufficient to meet the target resource quantity requirement. Therefore, before sorting the locked resource pool set by the target priority template, it can be determined whether to perform subsequent resource allocation processing by comparing the total number of resource pools with the target resource quantity set in the locked resource pool set and the matching resource pool set. If they are the same, the subsequent resource allocation process will continue to be executed. If they are different, an exception is thrown. By detecting whether the locked resource pool set meets the resource pre-allocation conditions, the early identification of resource allocation anomalies is achieved, and the resource allocation efficiency is improved.
[0086] In another optional implementation of this embodiment, verifying that the locked resource pool set meets the resource pre-allocation condition according to the matching resource pool set and the quantity of each target resource may include:
[0087] Determine whether the locked resource pool set includes all the target resource pools in the matching resource pool set;
[0088] If so, when it is detected that the remaining resource quantity of each target resource pool after the database transaction is locked is greater than or equal to the set target resource quantity, it is determined that the locked resource pool set meets the resource pre-allocation condition.
[0089] The target resource pool can be specifically understood as a resource pool with a target resource quantity set in the matching resource pool set. If the locked resource pool set contains all the target resource pools in the matching resource pool set, and the remaining resource quantity in the target resource pool is greater than or equal to the target resource quantity, it means that the resource pre-allocation conditions are met and the subsequent resource allocation process can be executed.
[0090] By detecting whether the locked resource pool set contains the target resource pool and verifying whether the remaining number of resources in the target resource pool meets the set target resource number requirements, resource allocation anomalies can be identified in advance and resource allocation efficiency can be improved.
[0091] In another optional implementation of this embodiment, sorting the locked resource pool set according to the target priority template to obtain the priority resource pool set may include:
[0092] Acquire a first resource pool and a second resource pool to be sorted in the locked resource pool set;
[0093] Obtain target attribute fields in sequence according to the attribute field sorting order in the target priority template;
[0094] Acquire a first field value of the first resource pool under the target attribute field, and a second field value of the second resource pool under the target attribute field;
[0095] If the first field value is the same as the second field value, returning to execute the operation of sequentially acquiring the target attribute fields according to the sorting order of the attribute fields in the target priority template;
[0096] If the first field value and the second field value are not the same, the first resource pool and the second resource pool are sorted according to the sorting order of the field values under the target attribute field in the target priority template.
[0097] The first resource pool and the second resource pool can be specifically understood as: two resource pools to be sorted in the locked resource pool set. Here, the first and second are only used to distinguish the two resource pools, and there is no order of precedence. The target attribute field can be specifically understood as: the attribute field used to determine the priority of the resource pool among the attribute fields contained in the resource pool. The first field value and the second field value can be specifically understood as: the currently selected attribute field values corresponding to the first resource pool and the second resource pool respectively for determining the priority of the resource pool. Here, the first and second are only used to distinguish the two field values, and there is no order of precedence.
[0098] Generally speaking, based on the target priority template selected by the user, the locked resource pool set is sorted, that is, the resource pools in the locked resource pool set are compared in pairs, and the priority is determined by a two-layer comparison algorithm. The first layer is the comparison between attribute fields, and the second layer is the comparison within the attribute field, so as to determine the resource pool priority sorting result required by the user. The sorting relationship between attribute fields can be represented by a string sequence, for example: attribute field b, attribute field c, attribute field a and attribute field d. By traversing this sequence, the comparisons are made in sequence until the determined priority is confirmed. The sorting relationship within the attribute field is based on the specific attribute field confirmed above, such as attribute field d, and the priority comparison method is queried from the key-value pair set of MAP <attribute field, priority comparison method>, and then the specific resource pool parameter values are compared. After obtaining the first field value and the second field value, a comparison is performed. If the first field value and the second field value are the same, the first resource pool and the second resource pool are sorted by comparing the specific resource pool parameter values in the same attribute field in the key-value pair set of MAP <same attribute field, priority comparison method>, and the sorting result is returned. If the first field value and the second field value are not the same, the first resource pool and the second resource pool are sorted according to the sorting relationship between the attribute fields specified in the target priority template, and the sorting result is returned. By implementing a double-layer priority comparison method between attribute fields and within attribute fields to determine the priority of the resource pool, the degree of refinement of resource allocation can be significantly improved, and resource allocation and utilization can be optimized. This method ensures the stability and reliability of the resource allocation business, and can dynamically adjust resource allocation to adapt to changing business needs when resources are tight. In addition, it also helps to avoid resource waste and optimize cost-effectiveness by adjusting the allocation priority while ensuring the quality of resource allocation, thereby providing higher flexibility and efficiency for resource allocation of the cloud platform.
[0099] In another optional implementation of this embodiment, obtaining the target resource quantity in each target resource pool and performing a resource allocation on the resource allocation request may include:
[0100] In each of the target resource pools, a current target resource pool is obtained in turn, and a current type and a current target resource quantity corresponding to the current target resource pool are obtained;
[0101] Traversing each target request item whose type of resource to be allocated in the resource allocation request matches the current type, and allocating resources of the current target resource quantity in the current target resource pool;
[0102] Annotate the resource allocation status of the target request item allocated to the resource; wherein the resource allocation satisfaction status includes satisfied or partially satisfied;
[0103] Return to execute in each of the target resource pools, and sequentially obtain the operation of the current target resource pool until a resource allocation to all the target resource pools is completed.
[0104] A resource allocation may be specifically understood as: resource allocation that is first performed to meet the demand for target resource quantities of each target resource pool.
[0105] Generally speaking, since the allocation requirement of the target resource quantity of a target resource pool can satisfy one or more target request items, similarly, the resource requirements of a target request item can be satisfied by one or more target resource pools. Therefore, it is necessary to mark the resource allocation status of the target request item allocated to the resource after satisfying the allocation requirement of the target resource quantity of each target resource pool. The resource allocation status is divided into satisfied or partially satisfied, and the partially satisfied part needs to be allocated a second time to satisfy the allocation request. By allocating in batches, it is ensured that the target resource quantity conditions set by the user can be met, and the resource allocation results meet the user's needs, which improves the reliability of resource allocation.
[0106] In another optional implementation of this embodiment, performing secondary resource allocation on unsatisfied request items in the resource allocation request according to the remaining amount of resources in each resource pool in the priority resource pool set includes:
[0107] Sequentially acquiring current request items from among the request items not marked as satisfied in the resource allocation request;
[0108] Sequentially acquiring a current priority resource pool from the priority resource pool set, and detecting whether the type of the current priority resource pool and the remaining resource quantity satisfy the resource allocation status of the current request item;
[0109] If it is fully satisfied, after allocating resources to the current request item, marking the fully satisfied state of the current request item, and returning to execute the operation of sequentially obtaining the current request items from each of the request items not marked as satisfied in the resource allocation request;
[0110] If it can be partially satisfied, after allocating resources to the current request item, the resource allocation satisfaction state of the current request item is updated, and the operation of sequentially acquiring the current priority resource pool in the priority resource pool set is returned;
[0111] If it cannot be satisfied, the operation of directly returning to the priority resource pool set to sequentially obtain the current priority resource pool is performed.
[0112] Get the current request items that are not marked as meeting the allocation status for secondary allocation, and get the current priority resource pool detection type and remaining resource quantity to detect whether they meet the current allocation requirements.
[0113] If the type matches and the number of remaining resources is greater than or equal to the resource request amount of the current request item, that is, it is fully satisfied, then after the resource allocation, the current request item is marked as fully satisfied and the operation is returned; if the type matches and the number of remaining resources is less than the resource request amount of the current request item, and the number of remaining resources is greater than 0, that is, it is partially satisfied, then after the resource allocation, the resource allocation requirements of the current request item are updated, the current request item is still partially satisfied, and the operation is returned; if the type does not match or the number of remaining resources is equal to 0, that is, it cannot be satisfied, then the operation is directly returned. By giving priority to satisfying the minimum usage quantity of the resource pool, and then satisfying the remaining unsatisfied resource allocation requests according to the priority order, the effective utilization of the remaining resources in the resource pool is ensured, without reserving a large number of resources, reducing labor costs and resource occupancy, improving allocation success rate and efficiency, ensuring that the resource allocation results meet user needs, and improving the reliability of resource allocation.
[0114] Further, based on the implementation methods of the above embodiments, after determining whether the locked resource pool set includes all the target resource pools in the matching resource pool set, the method may further include:
[0115] If not, a prompt is given to reset the target resource quantity according to the difference between the locked resource pool set and the matching resource pool set.
[0116] If the locked resource pool set does not contain all the target resource pools in the matching resource pool set, or the locked resource pool set contains all the target resource pools in the matching resource pool set, but the remaining number of resources in at least one target resource pool is less than the target number of resources, it means that the resource pre-allocation conditions are not met and the subsequent resource allocation process cannot be executed, and an exception is thrown. For example, after the exception is thrown and returned to the front-end page to indicate that the resource allocation request processing failed, the user can also be prompted that the target resource number input for a specific resource pool exceeds the quota. The user can make adjustments based on the previous input information, such as adjusting the target resource number to a smaller value, or changing it to 0, so that the resource allocation request can be submitted again quickly. By detecting whether the locked resource pool set contains the target resource pool and verifying whether the remaining number of resources in the target resource pool meets the set target resource number requirements, resource allocation anomalies can be identified in advance and resource allocation efficiency can be improved.
[0117] Figure 3It is a schematic diagram of another resource allocation method provided according to an embodiment of the present disclosure. This embodiment concretizes the operation of "starting a database transaction to complete the resource allocation process that matches the resource allocation request" in the above embodiment as follows: "detect whether the first sum of the target resource quantities set for each of the target resource pools is greater than the second sum of the required quantities of resources required to be allocated for each of the request items; if not, start a database transaction to complete the resource allocation process that matches the resource allocation request; if so, reset the target resource quantity according to the difference between the first sum and the second sum."
[0118] Correspondingly, such as Figure 3 As shown, the method may specifically include:
[0119] S310: Obtain a resource allocation request.
[0120] The resource allocation request includes multiple request items, and the request items include the type and required quantity of the resources to be allocated.
[0121] S320: Match the resource allocation request with resource pools of various types that are updated in real time, and obtain a matching resource pool set that satisfies at least one of the request items.
[0122] S330: Capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set.
[0123] S340: Responding to a target priority template selected in the resource pool priority template set and a target resource quantity set for at least one target resource pool in the matching resource pool set.
[0124] S350: Detect whether the first sum of the target resource quantities set for each target resource pool is greater than the second sum of the required quantities of resources to be allocated to each request item. If not, execute S360. If yes, execute S370.
[0125] The first sum can be specifically understood as: the sum of the target resource quantities set by each target resource pool, that is, the minimum total number of resource allocations that must be met first for this resource allocation request. The second sum can be specifically understood as: the sum of the resource quantities required for the request items of each resource allocation request, that is, the total amount of resources required for this resource allocation request. If the first sum is greater than the second sum, it means that the total amount of resources required for this resource allocation request is less than the minimum total number of resource allocations. For example, the total resource allocation request requires 90 resources, and the minimum resource usage of the resource pool is 100 resources. It is definitely unable to meet the set target resource quantity requirements, and S370 needs to be executed. If the first sum is less than or equal to the second sum, it means that the total amount of resources required for this resource allocation request is greater than or equal to the minimum total number of resource allocations, which can meet the set target resource quantity requirements, and S360 is executed to allocate resources.
[0126] S360: Start a database transaction to complete the resource allocation process that matches the resource allocation request.
[0127] S370: Prompt to reset the target resource quantity according to the difference between the first total and the second total.
[0128] When the set target resource quantity requirement cannot be met, the difference between the first sum and the second sum is calculated, and the calculation result is displayed, prompting the user to reset the target resource quantity.
[0129] The technical solution of the embodiment of the present disclosure obtains a resource allocation request; matches the resource allocation request with various types of resource pools updated in real time, and obtains a matching resource pool set for satisfying at least one of the request items; captures the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and displays the capture result and the preset resource pool priority template set; responds to the target priority template selected in the resource pool priority template set, and the target resource quantity set for at least one target resource pool in the matching resource pool set; detects whether the first sum of the target resource quantity set for each target resource pool is greater than the second sum of the required quantity of resources required to be allocated for each request item; if not, a database transaction is started to complete the resource allocation process matching the resource allocation request; if so, the target resource quantity is reset according to the difference between the first sum and the second sum. By comparing the target resource quantity with the sum of the required quantity of each request item in advance, an exception is thrown in advance and the subsequent allocation process is terminated when the resource allocation requirements set by the user cannot be met, thereby enhancing the stability and reliability of the system. In addition, the proactive response capability of the system is improved through the preventive inspection mechanism, and the resource allocation efficiency is improved.
[0130] Further, based on the implementation methods of the above embodiments, the resource allocation method may further include:
[0131] In the process of obtaining the target resource quantity in each target resource pool and performing a resource allocation for the resource allocation request, if it is determined that the resource allocation for the target resource quantity in any target resource pool cannot be completed, then the resource allocation process is terminated;
[0132] A prompt is given to reset the target resource quantity for each target resource pool where resource allocation fails.
[0133] Generally speaking, if it is determined that resource allocation of the target resource quantity in any target resource pool cannot be completed, that is, the minimum allocation requirement cannot be met, the resource allocation process is terminated, and a prompt to reset the target resource quantity is given for each target resource pool where allocation failed.
[0134] In a specific example, each request item in the resource allocation request is first used to deduct and process the target resource quantity. Traverse the resource pool. If the target resource quantity is not entered, skip it; if the target resource quantity is entered, allocate the target resource quantity. Specifically, it can be: traverse the sorted target resource pool to determine whether there is any unmet target resource quantity. If not, skip it; if yes, perform a matching check on the resource pool to confirm that the current resource pool can handle the current resource allocation request, for example, determine whether the corresponding attribute of the resource pool can participate in the allocation. If not, skip it; if yes, allocate resources on demand and according to availability. On demand means that the number of resources in a resource allocation request may be allocated by multiple resource pools. At this time, the resource pool is the latest remaining target resource quantity. According to availability means that a resource pool may participate in processing multiple resource allocation requests, and the latest target resource quantity will also be generated at this time. Until the resource allocation request is completed, and the target resource quantity of the target resource pool is not met, an exception is thrown, and it is returned to the front-end page to indicate that the request processing failed, and the user is prompted that the target resource quantity of a specific resource pool has been input in excess. When the set target resource quantity requirements cannot be met, an exception is thrown and the user is clearly prompted which target resource quantity parameter is set in excess. This not only provides users with clear error feedback, helping them to quickly locate and correct problems, but also improves the success rate of subsequent resource allocation, enhances user experience, promotes the rational allocation and utilization efficiency of resources, and protects the stability and reliability of resource allocation.
[0135] Further, based on the implementation methods of the above embodiments, the resource allocation method may further include:
[0136] In the process of performing secondary resource allocation for the unsatisfied request items in the resource allocation request according to the remaining resource quantity of each resource pool in the priority resource pool set, if it is determined that the resource allocation demand for any request item cannot be met, then the resource allocation process is terminated;
[0137] A prompt is provided for reselecting or resetting the target priority template.
[0138] Generally speaking, as mentioned above, during the secondary resource allocation process, if it is determined that the resource allocation requirements for any request item cannot be met, that is, the subsequent allocation process cannot be met while the target resource quantity requirements set by the user are met, for example, a subsequent request item requires resources from a specific type of resource pool, but the number of corresponding resource pools in the priority resource pool set is insufficient and the number of resources in the general resource pool applicable to various types of requests is also insufficient, then the resource allocation process is terminated to reselect or reset the target priority template. For example, the user can reselect or set the priority template so that the general resource pool has a lower priority, thereby increasing the success rate of the secondary allocation. This provides users with clear error feedback, improves the success rate of secondary resource allocation, ensures that the resource allocation results meet user needs, and improves the reliability of resource allocation.
[0139] Further, based on the implementation manners of the above embodiments, after the target priority template is reselected or reset, the following may also be included:
[0140] Calculate the target allocation success rate score that matches the target priority template according to the universality score and sorting order of each resource pool in the target priority template;
[0141] Prompt each resource pool priority template whose centralized allocation success rate score of the resource pool priority template is greater than the target allocation success rate score;
[0142] or
[0143] According to the universality scores and sorting order of each resource pool in the target priority template, at least one reset strategy that can improve the target allocation success rate score of the target priority template is obtained, and the at least one reset strategy is prompted.
[0144] Generally speaking, after prompting the user to handle the specific resource allocation request that failed and reselecting or resetting the target priority template, the success rate score is calculated based on the universality score and sorting order of each resource pool in the target priority template. Specifically, when the universality of the resource pool is higher (the more resource allocation request types that can participate in the allocation) and the sorting order priority is higher, the success rate score is lower, and vice versa; when the universality of the resource pool is lower (the fewer resource allocation request types that can participate in the allocation and the dedicated resource pool for a certain request type) and the sorting order priority is higher, the success rate score is higher, and vice versa. The higher the success rate score, the higher the priority of the dedicated resource pool and the resource pool with lower universality has a higher priority and the resource pool with higher universality has a lower priority, so that the allocation success rate in the secondary allocation process is greater. Prompt each resource pool priority template whose centralized allocation success rate score is greater than the target allocation success rate score corresponding to the resource pool priority template that currently fails to allocate, or obtain at least one reset strategy that can improve the target allocation success rate score of the target priority template for prompting for the user to choose. For example, prompt the user to change the order of resource pool 2 and resource pool 3 based on the currently selected priority template, so as to obtain a higher success rate score. By prompting the user with a target priority template with a higher target allocation success rate score, the resource allocation strategy is optimized and the efficiency of resource request and allocation is improved. This template helps users make appropriate choices quickly according to their needs through clear priority guidance, improves the versatility of resource allocation, improves the success rate of secondary resource allocation, effectively avoids resource waste, and enhances user experience.
[0145] Further, based on the implementation methods of the above embodiments, the resource allocation method may further include:
[0146] After successfully completing the resource allocation, updating the remaining amount of resources in each of the resource pools providing the resources;
[0147] After the update is completed, the database transaction is terminated and the resource allocation result is displayed.
[0148] Generally speaking, after resource allocation is successfully completed, the remaining resource quantities in each resource pool participating in resource allocation are updated, the database transaction is ended, and the resource allocation results are displayed.
[0149] In a specific example, after completing all resource allocation requests, the remaining available resources in the database of each resource pool in the priority resource pool set are updated, and the corresponding resource usage quantity is updated. For example, for resource pool A, the remaining available resources queried from the database are amount, and the total number of resources used in the resource allocation request is amount1, which needs to be updated to amount-amount1. The resource allocation results are returned to the front-end user for display, which may specifically include the resource pools participating in the resource allocation, and the resource allocation quantity of each resource pool participating in the allocation. After the resource allocation is successfully completed, the remaining resource quantity of each participating resource pool is updated and the detailed allocation results are displayed, which not only improves the transparency of the resource allocation operation and the user's trust, but also ensures the consistency and integrity of the data, enhances the monitoring capability of resources, optimizes the utilization efficiency of resources, and improves the reliability of resource allocation.
[0150] For ease of understanding, the specific application scenarios to which each embodiment of the present disclosure is applicable are now described. Existing resource allocation services are mainly carried out using cloud platforms, such as the cloud platform's fund pool payment resource allocation service, the deployment and scheduling of cloud education resources, and the construction and scheduling of cloud distributed system resources. Resource allocation in cloud platform business scenarios is extremely complex, involving the attributes of multiple resource allocation objects such as resource accounts, products, time, and resource types. With the refinement of operational management and the increase in customer demand for resource control, the resource pool system model and business concepts have become complex. Designing a dedicated resource pool for specific resources can improve the accuracy of resource management and control, but it also complicates the result processing of resource allocation requests by the cloud platform.
[0151] When processing resource allocation requests, users can only query the snapshot data of the resource pool at a certain moment and perform check and match operations. Faced with complex resource allocation requests and a large number of resource pool scenarios, manual judgment of allocation methods takes a long time, increasing labor costs. In addition, since other resource allocation operations are performed concurrently while users are operating, the actual remaining available resource data in the resource pool is volatile, resulting in frequent failures in resource allocation requests, reducing the success rate of resource allocation. Although the success rate of resource allocation can be improved by reserving a large number of buffer resources, it will increase the resource occupancy rate.
[0152] To solve the above problems, the embodiment of the present disclosure proposes a resource allocation method. The resource allocation method may specifically include two important operations, one is resource allocation problem data modeling, and the other is a specific resource allocation process.
[0153] 1. Data modeling for resource allocation problems
[0154] The resources of the cloud platform have many resource attributes. Table 1 shows the attribute fields of the cloud platform resources.
[0155] Table 1
[0156]
[0157] Obviously, cloud platforms generally support batch processing functions. For example, in order to process all cloud resource allocation operations at one time, users will batch select a batch of resources, such as cloud servers, traffic bandwidth, cloud storage and other related resources.
[0158] These resources have different attributes, and the parameters of the resource allocation requests generated are different. The corresponding allocation requests can be expressed as a set:
[0159] requests = {
[0160] (accountId, resourceName, requestMonth, requestPlanId, contractNum, Amount...),
[0161] (accountId, resourceName, requestMonth, requestPlanId, contractNum, Amount…),
[0162] (accountId, resourceName, requestMonth, requestPlanId, contractNum, Amount…)
[0163] …}
[0164] With the increasing demand for refined operation management and customers' demand for refined resource control, the system model and business domain concepts of the resource pool are highly complex. Providing dedicated designs for special resources can solve the problem of resource control granularity. Table 2 shows the attribute fields of dedicated resource design.
[0165] Table 2
[0166]
[0167] These resource pools have different properties. According to the constraints, they can process different requests and have different remaining available resources. All available resource pools can be represented by a set:
[0168] pool_set={
[0169] (sourceType, sourceId, sourcePoolType, sourceReferId, contractNum, Amount...),
[0170] (sourceType, sourceId, sourcePoolType, sourceReferId, contractNum, Amount...),
[0171] (sourceType, sourceId, sourcePoolType, sourceReferId, contractNum, Amount…)
[0172] …}
[0173] 2. Specific process of resource allocation
[0174] In order to realize automatic resource allocation, the embodiment of the present disclosure designs a resource pool priority template management configuration module to maintain the priority relationship of different types of resource pools. The system will have a global priority relationship default value, and each user can maintain multiple sets of customized resource pool priority templates. The global resource pool priority template default value will define the priority ranking relationship between two different resource pools. The ranking relationship is divided into two layers:
[0175] The first layer is the sorting relationship between attribute fields. For example, when comparing the priorities of resource pool A and resource pool B, the [sourceType resource request source type] attribute field is compared first. If the [sourceType resource request source type] attribute field is consistent, other attribute fields are compared, such as the [sourcePoolType resource pool type] field, until the inconsistency is found and the accurate priority is confirmed; if it is inconsistent, the sorting relationship within the attribute field of the [sourceType resource request source type] attribute field is used for sorting. The sorting relationship between attribute fields can be represented by a string sequence: attribute field b, attribute field c, attribute field a, and attribute field d, which represents the priority relationship: attribute field b>attribute field c>attribute field a>attribute field d.
[0176] The second layer is the sorting relationship within the attribute field. For example, for the [sourceType resource request source type] attribute field, the priority of the default template is: general resources > alternative resources > cloud platform reward resources. For the [contractNum resource pool agreement contract] attribute field, the priority of the default template is: specific contract > no specific contract. And for the remaining available resources in the resource pool, the priority of the default template is: the smaller the remaining number > the larger the remaining number. Obviously, the sorting relationship within the attribute field is an unstructured method, which can be managed using the key-value pair collection management method of the data structure MAP<attribute field, priority comparison method>. When comparing resource pool A and resource pool B, the attribute field to be compared will be determined first. The corresponding attribute field can be used to query the priority comparison method in the key-value pair collection of MAP<attribute field, priority comparison method>, and then compare the specific parameter values.
[0177] By maintaining multiple sets of customized resource pool priority templates, you can meet diverse resource management needs. For example, the second layer is the sorting relationship within the attribute field. For proxy users, since they proxy other users' resource allocation requests, they obtain reward resources issued by the cloud platform, resulting in a large amount of reward resources accumulated over time. Therefore, you need to set the [sourceType resource request source type] attribute field. The customized resource pool priority template is: cloud platform reward resources > alternative resources > general resources. This maximizes resource utilization and helps meet personalized resource needs.
[0178] The specific process of resource allocation can be:
[0179] (1) The user selects all resources that need to be allocated, initiates a request, generates a resource allocation request set, and sends the requests information to the backend system through the http request interface.
[0180] (2) The backend system receives the resource allocation request set requests, aggregates and removes duplicate requests, and queries the resource pool set set_V1 that currently has available resources, i.e., amount>0, and can participate in any resource allocation request. The aggregation and deduplication method is to traverse the resource allocation request set requests, parse the parameters related to the resource pool, and convert them into corresponding resource pool attribute fields. For example, if requestMonth=202409 in the resource allocation request, it can be converted into: sourcePoolType=normal request month request resource and sourceReferId=yearMonth202409 and other conditions that can be used for database query. Finally, these conditions are merged through the or relationship. The query result at least hits and satisfies any one of the conditions, which means that at least one resource allocation request in the resource allocation request set requests can be processed.
[0181] (3) The backend system queries the maintained set of fully customized resource pool priority templates according to the user ID accountId.
[0182] (4) The backend system returns the resource pool set set_V1 and the resource pool priority template set templates to the frontend page for display. In addition to the templates maintained by the user, the resource pool priority template can also select the system default template.
[0183] (5) The user checks and confirms the resource pool priority template to be used for this request.
[0184] (6) Based on the specific information of the resource quantity of the resource pool set and the actual resource allocation requirements, the user selectively enters the [minimum number of resources to be used] for the resource pool set. Selectivity means that it is not necessary to enter. You can enter the [minimum number of resources to be used] for some resource pools, or you can not enter it at all. Not entering means that the system will automatically allocate resources. Minimum means that in order to process this batch of resource allocation requests, a resource pool at least participates in the allocation of the corresponding number of resources. Obviously, due to the continuous processing of concurrent resource allocation requests in the background, the number of remaining available resources may be insufficient when the actual allocation is made, which is less than the [minimum number of resources to be used] entered. At this time, the system needs to throw an exception and return to the front-end page to indicate that the processing failed, that is, the resource usage of this resource pool cannot be lower than the set value, otherwise it will prompt that the processing of this request has failed. Obviously, based on the [Minimum Quantity of Resources Used] mechanism, users have great flexibility and can fully customize how each resource in the allocation request is allocated through the resource pool. For example, if there are 30,000 resource allocation requests in total, the user can split the 30,000 into separate parts and enter the [Minimum Quantity of Resources Used] fields of different resource pools to achieve full control over the use of certain resource pools for allocation, which is extremely flexible.
[0185] (7) The user sends the resource request set requests, the resource pool priority template template selected for this order, the resource pool set set_V1, and the corresponding [minimum number of resources to be used] to the system backend for resource pool allocation.
[0186] (8) Since resource deduction requires strong database transaction management, before performing any query or calculation in the background, start the database transaction and lock the user ID to prevent concurrent deductions from causing resource pool quantity deduction errors.
[0187] (9) The background system receives the resource allocation request set requests, aggregates and removes duplicate requests, and queries the resource pool set_V2 that currently has available resources (amount>0) and can participate in any resource allocation request. Obviously, due to the concurrent processing of background resource allocation requests, the sets of set_V2 and set_V1 may be different at this time. For example, the number of optional resource pool sets decreases or the number of remaining available resources decreases. At this time, a check can be performed based on set_V2 and set_V1 to determine whether resource allocation can be performed.
[0188] (10) Verify the minimum number of resources used in the input resource pool, loop through the matching resource pool set_V2, and verify whether the latest remaining available resource quantity is greater than or equal to the minimum number of resources used. If so, continue the process; otherwise, throw an exception and return to the front-end page to indicate that resource allocation has failed, and prompt the user that the minimum number of resources used in a specific resource pool has exceeded the input. The user can make adjustments based on the previous input information, such as adjusting the minimum number of resources used to a smaller value, or changing it to 0, so that the resource allocation request can be quickly submitted again.
[0189] (11) Based on the resource pool priority template template selected by the user, the resource pool set set_V2 is sorted and compared pairwise. Through a two-layer comparison algorithm, the first layer is between attribute fields, and the second layer is within the attribute fields, so as to determine the resource pool priority sorting result that the user is most satisfied with. The sorting relationship between attribute fields is represented by a string sequence: attribute field b, attribute field c, attribute field a, and attribute field d. By traversing this sequence, they are compared in turn until the priority is confirmed. The sorting relationship within the attribute field is based on the specific attribute field confirmed above, such as d. The priority comparison method is queried from the key-value pair set of MAP <attribute field, priority comparison method>, and then the specific resource pool parameter values are compared. The sorted resource pool set is set_V3.
[0190] (12) First, deduct and process the resource allocation request requests with the input [minimum resource usage quantity]. Traverse the resource allocation request requests. If the [minimum resource usage quantity] is not entered, skip it; if the [minimum resource usage quantity] is entered, allocate the [minimum resource usage quantity]. Traverse the sorted fund pool set set_V3 to determine whether there are any remaining available resources. If not, skip it; if there are remaining available resources, perform a matching check on the resource pool to confirm that the current resource pool can process the current resource allocation request request. For example, if requestMonth=202409, determine whether the corresponding attribute of the resource pool can participate in the processing. If not, skip it; if yes, allocate the resources on demand or available. On demand means that the minimum resource usage quantity of a resource allocation request request may be processed by multiple resource pools. At this time, it is the latest remaining [minimum resource usage quantity]. According to available means that a resource pool may participate in processing multiple resource allocation requests. At this time, it is the latest remaining available resource quantity. Until the resource allocation request is processed, or the processing cannot be completed after traversing all resource pool sets set_V3, an exception is thrown and returned to the front-end page to indicate that the processing failed, and the user is prompted that the [Minimum Resource Quantity] of a specific resource pool has exceeded the limit.
[0191] (13) Next, process all remaining resource allocation requests. Each request has three situations: the first is that the [minimum resource usage quantity] is not entered; the second is that the [minimum resource usage quantity] is entered but is less than the total resource allocation request quantity; the third is that the [minimum resource usage quantity] is entered and is equal to the total resource allocation request quantity. Traverse all resource allocation request requests to determine whether they belong to the first two situations. If so, refer to the above process and make deductions based on demand. If all resource pool sets set_V3 are traversed and still cannot be processed, an exception is thrown and returned to the front-end page to indicate that the processing failed, and the user is prompted that the specific resource allocation request cannot be processed.
[0192] (14) Update the remaining available resource quantity in the database of resource pool set set_v3. Step (13) completes the resource pool allocation of all resource allocation requests. At this time, update the corresponding used resource quantity amount1. For example, for resource pool A, the remaining available resource quantity queried from the database is amount, which needs to be updated to amount-amount1.
[0193] (15) The resource allocation result is returned to the front-end user for display. The display content includes the resource pools participating in the resource allocation and the number of resources participating in the allocation in each resource pool.
[0194] The resource allocation method proposed in the embodiment of the present disclosure can realize the automation of system resource allocation, greatly reduce the labor cost of users in setting resource allocation plans, and improve the efficiency and success rate of resource allocation; by setting a minimum resource usage quantity mechanism, on the basis of supporting automatic resource allocation, it supports users to flexibly manually configure resource allocation rules, is compatible with the flexibility and automation of resource allocation, and makes the resource allocation results meet the user's allocation needs; in addition, the resource pool priority template design and the two-layer priority expression model design make it possible for the automatic allocation plan to be pre-set by the user, so that the resource allocation result meets the user's actual allocation needs, and improves the reliability of resource allocation.
[0195] As an implementation of the above resource allocation methods, the present disclosure also provides an optional embodiment of an execution device for implementing the above resource allocation methods.
[0196] Figure 4 is a structural diagram of a resource allocation device provided according to an embodiment of the present disclosure. Figure 4 As shown, the device includes: a request acquisition module 410, a resource pool matching module 420, a first display module 430, a response module 440 and a resource allocation module 450.
[0197] The request acquisition module 410 is used to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, and the request items include the type and required quantity of the resources to be allocated;
[0198] A resource pool matching module 420, configured to match the resource allocation request with resource pools of various types updated in real time, and obtain a matching resource pool set for satisfying at least one of the request items;
[0199] The first display module 430 is used to capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set;
[0200] The response module 440 is used to obtain a target priority template in response to the selection of the resource pool priority template set, and to obtain a target resource quantity set for at least one target resource pool in response to the setting of the matching resource pool set.
[0201] The resource allocation module 450 is used to start a database transaction to complete the resource allocation process matching the resource allocation request according to the selection and setting results.
[0202] The technical solution of the disclosed embodiment is achieved by obtaining a resource allocation request; matching the resource allocation request with various types of resource pools updated in real time, obtaining a matching resource pool set for satisfying at least one of the request items; capturing the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and displaying the captured result and the preset resource pool priority template set; in response to the selection of the resource pool priority template set, obtaining the target priority template, and in response to the setting of the matching resource pool set, obtaining the target resource quantity set for at least one target resource pool; according to the selection and setting results, starting a database transaction to complete the resource allocation process that matches the resource allocation request. By designing priorities to achieve automatic resource allocation, there is no need to reserve a large number of resources, reducing labor costs and resource occupancy, improving allocation success rate and efficiency, supporting users to set the target resource quantity, ensuring that the resource allocation results meet user needs, and improving the reliability of resource allocation.
[0203] On the basis of the above embodiments, the resource pool matching module 420 is specifically used for:
[0204] Parsing the request item in the resource allocation request;
[0205] Mapping the field value of the parsed request field to the required field value of the attribute field corresponding to the resource pool, wherein the attribute field includes the type attribute of the resource pool;
[0206] Organizing the required field values of each of the attribute fields to obtain a query condition set of or relationships;
[0207] Acquire an initial hit resource pool that hits at least one query condition in the query condition set from each of the resource pools;
[0208] In the initial hit resource pool, a target resource pool whose number of remaining resources is not zero is obtained to form the matching resource pool set.
[0209] On the basis of the above embodiments, the resource allocation module 450 is specifically used for:
[0210] After the database transaction is started, the database transaction is locked for each type of resource pool;
[0211] Matching the resource allocation request with the resource pools of various types locked by the database transaction to obtain a locked resource pool set for satisfying at least one of the request items;
[0212] Sorting the locked resource pool set according to the target priority template to obtain a priority resource pool set;
[0213] Acquire the target resource quantity in each target resource pool, and perform resource allocation for the resource allocation request;
[0214] According to the remaining amount of resources in each resource pool in the priority resource pool set, secondary resource allocation is performed on the unsatisfied request items in the resource allocation request.
[0215] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0216] When it is verified that the locked resource pool set meets the resource pre-allocation condition according to the matching resource pool set and the quantity of each target resource, the locked resource pool set is sorted according to the target priority template to obtain the priority resource pool set.
[0217] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0218] Determine whether the locked resource pool set includes all the target resource pools in the matching resource pool set;
[0219] If so, when it is detected that the remaining resource quantity of each target resource pool after the database transaction is locked is greater than or equal to the set target resource quantity, it is determined that the locked resource pool set meets the resource pre-allocation condition.
[0220] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0221] Acquire a first resource pool and a second resource pool to be sorted in the locked resource pool set;
[0222] Obtain target attribute fields in sequence according to the attribute field sorting order in the target priority template;
[0223] Acquire a first field value of the first resource pool under the target attribute field, and a second field value of the second resource pool under the target attribute field;
[0224] If the first field value is the same as the second field value, returning to execute the operation of sequentially acquiring the target attribute fields according to the sorting order of the attribute fields in the target priority template;
[0225] If the first field value and the second field value are not the same, the first resource pool and the second resource pool are sorted according to the sorting order of the field values under the target attribute field in the target priority template.
[0226] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0227] In each of the target resource pools, a current target resource pool is obtained in turn, and a current type and a current target resource quantity corresponding to the current target resource pool are obtained;
[0228] Traversing each target request item whose type of resource to be allocated in the resource allocation request matches the current type, and allocating resources of the current target resource quantity in the current target resource pool;
[0229] Annotate the resource allocation status of the target request item allocated to the resource; wherein the resource allocation satisfaction status includes satisfied or partially satisfied;
[0230] Return to execute in each of the target resource pools, and sequentially obtain the operation of the current target resource pool until a resource allocation to all the target resource pools is completed.
[0231] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0232] Sequentially acquiring current request items from among the request items not marked as satisfied in the resource allocation request;
[0233] Sequentially acquiring a current priority resource pool from the priority resource pool set, and detecting whether the type of the current priority resource pool and the remaining resource quantity satisfy the resource allocation status of the current request item;
[0234] If it is fully satisfied, after allocating resources to the current request item, marking the fully satisfied state of the current request item, and returning to execute the operation of sequentially obtaining the current request items from each of the request items not marked as satisfied in the resource allocation request;
[0235] If it can be partially satisfied, after allocating resources to the current request item, the resource allocation satisfaction state of the current request item is updated, and the operation of sequentially acquiring the current priority resource pool in the priority resource pool set is returned;
[0236] If it cannot be satisfied, the operation of directly returning to the priority resource pool set to sequentially obtain the current priority resource pool is performed.
[0237] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0238] Detecting whether a first sum of the target resource quantities set for each of the target resource pools is greater than a second sum of the required quantities of resources required to be allocated to each of the request items;
[0239] If not, a database transaction is started to complete the resource allocation process that matches the resource allocation request;
[0240] If so, a prompt is given to reset the target resource quantity according to the difference between the first total and the second total.
[0241] On the basis of the above embodiments, the resource allocation module 450 is further configured to:
[0242] After determining whether the locked resource pool set includes all the target resource pools in the matching resource pool set, if not, resetting the target resource quantity is prompted according to the difference between the locked resource pool set and the matching resource pool set.
[0243] Further, based on the above embodiments, the device further includes:
[0244] A first ending module, configured to end the resource allocation process if it is determined that resource allocation of the target resource quantity in any target resource pool cannot be completed during the process of obtaining the target resource quantity in each target resource pool and performing a resource allocation on the resource allocation request;
[0245] The first prompt module is used to prompt the target resource quantity of each target resource pool that fails in resource allocation to be reset.
[0246] Based on the above embodiments, the device further includes:
[0247] A second ending module is used for performing secondary resource allocation for unsatisfied request items in the resource allocation request according to the remaining resource quantity of each resource pool in the priority resource pool set, and if it is determined that the resource allocation demand for any request item cannot be met, then terminating the resource allocation process;
[0248] The second prompt module is used to reselect or reset the target priority template.
[0249] Based on the above embodiments, the device further includes:
[0250] A score calculation module, used to calculate a target allocation success rate score matching the target priority template according to the universality score and sorting order of each resource pool in the target priority template;
[0251] A third prompting module is used to prompt each resource pool priority template whose centralized allocation success rate score of the resource pool priority template is greater than the target allocation success rate score;
[0252] or
[0253] The fourth prompt module is used to obtain at least one reset strategy that can improve the target allocation success rate score of the target priority template according to the universality score and sorting order of each resource pool in the target priority template, and to prompt the at least one reset strategy.
[0254] Based on the above embodiments, the device further includes:
[0255] A quantity updating module, used for updating the quantity of remaining resources in each resource pool providing resources after successfully completing resource allocation;
[0256] The result display module is used to end the database transaction and display the resource allocation result after the update is completed.
[0257] The above-mentioned product can execute the method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0258] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0259] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0260] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0261] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0262] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0263] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the resource allocation method. For example, in some embodiments, the resource allocation method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the resource allocation method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the resource allocation method in any other appropriate manner (e.g., by means of firmware).
[0264] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0265] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0266] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0267] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0268] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0269] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services. The server may also be a server of a distributed system, or a server combined with a blockchain.
[0270] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, machine learning / deep learning technology, big data processing technology, knowledge graph technology, and other major directions.
[0271] Cloud computing refers to a technology system that uses network access to elastically scalable shared physical or virtual resource pools. Resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for technical applications such as artificial intelligence and blockchain, as well as model training.
[0272] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and this document does not limit this.
[0273] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A resource allocation method, comprising: Obtaining a resource allocation request, wherein the resource allocation request includes a plurality of request items, and the request items include the type and required quantity of resources to be allocated; Matching the resource allocation request with resource pools of various types updated in real time to obtain a matching resource pool set for satisfying at least one of the request items; Capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and display the capture result and the preset resource pool priority template set; In response to the selection of the resource pool priority template set, a target priority template is obtained, and in response to the setting of the matching resource pool set, a target resource quantity set for at least one target resource pool is obtained; According to the selection and setting results, a database transaction is started to complete the resource allocation process matching the resource allocation request.
2. The method according to claim 1, wherein: The step of matching the resource allocation request with resource pools of various types updated in real time to obtain a matching resource pool set for satisfying at least one of the request items includes: Parsing the request item in the resource allocation request; Mapping the field value of the parsed request field to the required field value of the attribute field corresponding to the resource pool, wherein the attribute field includes the type attribute of the resource pool; Organizing the required field values of each of the attribute fields to obtain a query condition set of or relationships; Acquire an initial hit resource pool that hits at least one query condition in the query condition set from each of the resource pools; In the initial hit resource pool, a target resource pool whose number of remaining resources is not zero is obtained to form the matching resource pool set.
3. The method according to claim 1, wherein: The step of starting a database transaction to complete a resource allocation process matching the resource allocation request according to the selection and setting result includes: After the database transaction is started, the database transaction is locked for each type of resource pool; Matching the resource allocation request with the resource pools of various types locked by the database transaction to obtain a locked resource pool set for satisfying at least one of the request items; Sorting the locked resource pool set according to the target priority template to obtain a priority resource pool set; Acquire the target resource quantity in each target resource pool, and perform resource allocation for the resource allocation request; According to the remaining amount of resources in each resource pool in the priority resource pool set, secondary resource allocation is performed on the unsatisfied request items in the resource allocation request.
4. The method according to claim 3, wherein: The step of sorting the locked resource pool set according to the target priority template to obtain a priority resource pool set includes: When it is verified that the locked resource pool set meets the resource pre-allocation condition according to the matching resource pool set and the quantity of each target resource, the locked resource pool set is sorted according to the target priority template to obtain the priority resource pool set.
5. The method according to claim 4, wherein: The verifying, according to the matching resource pool set and the quantity of each target resource, that the locked resource pool set meets the resource pre-allocation condition includes: Determine whether the locked resource pool set includes all the target resource pools in the matching resource pool set; If so, when it is detected that the remaining resource quantity of each target resource pool after the database transaction is locked is greater than or equal to the set target resource quantity, it is determined that the locked resource pool set meets the resource pre-allocation condition.
6. The method according to claim 4, wherein: The step of sorting the locked resource pool set according to the target priority template to obtain the priority resource pool set includes: Acquire a first resource pool and a second resource pool to be sorted in the locked resource pool set; Obtain target attribute fields in sequence according to the attribute field sorting order in the target priority template; Acquire a first field value of the first resource pool under the target attribute field, and a second field value of the second resource pool under the target attribute field; If the first field value is the same as the second field value, returning to execute the operation of sequentially acquiring the target attribute fields according to the sorting order of the attribute fields in the target priority template; If the first field value and the second field value are not the same, the first resource pool and the second resource pool are sorted according to the sorting order of the field values under the target attribute field in the target priority template.
7. The method according to claim 3, wherein: The acquiring the target resource quantity in each target resource pool and performing a resource allocation on the resource allocation request comprises: In each of the target resource pools, a current target resource pool is obtained in turn, and a current type and a current target resource quantity corresponding to the current target resource pool are obtained; Traversing each target request item whose type of resource to be allocated in the resource allocation request matches the current type, and allocating resources of the current target resource quantity in the current target resource pool; Annotate the resource allocation status of the target request item allocated to the resource; wherein the resource allocation satisfaction status includes satisfied or partially satisfied; Return to execute in each of the target resource pools, and sequentially obtain the operation of the current target resource pool until a resource allocation to all the target resource pools is completed.
8. The method according to claim 7, wherein: According to the remaining amount of resources in each resource pool in the priority resource pool set, secondary resource allocation is performed on the unsatisfied request items in the resource allocation request, including: Sequentially acquiring current request items from among the request items not marked as satisfied in the resource allocation request; Sequentially acquiring a current priority resource pool from the priority resource pool set, and detecting whether the type of the current priority resource pool and the remaining resource quantity satisfy the resource allocation status of the current request item; If it is fully satisfied, after allocating resources to the current request item, marking the fully satisfied state of the current request item, and returning to execute the operation of sequentially obtaining the current request items from each of the request items not marked as satisfied in the resource allocation request; If it can be partially satisfied, after allocating resources to the current request item, the resource allocation satisfaction state of the current request item is updated, and the operation of sequentially acquiring the current priority resource pool in the priority resource pool set is returned; If it cannot be satisfied, the operation of directly returning to the priority resource pool set to sequentially obtain the current priority resource pool is performed.
9. The method according to any one of claims 1 to 8, wherein: The process of starting a database transaction to complete the resource allocation process matching the resource allocation request according to the selection and setting result specifically includes: Detecting whether a first sum of the target resource quantities set for each of the target resource pools is greater than a second sum of the required quantities of resources required to be allocated to each of the request items; If not, a database transaction is started to complete the resource allocation process that matches the resource allocation request; If so, a prompt is given to reset the target resource quantity according to the difference between the first total and the second total.
10. The method according to claim 5, after determining whether the locked resource pool set includes all the target resource pools in the matching resource pool set, further comprising: If not, a prompt is given to reset the target resource quantity according to the difference between the locked resource pool set and the matching resource pool set.
11. The method according to claim 3, further comprising: In the process of obtaining the target resource quantity in each target resource pool and performing a resource allocation for the resource allocation request, if it is determined that the resource allocation for the target resource quantity in any target resource pool cannot be completed, then the resource allocation process is terminated; A prompt is given to reset the target resource quantity for each target resource pool where resource allocation fails.
12. The method according to claim 3, further comprising: In the process of performing secondary resource allocation for the unsatisfied request items in the resource allocation request according to the remaining resource quantity of each resource pool in the priority resource pool set, if it is determined that the resource allocation demand for any request item cannot be met, then the resource allocation process is terminated; A prompt is provided for reselecting or resetting the target priority template.
13. The method according to claim 12, after reselecting or resetting the target priority template, further comprises: Calculate the target allocation success rate score that matches the target priority template according to the universality score and sorting order of each resource pool in the target priority template; Prompt each resource pool priority template whose centralized allocation success rate score of the resource pool priority template is greater than the target allocation success rate score; or According to the universality scores and sorting order of each resource pool in the target priority template, at least one reset strategy that can improve the target allocation success rate score of the target priority template is obtained, and the at least one reset strategy is prompted.
14. The method according to any one of claims 1 to 8, further comprising: After successfully completing the resource allocation, updating the remaining amount of resources in each of the resource pools providing the resources; After the update is completed, the database transaction is terminated and the resource allocation result is displayed.
15. A resource allocation device, comprising: A request acquisition module, used to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, and the request items include the type and required quantity of the resources to be allocated; A resource pool matching module, used to match the resource allocation request with resource pools of various types updated in real time, and obtain a matching resource pool set for satisfying at least one of the request items; The first display module is used to capture the remaining resource quantity of each matching resource pool in the matching resource pool set at the current moment, and to display the capture result and the preset resource pool priority template set; A response module, configured to obtain a target priority template in response to the selection of the resource pool priority template set, and obtain a target resource quantity set for at least one target resource pool in response to the setting of the matching resource pool set; The resource allocation module is used to start a database transaction to complete the resource allocation process matching the resource allocation request according to the selection and setting results.
16. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 14.
17. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-14.
18. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.
Citation Information
Patent Citations
Resource allocation method and device, electronic equipment and storage medium
CN112395086A
Resource priority real-time optimization adjustment method based on machine learning
CN116560860A
Dynamic resource allocation method, electronic equipment and storage medium
CN118426945A
Quota-based resource management
US20140068624A1
Deadlock avoidance techniques
US9781057B1
Cited By
Chip resource management method, chip resource management device and chip
CN121597397A
Method and device for realizing distributed storage service I / O process full-stack QoS
CN122437890A