Resource allocation method and apparatus, electronic device, storage medium, and program product
By matching real-time resource pools and displaying priority templates in the cloud platform, users select the target resource quantity for resource allocation, solving the problem of frequent resource changes in the resource pool and achieving efficient and reliable resource allocation.
Patent Information
- Application Number
- CN202411814498.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In cloud platforms, users' resource allocation needs frequently change, which leads to frequent changes in the remaining resources in the resource pool, resulting in a low resource allocation success rate and long time consumption, or the need to reserve a large amount of resources to meet demand, affecting resource utilization.
By obtaining resource allocation requests, matching the real-time updated resource pool, displaying the remaining quantity and priority template of the resource pool, the user selects the priority template and sets the target resource quantity, and starts a database transaction to complete resource allocation.
It realizes the automation of resource allocation, reduces labor costs and resource utilization, improves allocation success rate and efficiency, and ensures that resource allocation results meet user needs.
Smart Images

Figure CN119759555B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to cloud computing technology, and more particularly 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] Currently, related technologies primarily use cloud platforms to address resource allocation. Specifically, cloud platforms can set up multiple resource pools for each user to meet their varying resource allocation needs. Users can apply for resources on the cloud platform, which then allocates them. Alternatively, users can pre-set resource allocation triggers, which automatically allocate resources whenever they are met.
[0003] In some complex resource allocation scenarios, both of the above resource allocation methods can be supported simultaneously. When users frequently request resource allocation, the remaining resources in each resource pool may fluctuate frequently. In extreme cases, a user may query one or more resource pools for available resources at one point in time, but when the user submits a resource request for these resources the next moment, these resources have already been consumed by automatic allocation, requiring the user to submit a new resource request.
[0004] When faced with these extreme situations, either sufficient resources must be reserved in each resource pool to cope with resource consumption at any time, or users must repeatedly adjust their resource allocation requests to proactively adapt to these dynamic resource changes. The first approach results in high resource utilization, significantly reducing the use of these resources in other scenarios. The second approach requires users to submit resource allocation requests frequently, which 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, each of which includes a type and a 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 selecting the resource pool priority template set, obtaining a target priority template, and in response to setting the matching resource pool set, obtaining a target resource quantity set for at least one target resource pool;
[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, a resource allocation device is provided, comprising:
[0013] A request acquisition module, configured to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, each of which includes a type and a required quantity of resources to be allocated;
[0014] A resource pool matching module, 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;
[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 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 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 to enable the at least one processor to 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 contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings are provided to facilitate a better understanding of the present invention 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 description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize 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 1This is a schematic diagram of a resource allocation method provided according to an embodiment of the present disclosure. This embodiment of the present disclosure is applicable to situations where, in response to a resource allocation request, a resource pool is selected to meet a minimum allocation quantity and resources are allocated based on priority. This method can be performed by a resource allocation device, which can be implemented in hardware and / or software and is typically configured in an electronic device, such as a server on 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] Specifically, a resource allocation request can be understood as a request from a user or application to the cloud platform for the allocation of platform resources, such as computing resources, storage resources, network resources, financial resources in cloud payment scenarios, or various virtual item resources. In a specific example, a user can select all required cloud platform resources, initiate a request, generate a request set, and send the request set to the backend system via the HTTP (Hypertext Transfer Protocol) request interface for receipt by the cloud platform.
[0037] A resource allocation request consists of multiple request items, representing specific resource requirements from multiple users or applications. Each request item specifies the type and quantity of resource requirements and can also include constraints, such as the resource's storage location and performance requirements.
[0038] S120: Match 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.
[0039] A matching resource pool set can be understood as a collection of resource pools available for allocation within the cloud platform. A matching resource pool set contains one or more matching resource pools. These matching resource pools contain resources that meet the resource type and quantity requirements of a resource allocation request. These resource pools can be categorized as computing resource pools, storage resource pools, network resource pools, or, in cloud payment scenarios, funding resource pools to meet different payment requirements.
[0040] In a cloud platform, a resource pool can simultaneously serve multiple users or applications, each of which may issue multiple resource allocation requests based on its needs. Because these requests are concurrent, resource usage changes dynamically with each request. Therefore, the resource pool is updated in real time to reflect current resource usage and the remaining available resources. When a new resource allocation request arrives, the system can quickly and accurately match the requested resource pool to the requested resource type based on the latest resource pool status. Real-time updates from the resource pool also enable effective resource management and optimization of the cloud platform, improving resource utilization and ensuring 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 pools storing resources of the corresponding type are 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 pools are filtered. For example, the filtering can be performed by checking the node labels of each resource pool. These labels identify the number of resources contained in the resource pool, or identify the resource models available on the resource node. For example, when the user issues a resource allocation request for the allocation of XX model GPU (Graphics Processing Unit, graphics processor) resources of XX company, the stored GPU model can be identified on the resource node of the resource pool to ensure the accuracy of the filtering. Finally, the matching resource pool for satisfying the request item is obtained by filtering.
[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, thereby 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 user-defined resource pool priority rule template. Each resource pool priority rule template contains a 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, ensuring that the resource allocation results meet user needs and improving the reliability of resource allocation.
[0044] The specific crawling method may be to take a network snapshot of the remaining resource quantity of each matching resource pool at the current moment to obtain a crawling result.
[0045] Resource pool priorities can be specifically prioritized based on 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 make secondary allocations for the unfinished resource allocation requests. 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 determined based on the performance indicators of the resource pool (such as resource utilization, average response time, or average waiting time, etc.) or resource scheduling policies (such as the shortest job first policy, the shortest remaining time first policy, or the time slice round-robin policy, etc.).
[0046] In a specific example, the cloud platform can query and maintain a fully customized set of resource pool priority templates based on the account ID, return the current number of remaining resources in the matching resource pool and the set of resource pool priority templates to the front-end page for display. Resource pool priority templates include not only user-maintained templates but also system default templates. The user selects the resource pool priority template to be used for 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: a 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 based on their own resource allocation needs. For resource pools with set target resource quantities, internal priority sorting can be performed based on 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 priority.
[0050] When a user sets a target resource quantity, resource pools with a set target resource quantity have higher priority than resource pools without a set target resource quantity. This means that when processing resource allocation requests, the target resource quantity restrictions for each corresponding resource pool are prioritized according to the internal priority level before other resource pools are considered for resource allocation. If a user does not set a target resource quantity, the minimum resource quantity for each resource pool is either unlimited or zero. Resource pools are prioritized according to the target priority template and resource allocation requests are processed accordingly.
[0051] In a specific example, based on the specific remaining resource quantities of each matching resource pool in the matching resource pool set and in combination with resource allocation requirements, the user selectively enters a minimum resource quantity for each matching resource pool, also known as the target resource quantity. This optional input is optional; you can enter target resource quantities for some matching resource pools or none at all. If you do not enter any, the system will automatically allocate resources. The minimum requirement means that to process this batch of resource allocation requests, a matching resource pool must participate in allocating at least the corresponding number of resources. Obviously, due to the continuous processing of concurrent resource allocation requests in the backend, the remaining available resources may be insufficient by the time the current request is actually processed, and may be less than the entered target resource quantity. In this case, the system throws an exception and returns to the front-end page indicating that the request failed. The minimum requirement means that even if the request fails, the resource allocation quantity for this pool cannot fall below 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 pools. For example, if the resource allocation request contains 30,000 resources, the user can split these 30,000 resources into different matching resource pools and enter the target resource quantity fields. This allows for complete control over the allocation of certain matching resource pools, providing great flexibility. The user sends the resource allocation request set, the selected target priority template for this resource allocation, the matching resource pool set, and the corresponding target resource quantity to the system backend to initiate a database transaction to complete the resource allocation process that matches the resource allocation request.
[0052] The technical solution of the embodiment of the present disclosure is achieved by obtaining a resource allocation request; matching the resource allocation request with various types of resource pools updated in real time, and 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; based on 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: "Parsing the request items in the resource allocation request; mapping 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; organizing the requirement field value of each attribute field to obtain a query condition set of or relationship; obtaining an initial hit resource pool in each resource pool that hits at least one query condition in the query condition set; in the initial hit resource pool, obtaining a target resource pool with a non-zero number of remaining resources 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 parsed field value of the 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 resource pool type attribute, the number of available resources, or the resource pool default priority. The requirement field value of the attribute field can be specifically understood as the field format that needs to be converted when constructing the 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 deduplicates the 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 an 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 to serve as the query condition set.
[0066] S250: Acquire an initial hit resource pool that matches at least one query condition in the query condition set from each resource pool.
[0067] S260: Obtain target resource pools whose remaining resources are not zero from the initial hit resource pool to form the matching resource pool set.
[0068] The query criteria are filtered across all resource pools to obtain a resource pool that meets at least one of the criteria. This pool is then considered the initial matching resource pool. If the number of remaining available resources in the initial matching resource pool is non-zero, it indicates that it can participate in processing at least one resource allocation request in the resource allocation request set. This initial matching resource pool is then used as the target resource pool, and all the resulting target resource pools are combined into 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 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, start a database transaction to complete the resource allocation process matching the resource allocation request.
[0071] The technical solution of the embodiment of the present disclosure 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 requirement field value of the attribute field corresponding to the resource pool. The requirement field value of each attribute field is organized to obtain a query condition set of or relationships, and an initial hit resource pool that hits at least one query condition in the query condition set is obtained in each resource pool; 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 requirement 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 opened, 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 on 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] Specifically, a locked resource pool set can be understood as the set of resource pools that satisfy at least one resource allocation request after a database transaction is locked. Based on this, the resource pools in the locked resource pools are prioritized according to the target priority template, resulting in 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 performing any queries and calculations related to resource allocation in the background, it is necessary to open a 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 requirements.
[0080] Then, based on the remaining resources in each resource pool in the priority resource pool set, resources from the resource pools are obtained according to their priority level to perform secondary resource allocation for the unmet request items in the resource allocation request. If no resource pool in the priority resource pool set has a target resource level set, resources from the resource pools are obtained according to their priority level to perform secondary 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, due to the concurrent processing of resource allocation requests in the background, the resource pools contained in the locked resource pool set obtained when the resource allocation database transaction is locked can be different from the resource pools in the matching resource pool set obtained before the database transaction is locked. If the user sets a limit constraint condition, such as a target resource quantity, on the resource pools in the matching resource pool set before the database transaction is locked, and the locked resource pool set does not contain the resource pool, the resource allocation request processing will certainly fail due to the failure to meet the target resource quantity requirement set by the user. In addition, concurrent processing of resource allocation requests can also cause the available resource quantity of the resource pool with a target resource quantity in the locked resource pool set to be insufficient to meet the target resource quantity requirement. Therefore, before the locked resource pool set is sorted by the target priority template, it can be determined whether to perform subsequent resource allocation processing by comparing whether the total number of resource pools with a target resource quantity in the locked resource pool set and the matching resource pool set is the same. If they are the same, subsequent resource allocation processes are continued. If they are different, an exception is thrown. By detecting whether the locked resource pool set meets the resource pre-allocation condition, early identification of resource allocation exceptions is achieved, and resource allocation efficiency is improved.
[0086] In another optional implementation of the embodiment, verifying that the locked resource pool set meets the resource pre-allocation condition according to the matching resource pool set and each target resource quantity can include:
[0087] determining whether the locked resource pool set contains all the target resource pools in the matching resource pool set;
[0088] If yes, 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 in the matching resource pool set with a target resource quantity. 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 condition is met, and the subsequent resource allocation process can be performed.
[0090] By detecting whether the locked resource pool set contains the target resource pool and verifying whether the remaining resource quantity of the target resource pool meets the set target resource quantity requirement, early identification of resource allocation exceptions is achieved, and resource allocation efficiency is improved.
[0091] In another optional implementation of the embodiment, sorting the locked resource pool set according to the target priority template to obtain the priority resource pool set can 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 and the second field value are the same, 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 different, 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, based on the target priority template selected by the user, the locked resource pool set is sorted, that is, each resource pool in the locked resource pool set is compared with each other, and the priority is determined through a two-layer comparison algorithm. The first layer is the comparison between attribute fields, and the second layer is the comparison within attribute fields, so as to determine the priority sorting result of the resource pool 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, comparison is performed in turn 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. 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, comparison is performed. If the first field value and the second field value are the same, the specific resource pool parameter values within the same attribute field are compared through the key-value pair set of MAP<same attribute field, priority comparison method>, the first resource pool and the second resource pool are sorted, and the sorting result is returned. If the first field value and the second field value are different, 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 the two-layer priority comparison mode 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 the allocation and utilization of resources can be optimized. This method ensures the stability and reliability of resource allocation services, and at the same time, in the case of resource shortage, it can dynamically adjust resource allocation to adapt to changing business needs. In addition, it helps to avoid resource waste and optimize cost-effectiveness by adjusting the priority of allocation under the premise of 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 the embodiment, obtaining the resources of the target resource quantity in each target resource pool, and performing resource allocation on the resource allocation request can include:
[0100] In each target resource pool, the current target resource pool is obtained in turn, and the current type and the current target resource quantity corresponding to the current target resource pool are obtained;
[0101] Traverse each target request item in the resource allocation request that matches the type of the required allocated resource and the current type, and allocate resources of the current target resource quantity in the current target resource pool;
[0102] Mark the resource allocation state of the target request item allocated to the resource; wherein the resource allocation satisfaction state includes satisfaction or partial satisfaction;
[0103] Return to execute the operation of obtaining the current target resource pool in each target resource pool in sequence until the resource allocation for all the target resource pools is completed.
[0104] A resource allocation can be specifically understood as: the resource allocation first performed to meet the target resource quantity requirements of each target resource pool.
[0105] Generally speaking, since the target resource quantity allocation requirement of a target resource pool can satisfy one or more target request items, the resource requirements of a target request item can similarly be met by one or more target resource pools. Therefore, after satisfying the target resource quantity allocation requirements of each target resource pool, it is necessary to mark the resource allocation status of the target request item allocated to the resource. Resource allocation status is categorized as satisfied or partially satisfied. Partially satisfied resources require a second allocation to satisfy the allocation request. This phased allocation ensures that the target resource quantity conditions set by the user are met, ensuring that the resource allocation results meet user requirements and improving 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] Obtaining the current request item in sequence from each of 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 quantity of the remaining resources satisfy the resource allocation status of the current request item;
[0109] If fully satisfied, after allocating resources for 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, updating the resource allocation satisfaction status of the current request item, and returning to execute the operation of sequentially obtaining the current priority resource pool in the priority resource pool set;
[0111] If the condition cannot be met, the operation of obtaining the current priority resource pool in sequence in the priority resource pool set is directly returned to.
[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 check whether they meet the 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 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 remaining number of resources is greater than 0, that is, it is partially satisfied, then after 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 amount 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 manners 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 following method may be further included:
[0115] If not, the target resource quantity is reset 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 if the locked resource pool set contains all the target resource pools in the matching resource pool set, but the number of remaining resources in at least one target resource pool is less than the target resource number, 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 throwing an exception and returning 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 quickly submitted again. By detecting whether the locked resource pool set contains the target resource pool and verifying whether the number of remaining 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 3is a schematic diagram of yet another resource allocation method according to an embodiment of the present disclosure. The embodiment specifies the operation of “starting a database transaction to complete a resource allocation process matched with the resource allocation request” in the above-mentioned embodiment as “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 resource quantities required by each of the request items; if not, starting a database transaction to complete a resource allocation process matched with the resource allocation request; if yes, resetting the target resource quantities according to the difference between the first sum and the second sum”.
[0118] Correspondingly, as shown in Figure 3 the method can specifically include:
[0119] S310, obtaining a resource allocation request.
[0120] The resource allocation request contains multiple request items, and each request item contains the type and quantity of the required allocated resource.
[0121] S320, matching the resource allocation request with each type of resource pool updated in real time to obtain a set of matching resource pools for meeting at least one of the request items.
[0122] S330, capturing the remaining resource quantity of each matching resource pool in the set of matching resource pools at the current time and displaying the captured result and a preset resource pool priority template set.
[0123] S340, in response to a target priority template selected from the resource pool priority template set and a target resource quantity set for at least one target resource pool in the set of matching resource pools.
[0124] S350, 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 resource quantities required by each of the request items. 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. This certainly cannot 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. S360 is executed to perform resource allocation.
[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 to obtain 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 quantities set for each target resource pool is greater than the second sum of the required resource quantities required for allocation of each request item; if not, initiates a database transaction to complete the resource allocation process matching the resource allocation request; if so, resets the target resource quantity based on the difference between the first sum and the second sum. By pre-comparing the target resource quantity with the sum of the required quantity of each request item, 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 preventive inspection mechanism improves the system's proactive response capability and resource allocation efficiency.
[0130] Further, on the basis of the implementation of the above embodiments, the resource allocation method can further include:
[0131] In the process of performing resource allocation on 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, the resource allocation process is ended;
[0132] The target resource quantity of each target resource pool for which the resource allocation fails is reset.
[0133] Generally, when it is determined that the resource allocation for the target resource quantity in any target resource pool cannot be completed, i.e., the minimum allocation requirement cannot be met, the resource allocation process is ended, and the target resource quantity of each target resource pool for which the allocation fails is reset.
[0134] In a specific example, first, the deduction and processing of the target resource quantity of each request item in the resource allocation request are performed. If there is no target resource quantity input, it is skipped; if there is a target resource quantity input, the target resource quantity is allocated. Specifically, the sorted target resource pool is traversed, and it is determined whether there is an unsatisfied target resource quantity. If not, it is skipped; if so, the resource pool is matched and verified to confirm that the current resource pool can process the current resource allocation request, for example, it is determined whether the corresponding attribute of the resource pool can participate in the allocation, and if not, it is skipped; if so, the resource is allocated on demand and as needed, on demand means that the resource quantity of a resource allocation request can be allocated by multiple resource pools, at this time the resource pool is the latest remaining target resource quantity, and as needed means that a resource pool can process multiple resource allocation requests, at this time the latest target resource quantity is also generated. Until the resource allocation request is completed and there is a target resource quantity of the target resource pool that is not satisfied, an exception is thrown, and the front-end page is returned to indicate that the request processing fails, and the user is prompted that the target resource quantity of a specific resource pool is inputted in excess. When the set target resource quantity requirement cannot be met, an exception is thrown and the user is explicitly prompted which target resource quantity parameter is set in excess, which not only provides clear error feedback to the user, helps them quickly locate and correct the problem, but also improves the success rate of subsequent resource allocation, enhances the user experience, promotes the rational allocation of resources and the use efficiency, and at the same time protects the stability and reliability of resource allocation.
[0135] Further, on the basis of the implementation of the above embodiments, the resource allocation method can further include:
[0136] In the process of performing secondary resource allocation on the 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, if it is determined that the resource allocation requirement for any request item cannot be met, then terminating the resource allocation process;
[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, when the target resource quantity requirements set by the user are met, the subsequent allocation process cannot be 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 and the target priority template is reselected or reset. For example, the user can reselect or set the priority template to give the general resource pool 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] Furthermore, based on the implementation manners of the above embodiments, after the prompt of reselecting or resetting the target priority template is performed, the following steps may be further included:
[0140] Calculate the target allocation success rate score that matches the target priority template based on the universality score and sorting order of each resource pool in the target priority template;
[0141] Prompting 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 score 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 about the specific resource allocation request that failed to be processed 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 types of resource allocation requests 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 types of resource allocation requests 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 failed 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 that a higher success rate score can be obtained. 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 resource secondary allocation, effectively avoids resource waste, and enhances user experience.
[0145] Furthermore, based on the implementations 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 the 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 number of remaining available resources in the database of each resource pool in the priority resource pool set is updated, and the corresponding resource usage quantity is updated. For example, for resource pool A, the number of remaining available resources queried from the database is 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 result is returned to the front-end user for display, which may specifically include the resource pools participating in the resource allocation and the number of resources allocated to each resource pool. 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. This 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 ability to monitor resources, optimizes resource utilization efficiency, 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 attributes of multiple resource allocation objects such as resource accounts, products, time, and resource types. With the refinement of operational management and the improvement of customer demand for resource control, the resource pool system model and business concepts have become complex. Although designing a dedicated resource pool for specific resources can improve the accuracy of resource management and control, it also complicates the result processing of resource allocation requests by the cloud platform.
[0151] When processing resource allocation requests, users can only query resource pool snapshot data at a specific moment and perform selection and matching operations. Faced with complex resource allocation requests and a large number of resource pools, manually determining allocation methods is time-consuming and increases labor costs. Furthermore, because other resource allocation operations are concurrently performed while users are operating, the actual remaining available resources in the resource pool are volatile, resulting in frequent resource allocation request failures and a reduced resource allocation success rate. While reserving a large amount of buffer resources can improve the success rate of resource allocation, it also increases resource utilization.
[0152] To solve the above problems, the present disclosure proposes a resource allocation method. The resource allocation method may 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] Cloud platform resources have many resource attributes. Table 1 shows the attribute fields of 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 corresponding 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 operations management and customers' demand for more sophisticated resource control, the system model and business domain concepts of resource pools are becoming increasingly complex. Providing dedicated designs for special resources can address the issue of resource control granularity. Table 2 shows the attribute fields of dedicated resource designs.
[0165] Table 2
[0166]
[0167] These resource pools have different properties. Depending on the constraints, they can process different requests and have different amounts of remaining available resources. All available resource pools can be represented as 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. Resource allocation specific process
[0174] In order to realize the automatic completion of resource allocation, the embodiment of the present disclosure designs a resource pool priority template management configuration module for maintaining the priority relationship of each different kind of resource pool. The system will have a global priority relationship default value, and each user can maintain multiple sets of custom resource pool priority templates. The global resource pool priority template default value will define the priority ordering relationship between each pair of different resource pools, and the ordering relationship is divided into two layers:
[0175] The first layer is the ordering relationship between attribute fields, such as resource pool A and resource pool B in comparing priority, first compare the
sourceType resource request source type
sourceType resource request source type
sourcePoolType resource pool type
sourceType resource request source type
[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: less remaining quantity > more remaining quantity. Obviously, the sorting relationship within the attribute field is an unstructured method, which can be managed using the key-value pair set 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 set of MAP<attribute field, priority comparison method>, and then the specific parameter values can be compared.
[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 ordering relationship within the attribute field. For proxy users, since they act on behalf of other users' resource allocation requests and receive reward resources from the cloud platform, they accumulate a large number of reward resources 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 request information to the backend system through the http request interface.
[0180] (2) The background system receives a set of resource allocation requests requests, aggregates and removes duplicates of the request information, queries the set of resource pool sets set_V1 that have available resources, i.e., amount>0, and can participate in any one resource allocation request. The method of aggregation and deduplication is to traverse the set of resource allocation requests requests, parse the parameters related to the resource pool, and convert them into corresponding resource pool attribute fields. For example, requestMonth=202409 in the resource allocation request can be converted to: sourcePoolType=ordinary request month request resource and sourceReferId=yearMonth202409 and a series of conditions available for database queries. Finally, these conditions are combined through an or relationship or. The result of the query at least hits at least one of the conditions, representing that at least one resource allocation request in the set of resource allocation requests requests can be processed.
[0181] (3) The background system queries the well-maintained full set of custom resource pool priority templates templates according to the user ID accountId.
[0182] (4) The background system returns the set of resource pool sets set_V1 and the set of resource pool priority templates templates to the front-end page and displays them. In addition to the user-defined and maintained templates, the resource pool priority templates can also select the default templates of the system.
[0183] (5) The user checks and confirms the resource pool priority template used for this request.
[0184] (6) User based on the resource pool set of resource quantity specific information, combined with the actual resource allocation requirements, selectively to the resource pool set input
minimum use resource quantity
minimum use resource quantity
minimum use resource quantity
minimum use resource quantity
minimum use resource quantity
[0185] (7) User sends resource request set requests, selects the resource pool priority template template used in this order, resource pool set set_V1 and the corresponding
minimum use resource quantity
[0186] (8) Since resource deduction is a strong database database transaction operation, before any query and calculation in the background, start database database transaction, and lock the user ID, to prevent concurrent deduction caused by resource pool quantity deduction error.
[0187] (9) The background system receives the resource allocation request set requests, aggregates the request information and removes the duplicate, queries the current available resource quantity, that is, amount>0, and can participate in any resource allocation request of resource pool set_V2. Obviously, due to the concurrent processing of background resource allocation request, the set_V2 and set_V1 set may be different, such as the number of optional resource pool set decreases or the remaining available resource quantity decreases, at this time, based on set_V2 and set_V1, whether the resource allocation can be checked.
[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 resources are 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 the resource allocation failed, and prompt the user that the minimum number of resources used in a specific resource pool has exceeded the minimum number. 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 submitted again quickly.
[0189] (11) Based on the resource pool priority template selected by the user, the resource pool set set_V2 is sorted and compared pairwise. A two-layer comparison algorithm is used, the first layer is between attribute fields, and the second layer is within 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, comparisons are made in sequence 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_V3 to determine whether there are any remaining available resources. If not, skip it. If there are any 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. For example, if requestMonth=202409, determine whether the corresponding attribute of the resource pool can participate in the processing. If not, skip it. If it can, allocate the resources on demand or as needed. On demand means that the minimum resource usage quantity of a resource allocation request may be processed by multiple resource pools. At this time, the latest remaining [minimum resource usage quantity] is used. On-demand means that a resource pool may participate in processing multiple resource allocation requests. At this time, the latest remaining available resources are used. 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 Usage Quantity] of a specific resource pool has exceeded the limit.
[0191] (13) Secondly, the processing of the full amount of remaining resource allocation request is performed, and there are three cases for each request, the first case is that the minimum use resource quantity is not input, the second case is that the minimum use resource quantity is input but less than the total resource allocation request quantity, and the third case is that the minimum use resource quantity is input and equal to the total resource allocation request quantity. All resource allocation requests requests are traversed, and it is judged whether it belongs to the above two cases. If yes, the on-demand and corresponding deduction are performed according to the above process. If all resource pool sets set_V3 are traversed and still cannot be processed, an exception is thrown, and the front-end page is returned to indicate that the processing fails, and the user is prompted that the specific resource allocation request cannot be processed.
[0192] (14) The database remaining available resource quantity of the resource pool set set_v3 is updated, and the resource pool allocation of all resource allocation requests is completed in step (13). At this time, the corresponding use resource quantity amount1 is updated, for example, the resource pool A. The remaining available resource quantity amount queried from the database is 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 pool participating in the resource allocation and the resource quantity participating in the allocation of each resource pool.
[0194] The resource allocation method provided by the embodiment of the present disclosure can realize automatic allocation of system resources, greatly reduce the labor cost of user setting resource allocation scheme, and improve the efficiency and success rate of resource allocation. Through the minimum use resource quantity mechanism, on the basis of supporting automatic allocation of resources, the user can flexibly configure the resource allocation rule, which is compatible with the flexibility and automation of resource allocation, so that the resource allocation result meets the allocation demand of the user. In addition, the resource pool priority template design and the double-layer priority expression model design make the automatic allocation scheme also be able to be set by the user in advance, so that the resource allocation result meets the actual allocation demand of the user, and the reliability of resource allocation is improved.
[0195] As an implementation of the above resource allocation method, the present disclosure further provides an optional embodiment of an execution device for implementing the above resource allocation method.
[0196] Figure 4 is a structural diagram of a resource allocation device provided by the embodiment of the present disclosure. As shown in Figure 4 , 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 configured to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, each of which includes the type and required quantity of resources to be allocated;
[0198] The resource pool matching module 420 is 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 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.
[0201] The resource allocation module 450 is configured to start a database transaction to complete a resource allocation process matching the resource allocation request according to the selection and setting results.
[0202] The technical solution of the embodiment of the present disclosure is achieved by obtaining a resource allocation request; matching the resource allocation request with various types of resource pools updated in real time, and 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; based on 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] Based on the above embodiments, the resource pool matching module 420 is specifically configured to:
[0204] Parsing the request item in the resource allocation request;
[0205] Mapping the parsed request field value 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 the OR relationship;
[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 with a non-zero number of remaining resources is obtained to form the matching resource pool set.
[0209] Based on the above embodiments, the resource allocation module 450 is specifically configured to:
[0210] After the database transaction is opened, 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 on 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] Based on 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] Based on the above embodiments, the resource allocation module 450 is further configured to:
[0218] Determining 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] Based on 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 and the second field value are the same, 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 different, 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] Based on the above embodiments, the resource allocation module 450 is further configured to:
[0227] In each of the target resource pools, sequentially obtain a current target resource pool, and obtain a current type and a current target resource quantity corresponding to the current target resource pool;
[0228] Traversing each target request item in the resource allocation request whose type of resource to be allocated matches the current type, and allocating resources of the current target resource quantity in the current target resource pool;
[0229] Mark 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 the operation of obtaining the current target resource pool in each target resource pool in sequence until the resource allocation for all the target resource pools is completed.
[0231] Based on the above embodiments, the resource allocation module 450 is further configured to:
[0232] Obtaining the current request item in sequence from each of 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 quantity of the remaining resources satisfy the resource allocation status of the current request item;
[0234] If fully satisfied, after allocating resources for 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, updating the resource allocation satisfaction status of the current request item, and returning to execute the operation of sequentially obtaining the current priority resource pool in the priority resource pool set;
[0236] If the condition cannot be met, the operation of obtaining the current priority resource pool in sequence in the priority resource pool set is directly returned to.
[0237] Based on 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 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] Based on 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 according to the difference between the locked resource pool set and the matching resource pool set is performed.
[0243] Furthermore, 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 the 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 one resource allocation on the resource allocation request;
[0245] The first prompt module is configured to prompt the target resource pools to reset the target resource quantity for each target resource pool where resource allocation fails.
[0246] Based on the above embodiments, the device further includes:
[0247] a second ending module, configured to, during a process of 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, end the resource allocation process if it is determined that the resource allocation requirement for any request item cannot be met;
[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, configured to calculate a target allocation success rate score that matches the target priority template based on the universality score and sorting order of each resource pool in the target priority template;
[0251] A third prompting module is configured 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 based on 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, configured to update 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 after the update is completed and display the resource allocation result.
[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 solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply 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 embodiments 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 assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed 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. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. 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] Various components in device 500 are connected to I / O interface 505, including: an input unit 506, such as a keyboard, mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, optical disk, etc.; and a communication unit 509, such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0263] The computing unit 501 can be a variety of general-purpose and / or specialized 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 that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, 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 can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can 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 can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the resource allocation method by any other appropriate means (e.g., by means of firmware).
[0264] Various embodiments of the systems and techniques described above 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), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes 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 can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0266] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can 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 can 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 can 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 having 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 can 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 server are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services. The server may also be a server in a distributed system or a server integrated with blockchain.
[0270] Artificial intelligence (AI) is the study of how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily encompass computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graphs.
[0271] Cloud computing refers to a technology system that provides network access to elastically scalable shared pools of physical or virtual resources. These resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on-demand in a self-service manner. Cloud computing technology provides efficient and powerful data processing capabilities for the application of technologies such as artificial intelligence and blockchain, as well as for 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 described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved. This is not limited herein.
[0273] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A resource allocation method, comprising: Obtaining a resource allocation request, wherein the resource allocation request includes a plurality of request items, each of which includes a type and a 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 selecting the resource pool priority template set, obtaining a target priority template, and in response to setting the matching resource pool set, obtaining a target resource quantity set for at least one target resource pool; Based on the selection and setting results, a database transaction is started to complete the resource allocation process matching the resource allocation request; 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 opened, 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 on the resource allocation request; 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; Among them, the primary resource allocation is to obtain resources corresponding to the target resource quantity from each target resource pool set with a target resource quantity in the priority resource pool set, and allocate them to the resource allocation request to meet the minimum resource usage requirement of the resource allocation request; the secondary resource allocation is to obtain resources in the resource pool according to the priority based on the remaining resource quantity of each resource pool in the priority resource pool set after the primary resource allocation, and allocate them to the unmet request items in the resource allocation request to meet the unmet request items.
2. The method according to claim 1, wherein The matching of 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 includes: Parsing the request item in the resource allocation request; Mapping the parsed request field value 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 the OR relationship; 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 with a non-zero number of remaining resources is obtained to form the matching resource pool set.
3. The method according to claim 1, 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.
4. The method according to claim 3, wherein: The verifying, based on 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: Determining 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.
5. The method according to claim 3, 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 and the second field value are the same, 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 different, 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.
6. The method according to claim 1, wherein The acquiring the target resource quantity in each target resource pool and performing a resource allocation on the resource allocation request includes: In each of the target resource pools, sequentially obtain a current target resource pool, and obtain a current type and a current target resource quantity corresponding to the current target resource pool; Traversing each target request item in the resource allocation request whose type of resource to be allocated matches the current type, and allocating resources of the current target resource quantity in the current target resource pool; Mark 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 the operation of obtaining the current target resource pool in each target resource pool in sequence until the resource allocation for all the target resource pools is completed.
7. The method according to claim 6, wherein: 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, including: Obtaining the current request item in sequence from each of 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 quantity of the remaining resources satisfy the resource allocation status of the current request item; If fully satisfied, after allocating resources for 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, updating the resource allocation satisfaction status of the current request item, and returning to execute the operation of sequentially obtaining the current priority resource pool in the priority resource pool set; If the condition cannot be met, the operation of obtaining the current priority resource pool in sequence in the priority resource pool set is directly returned to.
8. The method according to any one of claims 1 to 7, 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 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.
9. The method according to claim 4, after determining whether the locked resource pool set includes all the target resource pools in the matching resource pool set, further comprising: If not, the target resource quantity is reset according to the difference between the locked resource pool set and the matching resource pool set.
10. The method according to claim 1, further comprising: In the process of obtaining the target resource quantity from each target resource pool and performing one resource allocation for the resource allocation request, if it is determined that the resource allocation of the target resource quantity in any target resource pool cannot be completed, then terminating the resource allocation process; Prompts are given to reset the target resource quantity for each target resource pool where resource allocation fails.
11. The method according to claim 1 , further comprising: In the process of performing secondary resource allocation on the 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, if it is determined that the resource allocation requirement for any request item cannot be met, then terminating the resource allocation process; A prompt is provided for reselecting or resetting the target priority template.
12. The method according to claim 11, after reselecting or resetting the prompt for the target priority template, further comprising: Calculate the target allocation success rate score that matches the target priority template based on the universality score and sorting order of each resource pool in the target priority template; Prompting 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 score 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.
13. The method according to any one of claims 1 to 7, 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.
14. A resource allocation device, comprising: A request acquisition module, configured to acquire a resource allocation request, wherein the resource allocation request includes a plurality of request items, each of which includes a type and a required quantity of resources to be allocated; A resource pool matching module, 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; 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; a response module, configured to obtain a target priority template in response to 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 setting of the matching resource pool set; A resource allocation module, configured to start a database transaction to complete a resource allocation process matching the resource allocation request according to the selection and setting results; The resource allocation module is specifically configured to: After the database transaction is opened, 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 on the resource allocation request; 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; Among them, the primary resource allocation is to obtain resources corresponding to the target resource quantity from each target resource pool set with a target resource quantity in the priority resource pool set, and allocate them to the resource allocation request to meet the minimum resource usage requirement of the resource allocation request; the secondary resource allocation is to obtain resources in the resource pool according to the priority based on the remaining resource quantity of each resource pool in the priority resource pool set after the primary resource allocation, and allocate them to the unmet request items in the resource allocation request to meet the unmet request items.
15. 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 13.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause a computer to execute the method according to any one of claims 1-13.
17. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 13.
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