Resource allocation method, device, equipment, medium and product

By implementing resource grouping rules and a round-robin selection mechanism, the problem of uneven resource allocation among sub-accounts was solved, achieving reasonable allocation and balanced use of resources, and improving the transaction success rate and responsiveness of the e-commerce system in high-concurrency scenarios.

CN120929262APending Publication Date: 2025-11-11CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511058372.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

In existing technologies, uneven resource allocation among sub-accounts leads to low business transaction success rates, especially in scenarios with high concurrency requests where resource shortages and increased concurrency pressure are exacerbated.

Method used

By introducing resource grouping rules and a polling selection mechanism, resource groups are dynamically adjusted based on the one-to-one correspondence between resource operation ranges and resource groups, resource operation requests are reasonably allocated, and target sub-accounts are selected for operation within the target resource group through a polling selection mechanism.

Benefits of technology

It achieves reasonable allocation and balanced use of resources, reduces the risk of transaction failure, improves the system's responsiveness and transaction success rate, and optimizes the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929262A_ABST
    Figure CN120929262A_ABST
Patent Text Reader

Abstract

The invention provides a resource allocation method and device, equipment, a medium and a product, and the method comprises the steps: obtaining a resource operation request of a user, the resource operation request carrying a resource operation amount; based on a current resource grouping rule and a resource operation amount, the resource operation request is matched to a corresponding target resource group, the resource grouping rule is used for indicating a one-to-one correspondence relationship between a resource operation amount interval and the resource group, and each resource group comprises at least one sub-account; in the target resource group, selecting a target sub-account for executing the resource operation request through a polling selection mechanism; and executing the resource operation request on the target sub-account. Therefore, by dynamically matching the resource operation request with the target resource group, reasonable distribution and load balancing of sub-account resources are realized, and the problems of queue blocking and insufficient sub-account resources are solved. The target sub-account is selected through the polling mechanism, so that efficient execution of the resource operation request is ensured, and the success rate of business transaction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a resource allocation method, apparatus, device, medium and product. Background Technology

[0002] In modern e-commerce systems, the effective management of hot resources (such as funds, inventory, coupons, and activity vouchers) has become a key factor in system performance and transaction success rate. Especially in scenarios targeting end-users, high concurrency requests often intensify competition for these hot resources, leading to congestion and queuing, which seriously affects user experience and transaction efficiency.

[0003] Currently, there are two main solutions to the problem of hot resources: one is to create multiple sub-accounts to distribute hot resources across different sub-accounts, thereby reducing resource contention during peak periods; the other is to store hot resources in a high-speed caching middleware (such as Redis) and use caching for business processing, thereby improving concurrency performance. However, each of these solutions has its advantages and disadvantages. While the first solution is relatively simple to implement, it has shortcomings in the selection mechanism for sub-accounts, while the second solution needs to consider issues such as the synchronization of cached resources and the database, and the stability of the middleware.

[0004] For Solution 1, the existing sub-account selection mechanism typically uses round-robin and random methods, leading to uneven resource allocation. Since the amount of resources processed for each request in a business transaction is random, unreasonable sub-account selection may result in insufficient resources for some sub-accounts, causing transaction failures and reducing the success rate. Furthermore, uneven resource allocation can exacerbate the concurrent pressure on some sub-accounts, increasing the transaction waiting time for other sub-accounts and further degrading system performance. As transaction volume increases, these problems become more pronounced, and the risk of uncontrolled resource usage also rises.

[0005] In summary, existing technologies suffer from uneven resource allocation in sub-accounts, resulting in poor effectiveness and reduced success rates for business transactions. Summary of the Invention

[0006] This application provides a resource allocation method, apparatus, device, medium, and product to solve the technical problem in the prior art where the resource allocation of sub-accounts is uneven, ineffective, and reduces the success rate of business transactions.

[0007] To solve the above-mentioned technical problems, this application is implemented as follows:

[0008] In a first aspect, embodiments of this application provide a resource allocation method, the method comprising:

[0009] Obtain the user's resource operation request, wherein the resource operation request carries the resource operation quantity;

[0010] Based on the current resource grouping rules and the resource operation volume, the resource operation request is matched to the corresponding target resource group. The resource grouping rules are used to indicate the one-to-one correspondence between the resource operation volume range and the resource group. Each resource group includes at least one sub-account.

[0011] Within the target resource group, a polling selection mechanism is used to select the target sub-account to execute the resource operation request;

[0012] The resource operation request is executed on the target sub-account.

[0013] Optionally, the resource grouping rules are adjusted every preset period. Before matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume, the method further includes:

[0014] Obtain the pre-configured resource group quantity threshold and resource group boundary threshold, wherein the resource group boundary threshold includes: the maximum value of the resource group boundary;

[0015] Obtain the mean difference of the cumulative resource operation volume and the number of resource operation requests within the current preset period; wherein, the mean difference is used to quantify the dispersion of the cumulative resource operation volume within the current preset period, and the cumulative resource operation volume is counted from zero at the beginning of the current preset period;

[0016] The interval length of the resource group is determined based on the mean difference and the number of times, wherein the minimum value of the interval length is 1 resource unit;

[0017] Resources are grouped according to the interval length of the resource group, the boundary threshold of the resource group, and the number threshold of the resource group. When the number of resource groups is greater than the number threshold of the resource group, the right endpoint of the interval length of the last resource group is set as the maximum value of the resource group boundary.

[0018] Optionally, the interval length of the resource group is positively correlated with the dispersion of the cumulative resource operation volume.

[0019] Optionally, the order of sub-accounts within the resource group is:

[0020] The resource group is randomly generated and a polling pointer is set within it. The polling pointer is used to poll and indicate the sub-accounts within the resource group.

[0021] Within the target resource group, the target sub-account selected through a round-robin selection mechanism to execute the resource operation request includes:

[0022] Determine the sub-account currently pointed to by the polling pointer of the target resource group;

[0023] The sub-account is identified as the target sub-account, and the polling pointer is moved to the next sub-account according to the order of the sub-accounts.

[0024] Optionally, the sub-accounts in different resource groups can be arranged in different orders to reduce the probability that the same sub-account will be accessed simultaneously within the different resource groups.

[0025] Optionally, after obtaining the user's resource operation request, the method further includes:

[0026] Determine whether the resource operation quantity is within the range indicated by the resource group boundary threshold;

[0027] If so, then execute the step of matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume;

[0028] If not, the resource operation request is rejected and an alert is issued.

[0029] Secondly, embodiments of this application provide a resource allocation device, the device comprising:

[0030] The acquisition module is used to acquire the user's resource operation request, wherein the resource operation request carries the resource operation quantity;

[0031] An execution module is used to match the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume, wherein the resource grouping rules are used to indicate the one-to-one correspondence between the resource operation volume range and the resource group, and the resource group includes at least one sub-account;

[0032] Within the target resource group, a polling selection mechanism is used to select the target sub-account to execute the resource operation request;

[0033] The resource operation request is executed on the target sub-account.

[0034] Thirdly, embodiments of this application provide a network device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps of a resource allocation method as described in the first aspect.

[0035] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of a resource allocation method as described in the first aspect.

[0036] Fifthly, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps of a resource allocation method as described in the first aspect.

[0037] In this embodiment, firstly, by analyzing the resource operation volume in the resource operation request and matching it to the corresponding target resource group according to resource grouping rules, it is ensured that the resource operation request can be reasonably allocated to the appropriate resource group. This process not only reduces the risk of transaction failure due to improper resource allocation but also optimizes resource utilization efficiency. Secondly, within the target resource group, a round-robin selection mechanism is used to select the target sub-account to execute the resource operation request. This selection mechanism ensures the balance of resource usage among sub-accounts, avoiding performance bottlenecks caused by resource overload in a particular sub-account, thereby reducing transaction waiting time and the possibility of timeout failure. In this way, resource allocation can be dynamically adjusted under high concurrency, balancing the load pressure of each sub-account, thereby improving the overall transaction success rate.

[0038] In summary, by employing a reasonable resource matching and balanced sub-account selection mechanism, efficient processing of resource operation requests was achieved, significantly improving the responsiveness and stability of the e-commerce system in the face of high-concurrency scenarios, ultimately leading to an increase in transaction success rate and an optimization of user experience. Attached Figure Description

[0039] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0040] Figure 1 A flowchart illustrating a resource allocation method provided in an embodiment of this application;

[0041] Figure 2 A structural block diagram of a resource allocation system provided in an embodiment of this application;

[0042] Figure 3 A schematic diagram of a resource grouping process provided in an embodiment of this application;

[0043] Figure 4 A dotted diagram illustrating a specific resource grouping for a resource operation request, provided as an embodiment of this application;

[0044] Figure 5 A line diagram illustrating a specific resource grouping for a resource operation request, provided as an embodiment of this application;

[0045] Figure 6 This is a schematic diagram illustrating the process of selecting sub-accounts within a resource group, as provided in an embodiment of this application.

[0046] Figure 7 A schematic diagram illustrating the allocation (tending to stabilize) of resource operation requests on sub-accounts, provided as an embodiment of this application;

[0047] Figure 8 A structural block diagram of a resource allocation device provided in an embodiment of this application;

[0048] Figure 9 This is a structural block diagram of a network device provided in an embodiment of this application. Detailed Implementation

[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0050] Figure 1 This application illustrates a resource allocation method according to an embodiment of the present application, such as... Figure 1 As shown, the method includes:

[0051] Step S101: Obtain the user's resource operation request;

[0052] The resource operation request carries the resource operation amount;

[0053] Step S102: Based on the current resource grouping rules and resource operation volume, match the resource operation request to the corresponding target resource group;

[0054] Among them, the resource grouping rule is used to indicate the one-to-one correspondence between the resource operation volume range and the resource group, and each resource group includes at least one sub-account;

[0055] Step S103: Within the target resource group, select the target sub-account to execute the resource operation request through a polling selection mechanism;

[0056] Step S104: Execute a resource operation request on the target sub-account.

[0057] It's important to note that the system first receives a user's resource operation request, which includes the specific amount of resource operation (e.g., increasing or decreasing a value). Then, based on the current resource grouping rules and the resource operation amount carried in the request, the system determines which target resource group the operation should belong to. The resource grouping rules establish a hard mapping between resource operation ranges and different resource groups (i.e., each operation range strictly corresponds to a specific resource group), and each resource group contains at least one sub-account (a physically or logically independent resource unit). After determining the target resource group, the system employs a fair allocation strategy within this group, namely a round-robin selection mechanism, to select a current target sub-account from the multiple sub-accounts contained in the group. Ultimately, the actual operation performed on the resource (such as increasing or decreasing) will be completed on the selected target sub-account.

[0058] Therefore, by introducing resource grouping rules and load balancing (round-robin selection mechanism) for sub-accounts within a group, a distributed method for processing hot resource requests is constructed, which can effectively distribute the pressure and thus improve the system's response speed, processing capacity and overall stability.

[0059] In one possible implementation, the resource grouping rules are adjusted every preset period. Before matching resource operation requests to the corresponding target resource groups based on the current resource grouping rules and resource operation volume, the method further includes: obtaining a pre-configured resource group quantity threshold and a resource group boundary threshold, wherein the resource group boundary threshold includes: the maximum value of the resource group boundary; obtaining the mean difference of the cumulative resource operation volume and the number of resource operation requests within the current preset period; wherein the mean difference is used to quantify the dispersion of the cumulative resource operation volume within the current preset period, and the cumulative resource operation volume is counted from zero at the beginning of the current preset period; determining the interval length of the resource group based on the mean difference and the number of requests, wherein the minimum value of the interval length is 1 resource unit; grouping resources according to the interval length of the resource group, the resource group boundary threshold, and the resource group quantity threshold, wherein when the number of resource groups is greater than the resource group quantity threshold, the right endpoint of the interval length of the last resource group is set as the maximum value of the resource group boundary.

[0060] It should be noted that this possible implementation method illustrates the dynamic adjustment mechanism of resource grouping rules. Its core lies in periodically and automatically optimizing the key parameter of resource grouping rules—the length of the resource grouping interval—based on changes in the actual operating load of the system, so as to ensure that the resource grouping rules can always effectively respond to the current request characteristics and maintain efficient traffic distribution.

[0061] Specifically, before processing resource operation requests based on the current resource grouping rules, the system first executes a rule adjustment process. This process is triggered at a preset interval (e.g., every minute or hour). Within each interval, the system acquires two pre-configured hard constraints: a resource group quantity threshold (the maximum allowed number of groups to be created) and a resource group boundary threshold (containing two key values—the maximum resource group boundary value, used to limit the maximum possible range of resource operation volume, and the minimum resource group boundary value, which defaults to zero). Simultaneously, the system collects runtime metrics for the current interval: the mean difference of cumulative resource operation volume within the current preset interval (used to accurately measure the dispersion of the resource operation volume values ​​of all resource operation requests within this interval) and the number of resource operation requests (i.e., request throughput).

[0062] Based on these inputs, the system first determines the interval length of resource groups according to the mean difference and the number of requests. The magnitude of the mean difference directly reflects the concentration or dispersion trend of resource operation volume distribution (a small mean difference indicates concentrated operation volume, and a large mean difference indicates dispersion); the number of requests reflects the density of requests. The system uses these two indicators to calculate a new resource group interval length that is more suitable for the current load characteristics (this length is at least 1 resource unit to ensure basic granularity). Subsequently, the system performs resource grouping based on the interval length of the resource groups, as well as the resource group boundary threshold and the resource group quantity threshold. Specifically, using the calculated new interval length, starting from the minimum value of resource operation volume (usually 0 or 1), consecutive intervals are divided sequentially, with each interval corresponding to one resource group. During the division process, the maximum value limit of the resource group boundary is strictly adhered to. If the total number of resource groups divided according to the new interval length exceeds the resource group quantity threshold, boundary adjustment is performed: the right endpoint (upper limit) of the interval range of the last (i.e., the last resource group) is directly set as the maximum value of the resource group boundary. This ensures that the number of groups does not exceed the threshold and that the entire range of resource operations (from the minimum to the maximum value of the resource group boundary) is covered by groups without any omissions.

[0063] In summary, by periodically analyzing request data (mean difference, number of requests), and within predefined safety boundaries (resource group quantity threshold, maximum resource group boundary value), the system intelligently recalculates the resource group interval length and adjusts the group boundaries (especially processing the last resource group). This ensures that the resource grouping rules can adaptively and accurately distribute requests with different resource operation volumes to the most suitable resource groups, thereby continuously distributing pressure and improving concurrent processing capabilities. This significantly enhances the robustness and scenario adaptability of the entire hot resource handling solution.

[0064] In one possible implementation, the interval length of resource grouping is positively correlated with the dispersion of the cumulative resource operation volume.

[0065] It should be noted that when the dispersion (precisely quantified by the mean difference) of the cumulative resource operation volume observed by the system within the current preset period increases, the interval length of the resource group determined by the system will also increase accordingly; conversely, when the dispersion decreases, the interval length of the resource group determined by the system will also decrease accordingly. The dispersion (mean difference) directly reflects the distribution characteristics of the resource operation volume carried by all resource operation requests within this period: a large mean difference indicates that the resource operation volume of each request is significantly different and widely distributed, so the interval length of the resource group can be increased; a small mean difference indicates that the operation volume values ​​of the requests are relatively close and concentrated, so the interval length of the resource group needs to be reduced.

[0066] Therefore, resource grouping rules can accurately respond to the wide and narrow changes in the load distribution of resource operation requests, intelligently determine the coarseness and fineness of the grouping, thereby continuously optimizing the diversion effect of resource grouping on requests and maximizing the advantages of grouping strategies in distributing hotspots and improving concurrency capabilities.

[0067] In one possible implementation, the order of sub-accounts within a resource group is randomly generated, and a polling pointer is set within the resource group to poll and indicate the sub-accounts within the resource group. Within the target resource group, selecting the target sub-account for executing the resource operation request through a polling selection mechanism includes: determining the sub-account currently pointed to by the polling pointer of the target resource group; identifying the sub-account as the target sub-account; and pointing the polling pointer to the next sub-account according to the order of the sub-accounts.

[0068] It's important to note that the order of sub-accounts within each resource group is randomly generated during creation (i.e., the initial order is not fixed or follows a specific pattern). Each resource group independently maintains a crucial status flag—a polling pointer. This pointer acts as a location indicator, pointing sequentially to a specific sub-account within the group during the polling process. When a request needs to select a specific target sub-account within the target resource group using a polling selection mechanism, the system performs the following key operations: First, it locates the sub-account currently pointed to by the polling pointer of the target resource group; next, it directly identifies the sub-account currently pointed to by the pointer as the target sub-account for this request; finally, after selection, it immediately redirects the polling pointer to the next sub-account according to the predetermined order of sub-accounts within the group (this order is randomly determined during initialization) (if the current pointer already points to the last sub-account, it loops to the first sub-account). This further ensures resource load balancing.

[0069] In one possible implementation, the sub-accounts of different resource groups are arranged in different orders to reduce the probability that the same sub-account will be accessed simultaneously within different resource groups.

[0070] It's important to note that when initializing the arrangement of sub-accounts within each independent resource group, the system does not employ a uniform, fixed pattern. Instead, it independently and randomly generates the arrangement sequence of sub-accounts within each group. This means that even if two groups A and B contain identical sub-accounts (physically or logically shared), their arrangement order within group A (e.g., sub-account 1->3->2) will differ from their arrangement order within group B (e.g., sub-account 2->1->3). This differentiated arrangement, combined with each group's independently operating polling pointer (which moves strictly according to the group's specific order), significantly reduces the likelihood that multiple resource groups will simultaneously select target sub-accounts through their respective polling mechanisms, ensuring that their polling pointers point to the same sub-account at any given moment. This effectively distributes the pressure on sub-accounts, resulting in stronger peak-shifting capabilities and more even distribution of polling behavior across multiple groups at the global level.

[0071] In one possible implementation, after obtaining the user's resource operation request, the method further includes: determining whether the resource operation amount is within the range indicated by the resource group boundary threshold; if so, performing the step of matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation amount; if not, rejecting the resource operation request and issuing an alarm.

[0072] It's important to note that after the system receives a user's resource operation request, it doesn't immediately execute the subsequent matching and operation process. Instead, it first determines whether the resource operation amount falls within the range indicated by the resource group boundary threshold. This resource group boundary threshold (especially the maximum value) essentially defines the maximum limit of the resource operation amount the system can currently accept. The system compares the requested resource operation amount with this range: if the resource operation amount meets the condition—that is, its value falls within the range (including cases equal to the boundary value)—it is considered a legitimate request and allowed to proceed to the next step: matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation amount (i.e., following the normal resource group matching and sub-account processing process). If not, that is, the resource operation amount is lower than the minimum value of the range or higher than the maximum value of the resource group boundary, the request is judged as an illegal or unprocessable out-of-bounds request. The system will immediately refuse to execute the resource operation request and simultaneously trigger an alarm mechanism to notify relevant personnel or the system of abnormal operation. This ensures the entire hotspot resource processing solution operates safely, controllably, and efficiently.

[0073] The resource allocation method shown in the embodiments of this application will now be described from a system perspective, such as... Figure 2As shown, this embodiment adds an independent automatic routing algorithm module to the transaction chain. This algorithm module includes two units: a resource grouping unit and a sub-account selection unit. The resource grouping unit groups transactions based on the resource quantity, and initializes a random sub-account polling order for each group. Each group independently polls and selects sub-accounts, and the groups do not affect each other. The sub-account selection unit matches the corresponding group based on the resource quantity processed for each request, and then polls and selects sub-accounts within the target group. This design achieves dynamic balancing of sub-account resource allocation and load pressure, solving the two core problems of blocking queues and insufficient sub-account resources, thereby improving the success rate of business transactions.

[0074] Specifically, it is divided into two processes: the resource grouping process (e.g.) Figure 3 (as shown) and the sub-account selection process (as shown) Figure 6 (As shown).

[0075] The resource grouping process is as follows:

[0076] 1. After a certain period of time, the preset timer (starting once every 5 minutes) meets the conditions and starts the resource grouping processing logic unit.

[0077] 2. Read the preset group number threshold G_num (default 10000) and group boundary threshold (G_min default 0, G_max default 100 million). These three parameters can be dynamically modified and adjusted according to the amount of resources and usage.

[0078] 3. Read the average difference in cumulative transaction resource quantity and resource operation count for the current period (5 minutes). The formula for calculating the grouping step size is:

[0079] G_step = Tran_sum_num_avg_diff / Tran_count, and the minimum value of step G_step is 1 resource unit. If the calculation result of the formula is greater than or equal to 1, then the calculation result is taken. If the calculation result of the formula is less than 1, then G_step is taken as 1, and the statistical data for this period is initialized to 0, and the statistics are recalculated in the next period.

[0080] 4. Initialize the resource grouping list List_RG = [RG1, RG2, RG3, ..., RGn-1, RGn] based on the grouping step size (G_step). Each grouping expression is: RGn = {((n-1)*G_step, n*G_step)]}, with the grouping interval being left-open and right-closed. When the number of groups n is greater than G_num, it is set as the last group {(n*G_step), G_max]}. This step dynamically adjusts the grouping interval based on the dispersion of the number of transaction resources; the greater the dispersion, the larger the grouping span (larger step size), and the smaller the dispersion, the smaller the grouping span (smaller step size). The resource grouping details for each resource operation request can be referenced. Figure 4 and Figure 5 .

[0081] 5. Iterate through all resource grouping lists (List_RG), add a sub-account list (List_Account) to each group, initialize the sub-accounts with a random order, and set the polling pointer (target) to 0. Each group has the same number of sub-accounts, but the order of the sub-accounts within each group is random. When the requested transaction resource quantity matches the corresponding group range, the sub-accounts are selected according to the selection order within that group, and the groups do not affect each other. Randomly initializing the polling order of sub-accounts for each group increases the randomness of sub-account selection between different groups and reduces the probability of all groups hitting the same sub-account at the same time. Although some groups may have the same order after random sorting, this does not affect the overall algorithm performance. After a timed period (5 minutes), the groups will be regrouped and sorted again, and the previously consistent order will be broken and inconsistent.

[0082] 6. Returns complete array information for resource groups:

[0083] List_RG=[RG1{(0,G_step),(A1,A2,...),target=0},RG2{(1*G_step,2*G_step),(A1,A2,...),target=0},{...},...,RGn-1{((n-1 )*G_step,(n-1)*G_step),(A1,A2,...),target=0},RGn{((n-1)*G_step,n*G_step),(A1,A2,...),target=0}], here n*G_step<=G_max.

[0084] The process for selecting sub-accounts is as follows:

[0085] 1. When a request arrives, read the resource quantity Tran_num = Rx (x represents the resource quantity, such as x yuan, x units, x cents, etc.), check whether Rx is within the group boundary range (G_min <= Rx <= G_max), if it exceeds the group boundary range, prompt an unexpected value and issue an alarm, and end the process.

[0086] 2. Calculate the number of transactions, cumulative transaction resource quantity, average transaction resource quantity, and mean difference of cumulative transaction resource quantity for the current period (within 5 minutes). This statistical data is a parameter used for grouping step size calculation. The calculation formula is as follows: Transaction count (Tran_count) is incremented by 1 for each transaction; cumulative transaction resource quantity (Tran_sum_num) = Tran_sum_num + Tran_num; average transaction resource quantity (Tran_num_avg) = Tran_sum_num / Tran_count; mean difference of cumulative transaction resource quantity (Tran_sum_num_avg_diff) = Tran_sum_num_avg_diff + (|Tran_num_avg - Tran_num|).

[0087] 3. Read the resource group configuration information, search the resource group list List_RG, match the corresponding group RGx according to Rx, and determine if the number of resources in Rx meets the requirement of G_start. <Rx<=G_end。

[0088] 4. Obtain the list of sub-accounts List_Account within group RGx. Using a round-robin strategy, read the sub-account Ax represented by the target index (representing the sub-account to be processed for the current resource quantity Rx), reset target to the index of the next round-robin sub-account in the List_Account list, and return the selected sub-account Ax (used for processing the resource Rx in this request).

[0089] 5. The subsequent business logic processing unit uses the sub-account Ax to complete the transaction processing for this request, that is, to add or remove x amount of resources on Ax.

[0090] And can be used as a reference Figure 7 After the sub-account selection process, the distribution of resource operation requests in each sub-account becomes more controllable.

[0091] In summary, this approach avoids transaction failures caused by unreasonable resource allocation. Regardless of changes in the method (increase / decrease) and quantity of requested resources, it ensures a dynamic balance between concurrency and resource quantity across sub-accounts, remaining stable within a controllable range. The length and duration of the request blocking queue are also controllable. Furthermore, the more evenly the request volume and resource quantity are distributed across sub-accounts, the higher the availability of the sub-accounts, thus improving the transaction success rate.

[0092] Figure 8 An example of a resource allocation apparatus provided according to an embodiment of this application is shown, such as... Figure 8 As shown, the device 80 includes:

[0093] The acquisition module 801 is used to acquire the user's resource operation request, wherein the resource operation request carries the resource operation quantity;

[0094] The execution module 802 is used to match resource operation requests to the corresponding target resource group based on the current resource grouping rules and resource operation volume. The resource grouping rules are used to indicate the one-to-one correspondence between the resource operation volume range and the resource group. Each resource group includes at least one sub-account.

[0095] Within the target resource group, a polling selection mechanism is used to select the target sub-account for executing the resource operation request;

[0096] Execute the resource operation request on the target sub-account.

[0097] In one possible implementation, the resource grouping rule is adjusted once every preset period. The execution module 802 is also used to obtain a pre-configured resource group quantity threshold and resource group boundary threshold before matching the resource operation request to the corresponding target resource group based on the current resource grouping rule and resource operation volume. The resource group boundary threshold includes: the maximum value of the resource group boundary.

[0098] Get the mean difference of the cumulative resource operation volume and the number of resource operation requests within the current preset period; where the mean difference is used to quantify the dispersion of the cumulative resource operation volume within the current preset period. At the beginning of the current preset period, the cumulative resource operation volume is counted from zero.

[0099] The interval length of resource grouping is determined based on the mean difference and the frequency, where the minimum interval length is 1 resource unit;

[0100] Resources are grouped according to the interval length of the resource group, the boundary threshold of the resource group, and the number threshold of the resource group. When the number of resource groups exceeds the number threshold of the resource group, the right endpoint of the interval length of the last resource group is set as the maximum value of the resource group boundary.

[0101] In one possible implementation, the interval length of resource grouping is positively correlated with the dispersion of the cumulative resource operation volume.

[0102] In one possible implementation, the order of sub-accounts within a resource group is randomly generated, and a polling pointer is set within the resource group to poll and indicate the sub-accounts within the resource group.

[0103] The execution module 802 is also used to determine the sub-account currently pointed to by the polling pointer of the target resource group; to determine the sub-account as the target sub-account; and to point the polling pointer to the next sub-account according to the order of the sub-accounts.

[0104] In one possible implementation, the sub-accounts of different resource groups are arranged in different orders to reduce the probability that the same sub-account will be accessed simultaneously within different resource groups.

[0105] In one possible implementation, the execution module 802 is further configured to, after obtaining the user's resource operation request, determine whether the resource operation amount is within the range indicated by the resource group boundary threshold; if so, execute the step of matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation amount; if not, reject the resource operation request and issue an alarm.

[0106] In summary, compared to conventional sub-account designs, this embodiment achieves refined control over resource operations through an innovative resource grouping design, effectively reducing the differences in the number of resource operations between sub-accounts. Traffic adjustment ensures a reasonable resource allocation. This not only guarantees a uniform distribution of concurrent request load among sub-accounts but also ensures a balanced distribution of resource quantity across all sub-accounts, keeping errors within the expected range. Furthermore, the system can monitor the number of transaction resources in real time and dynamically adjust the grouping step size based on actual conditions, enabling reasonable grouping strategy adjustments to adapt to transaction changes, thereby ensuring a uniform distribution of resources across all sub-accounts.

[0107] This application provides a network device 90, such as... Figure 9 As shown, the network device 90 includes a processor 901, a memory 902, and a program stored in the memory 902 and executable on the processor 901. When the program is executed by the processor 901, it implements the steps of a resource allocation method as shown in the above embodiment.

[0108] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the steps of a resource allocation method as shown in the above embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0109] This application also provides a computer program product, including computer instructions. When executed by a processor, the computer instructions implement the steps of the resource allocation method shown in the above embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0110] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0111] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0112] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A resource allocation method, characterized in that, The method includes: Obtain the user's resource operation request, wherein the resource operation request carries the resource operation quantity; Based on the current resource grouping rules and the resource operation volume, the resource operation request is matched to the corresponding target resource group. The resource grouping rules are used to indicate the one-to-one correspondence between the resource operation volume range and the resource group. Each resource group includes at least one sub-account. Within the target resource group, a polling selection mechanism is used to select the target sub-account to execute the resource operation request; The resource operation request is executed on the target sub-account.

2. The method according to claim 1, characterized in that, The resource grouping rules are adjusted every preset period. Before matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume, the method further includes: Obtain the pre-configured resource group quantity threshold and resource group boundary threshold, wherein the resource group boundary threshold includes: the maximum value of the resource group boundary; Obtain the mean difference of the cumulative resource operation volume and the number of resource operation requests within the current preset period; wherein, the mean difference is used to quantify the dispersion of the cumulative resource operation volume within the current preset period, and the cumulative resource operation volume is counted from zero at the beginning of the current preset period; The interval length of the resource group is determined based on the mean difference and the number of times, wherein the minimum value of the interval length is 1 resource unit; Resources are grouped according to the interval length of the resource group, the boundary threshold of the resource group, and the number threshold of the resource group. When the number of resource groups is greater than the number threshold of the resource group, the right endpoint of the interval length of the last resource group is set as the maximum value of the resource group boundary.

3. The method according to claim 2, characterized in that, The interval length of the resource grouping is positively correlated with the dispersion of the cumulative resource operation volume.

4. The method according to claim 1, characterized in that, The order of sub-accounts within the resource group is randomly generated, and a polling pointer is set within the resource group to poll and indicate the sub-accounts within the resource group. Within the target resource group, the target sub-account selected through a round-robin selection mechanism to execute the resource operation request includes: Determine the sub-account currently pointed to by the polling pointer of the target resource group; The sub-account is identified as the target sub-account, and the polling pointer is moved to the next sub-account according to the order of the sub-accounts.

5. The method according to claim 4, characterized in that, The sub-accounts in different resource groups are arranged in different orders to reduce the probability that the same sub-account will be accessed simultaneously within the different resource groups.

6. The method according to claim 2, characterized in that, After obtaining the user's resource operation request, the method further includes: Determine whether the resource operation quantity is within the range indicated by the resource group boundary threshold; If so, then execute the step of matching the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume; If not, the resource operation request is rejected and an alert is issued.

7. A resource allocation device, characterized in that, The device includes: The acquisition module is used to acquire the user's resource operation request, wherein the resource operation request carries the resource operation quantity; An execution module is used to match the resource operation request to the corresponding target resource group based on the current resource grouping rules and the resource operation volume, wherein the resource grouping rules are used to indicate the one-to-one correspondence between the resource operation volume range and the resource group, and the resource group includes at least one sub-account; Within the target resource group, a polling selection mechanism is used to select the target sub-account to execute the resource operation request; The resource operation request is executed on the target sub-account.

8. A network device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of a resource allocation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of a resource allocation method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of a resource allocation method as described in any one of claims 1 to 6.