WO2023103342A1 - Cluster resource quota allocation method and apparatus, and electronic device - Google Patents

Cluster resource quota allocation method and apparatus, and electronic device Download PDF

Info

Publication number
WO2023103342A1
WO2023103342A1 PCT/CN2022/100694 CN2022100694W WO2023103342A1 WO 2023103342 A1 WO2023103342 A1 WO 2023103342A1 CN 2022100694 W CN2022100694 W CN 2022100694W WO 2023103342 A1 WO2023103342 A1 WO 2023103342A1
Authority
WO
WIPO (PCT)
Prior art keywords
load
cluster
processing
service
configuration information
Prior art date
Application number
PCT/CN2022/100694
Other languages
French (fr)
Chinese (zh)
Inventor
韩向前
谢健
邸帅
卢道和
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2023103342A1 publication Critical patent/WO2023103342A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Definitions

  • the embodiments of the present application relate to the technical field of big data, and in particular to a cluster resource quota allocation method, device and electronic equipment.
  • a cluster can usually serve multiple financial services.
  • a cluster serves multiple financial services, there may be a sudden increase in the request volume of one service and occupy a large amount of cluster resources, resulting in insufficient resources of other services.
  • the purpose of the present application is to provide a cluster resource quota allocation method, device and electronic equipment, so as to improve the accuracy of resource quota allocation.
  • the embodiment of the present application provides a cluster resource quota allocation method, including:
  • the verification result is that the verification is passed, allocating a resource quota for the pending business according to the business processing request, and processing the pending business according to the allocated resource quota to obtain a business processing result;
  • the pending service is processed according to the pre-stored over-quota request processing rule.
  • the service processing request includes a load request amount
  • the resource quota verification is performed on the service to be processed according to the latest load increment and pre-stored resource configuration information, and the verification result is obtained, including:
  • the verification result is a verification failure.
  • the method further includes:
  • the step of acquiring the latest load increment is performed.
  • the method further includes:
  • overflow ratio information determines the maximum quota of the service to be processed according to the overflow ratio information
  • the acquisition of the latest load increment includes:
  • the latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
  • determining the latest load increment according to the total processing time, the processing time threshold, the minimum load of the cluster, the maximum load of the cluster, and the current load of the cluster in the pre-stored resource configuration information include:
  • the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information;
  • the acquisition of the minimum load of the cluster according to the preset acquisition rules includes:
  • the minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
  • the acquisition of the highest load of the cluster according to the preset acquisition rules includes:
  • the maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
  • the method also includes:
  • the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  • processing the pending service according to the pre-stored over-quota request processing rules includes:
  • the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the pending service to a request queue;
  • a processing exception prompt is generated.
  • the embodiment of the present application provides a cluster resource quota allocation device, including:
  • the receiving module is used to receive the service processing request of the pending service sent by the client;
  • a processing module configured to verify the resource quota of the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result
  • the processing module is further configured to allocate a resource quota for the service to be processed according to the service processing request if the verification result is passed, and process the service to be processed according to the allocated resource quota to obtain Business processing results;
  • the processing module is further configured to process the service to be processed according to a pre-stored over-quota request processing rule if the verification result is that the verification fails.
  • an embodiment of the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
  • the memory stores computer-executable instructions
  • the processor executes the computer-executed instructions stored in the memory to implement the cluster resource quota allocation method described in the first aspect and various possible designs of the first aspect.
  • the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the above first aspect and the first Aspects of various possible designs of the cluster resource quota allocation method.
  • the embodiment of the present application provides a computer program product, including a computer program.
  • the computer program is executed by a processor, the cluster resource quota allocation described in the above first aspect and various possible designs of the first aspect is realized. method.
  • the embodiment of the present application provides a cluster resource quota allocation method, device, and electronic equipment.
  • the service processing request of the pending business sent by the client can be received first, and then according to the latest load increment and the pre-stored resource
  • the configuration information is verified by the resource quota of the business to be processed, and the verification result is obtained.
  • a resource quota is allocated to the pending business according to the business processing request, and then the pending business is processed according to the allocated resource quota to obtain a business processing result.
  • the pending service may be processed according to the pre-stored over-quota request processing rule.
  • resource quotas are allocated for pending services, which reduces inaccurate cluster load judgments and improves the rationality and accuracy of resource quota allocation. Thus ensuring the normal realization of various financial services.
  • FIG. 1 is a schematic diagram of the architecture of the application system of the cluster resource quota allocation method provided by the embodiment of the present application;
  • FIG. 2 is a schematic flowchart of a method for allocating cluster resource quotas provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of a cluster resource quota allocation method provided by another embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a cluster resource quota allocation device provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
  • the volume of business requests is often a fluctuating curve, and the time when business peaks and troughs appear can be predicted according to the business scenario.
  • the peak value often depends on the experience and historical data of the operation and maintenance personnel. In the event of standby switching, etc.), it will lead to the failure of all the sudden requests under the current current limiting logic, which affects the normal realization of various financial services.
  • this application allocates resource quotas for pending services by combining pre-stored resource configuration information with dynamically determined load increments, which not only reduces the inaccurate judgment of cluster loads, but also improves This ensures the rationality and accuracy of the allocation of resource quotas, thereby ensuring the technical effects of the normal realization of various financial services.
  • Figure 1 is a schematic diagram of the architecture of the application system of the cluster resource quota allocation method provided by the embodiment of the present application.
  • the application system includes: a cluster 101, a database 102 and a client 103, and the cluster 101 can receive the client 103
  • the sent service processing request is then obtained from the database 102 to obtain pre-stored resource configuration information, combined with the newly obtained load increment to verify the resource quota of the service to be processed, obtain the verification result, and further process according to the verification result.
  • clients 103 there may be one or more clients 103, for example, they may be smart phones, tablets, personal computers, or wearable smart devices.
  • the cluster 101 may be an Hbase cluster, and the Hbase cluster is a distributed, scalable, high-availability, high-performance NoSQL database that can support random or real-time read and write functions of very large tables.
  • FIG. 2 is a schematic flowchart of a method for allocating cluster resource quotas provided by an embodiment of the present application.
  • the method of this embodiment may be executed by the cluster 101 .
  • the method of this embodiment may include:
  • S201 Receive a service processing request of a service to be processed sent by a client.
  • a user when a user wants to implement a financial service, he may send a service processing request corresponding to the service to be processed to the cluster through the client.
  • S202 Perform resource quota verification on the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result.
  • the latest load increment and pre-stored resource configuration information can be obtained, and the resource quota verification of the business to be processed can be performed according to the obtained latest load increment and pre-stored resource configuration information , get the verification result.
  • the pre-stored resource configuration information may include pre-configured overflow ratio information, resource quota (RNQ, Request Num Quota) allocated for each pending service, that is, the quota of the number of requests per unit time, and the time unit may be sec , min, hour, day, the number of requests is represented by req, such as 1000req/sec, 50000req/hour, the current load of the cluster and whether to retry the mark.
  • resource quota resource quota allocated for each pending service
  • the overflow ratio information can be customized and set according to the actual application scenario.
  • the overflow ratio information can dynamically handle business access emergencies. When cluster resources are available, the The resource quota of the resource reaches the limit and normal requests fail.
  • the configuration principle of allocating resource quotas for each pending business is to ensure that the sum of the RNQs of all pending businesses is less than or equal to the minimum guaranteed load of the cluster on the basis of meeting the business needs of each pending business. Overflow percentage/100+1)*RNQ The sum is less than or equal to the maximum achievable load.
  • the specific configuration strategy can be to use the existing stress test tool to stress test the cluster at the beginning of the cluster construction, and obtain the initial minimum load of the cluster (LowTPS, Low Transactions Per Second), and the maximum load of the cluster (UpTPS, Up Transactions Per Second ).
  • TPS Transactions Per Second, that is, the number of transactions executed per second, which is an important measure of cluster throughput
  • the TPS size of the service is set to the RNQ value of the service, and at the same time, it is necessary to ensure that the sum of the RNQ of each service is less than or equal to the minimum load of the cluster. If the sum of RNQ of the business is greater than the minimum load of the cluster, the cluster can be expanded to increase the minimum load of the cluster.
  • the TPS peak value excluding glitches can be set as the RNQ of the service, and if the TPS of the service has no glitches, the peak TPS of the service can be set as the RNQ of the service.
  • calculation method of overflow ratio information can be:
  • the glitch TPS of business 1 is MTPS1
  • the glitch TPS of business n is MTPSn
  • the overflow ratio information of business 1 is op1
  • opn MTPSn/sum(MTPS1....MTPSn)*sum(op1...opn).
  • each business and cluster can also continuously monitor each business and cluster, obtain the latest TPS of each business, the minimum load of the cluster, the highest load of the cluster, and the current load of the cluster, and draw an indicator map to provide data basis for the subsequent configuration of RNQ and overflow ratio information .
  • the current load of the cluster can be continuously monitored by the RegonServer service of the cluster, and the TotalRequestCount indicator of the Regionserver can be counted at a fixed interval (the default is 5 seconds).
  • the TotalRequestCount at time T is recorded as RequestCount(T)
  • the TotalRequestCount at time T1 is recorded as RequestCount(T1)
  • CurrentTPS (RequestCount(T1)- RequestCount(T))/(T1-T).
  • TotalRequestCount represents the total number of business requests processed. It is an indicator provided by the cluster itself, which can be obtained directly through existing functions, and is a dynamic indicator. Every time a request is processed, it will be increased by 1 on the basis of the original value. .
  • the CurrentTPS can be stored in the pre-stored resource configuration information, that is, the current load of the cluster in the pre-stored resource configuration information is updated.
  • the service processing request includes the load request amount, and the resource quota verification is performed on the pending business according to the latest load increment and pre-stored resource configuration information, and the verification result is obtained, which may specifically include:
  • the verification result is a verification failure.
  • the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  • the method may further include: judging whether the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information.
  • the step of acquiring the latest load increment is performed.
  • the summation result is not higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  • the service processing request may directly contain the service request amount, or may contain type identifiers representing different request types, and different type identifiers may correspond to different service request amounts.
  • the type identifiers can be Put, Get, Scan, and Mulit.
  • the service request amount corresponding to the Put type identifier is 1 time
  • the service request amount corresponding to the Get type identifier is 1 time
  • the service request amount corresponding to the Scan type identifier is 1 time.
  • the business request volume corresponding to the Mulit type identifier is the number of regions involved.
  • the summation result can have two cases, one case is that the summation result is less than or equal to the resource quota allocated in advance for the service to be processed, and the other case is that the summation result is greater than the resource quota allocated for the service to be processed.
  • the latest load increment it is also possible not to obtain the latest load increment first, but first to determine whether the summation result is higher than the resource quota allocated for the pending business in the pre-stored resource configuration information, if the summation result is less than or is equal to the resource quota allocated for the pending business in the pre-stored resource configuration information, then it can be determined that the verification result is verified, and the pending business can be processed subsequently according to the business processing request. If the summation result is greater than the resource quota allocated for the business to be processed, you can obtain the latest load increment determined by the load calculation dynamic module, and then judge whether the summation result is higher than the latest load increment and the pre-stored resource configuration information.
  • the sum of the resource quotas allocated by the pending business If the summation result is less than or equal to the sum of the latest load increment and the resource quota allocated for the pending business in the pre-stored resource configuration information, then the verification result is determined to be verified, and the pending business can be processed according to the business processing request. If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it can be directly determined that the verification result is a verification failure.
  • the acquisition of a new load increment can be triggered according to the preset load increment trigger rule.
  • the preset load increment trigger rule When the preset load increment trigger rule is reached, the newly acquired load increment is the latest load increment. If the load increment trigger rule is set, the load increment acquired last time is the latest load increment.
  • the latest load increment is 10
  • the resource quota allocated for this business is 100
  • the current request load is 9
  • the method may further include:
  • the maximum quota of the service to be processed is determined according to the overflow ratio information.
  • the overflow ratio information is included in the pre-stored resource configuration information.
  • you can also set a positive number as the overflow ratio information that is, when the overall resources of the cluster are sufficient, the actual request volume of the business can exceed the maximum percentage of the quota, and the default is 0 without overflow.
  • the summation result is greater than the maximum quota, if the summation result is less than or equal to the maximum quota, continue to obtain the latest load increment, and judge whether the summation result is higher than the latest load increment and the sum of the resource quota allocated for the service to be processed in the pre-stored resource configuration information. If the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  • the verification result is a verification failure. If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
  • the summation result is lower than the maximum quota, it is higher than the latest load increment and is pending
  • the sum of the resource quotas allocated by the business the verification result obtained is that the verification failed.
  • the load increment the number of resource quotas allocated for the pending business is increased, and the resource quota allocated for the pending business is also avoided. If the number is too large, it further improves the rationality of allocating resource quotas for pending services, and at the same time reduces the situation that all requests fail when a certain service requests a sudden increase due to an unforeseen unexpected situation. .
  • the verification result may include two situations, one is that the verification is passed, and the other is that the verification is not passed. If the verification result is verified as passed, it indicates that the current load of the cluster can serve the pending business. Therefore, the resource quota can be allocated for the pending business according to the business processing request, and the pending business can be processed according to the allocated resource quota. business processing results.
  • the pre-stored over-quota request processing rules may be obtained first, and then the pending business is processed according to the obtained over-quota request processing rules.
  • the pending business is processed according to the pre-stored over-quota request processing rules, which may specifically include:
  • the verification result is that the verification fails, it is judged whether the pre-stored resource configuration information includes a retry flag.
  • the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the service to be processed to a request queue.
  • a processing exception prompt is generated.
  • the existing quota current limiting logic simply compares the request concurrency with the quota, and discards requests larger than the quota and throws an exception.
  • the existing technology may It will cause data loss and affect data integrity.
  • a retry flag can be configured for the pending business to better maintain data integrity.
  • the service processing request of the pending service can be added to the request queue, and the cluster can subsequently process each service according to the order in which the service processing requests are added in the request queue.
  • Request to process pending business If the pre-stored resource configuration information does not include a retry flag, a processing exception prompt can be generated, that is, an exception is thrown to remind the operation and maintenance personnel to perform maintenance in time, and provide more operations and maintenance personnel when dealing with over-quota situations Select to ensure the normal realization of each business.
  • the service processing request of the pending business sent by the client can be received first, and then the resource quota verification of the pending business can be performed according to the latest load increment and pre-stored resource configuration information, and the verification result can be obtained.
  • the verification result is that the verification is passed
  • a resource quota is allocated to the pending business according to the business processing request, and then the pending business is processed according to the allocated resource quota to obtain a business processing result.
  • the pending service may be processed according to the pre-stored over-quota request processing rule.
  • resource quotas are allocated for pending services, which reduces inaccurate cluster load judgments and improves the rationality and accuracy of resource quota allocation. Thus ensuring the normal realization of various financial services.
  • obtaining the latest load increment may include:
  • the latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
  • the total processing time can be represented by TotalCallTime, which is the time for a request to be processed to be received and processed by the cluster, and this index can directly reflect the processing performance of the current Regionserver (that is, the cluster) service.
  • TotalCallTime QueueCallTime+ ProcessCallTime.
  • QueueCallTime is an indicator at the Regionserver level in the cluster. After the cluster receives the pending request from the client, it can put the pending request into the request queue first, and then a dedicated thread consumes the pending request from the queue and hands it over for processing. The thread performs processing, and the length of time a pending request waits in the queue is QueutCallTime.
  • ProcessCallTime is an indicator at the Regionserver level in the cluster. It refers to the time from when a pending request is consumed from the queue until the processing is completed. This indicator is a key indicator that reflects the processing efficiency of the cluster.
  • the processing time threshold can be represented by MaxCallTime, which is the maximum value of TotalCallTime that can be tolerated by the service set from the perspective of the service side.
  • MaxCallTime is the maximum value of TotalCallTime that can be tolerated by the service set from the perspective of the service side.
  • the query of the service to be processed can tolerate a maximum time-consuming of 0.5s (if the request cannot be processed within 0.5s, the service application will report an error), then MaxCallTime can be set to a value not greater than 0.5s.
  • the minimum load of the cluster obtain the minimum load of the cluster according to the preset acquisition rules, which can include:
  • the processing duration threshold, the total processing duration and the load at the target time are judged according to the preset minimum load judgment rule, and the minimum initial cluster load is determined.
  • the minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
  • the minimum cluster load can also be called LowTPS, which means the lower limit of TPS when TotalCallTime reaches MaxCallTime, that is, the TPS load that the current Regionserver service can provide when the performance is the worst.
  • Load indicates the number of transactions executed per second, which is an important measure of cluster throughput.
  • the RegionServer service can be continuously monitored, the TotalCallTime at the time t is CTt, and the TPS is TPSt, and then it can be calculated at a fixed time interval:
  • the time interval can be any value within 3-6 minutes.
  • the historical time period can be any value from 1-3 months.
  • the preset acquisition rules which can include:
  • the processing duration threshold, the total processing duration and the load at the target time are judged according to the preset highest load judgment rule, and the initial maximum load of the cluster is determined.
  • the maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
  • the highest cluster load can also be called UpTPS, indicating the TPS upper limit when TotalCallTime reaches MaxCallTime, that is, the TPS load that the current RegionServer service can provide when the performance is the best.
  • Load indicates the number of transactions executed per second, which is an important measure of cluster throughput.
  • the RegionServer service can be continuously monitored, the TotalCallTime at the time t is CTt, and the TPS is TPSt, and then it can be calculated at a fixed time interval:
  • the time interval can be any value within 3-6 minutes.
  • the historical time period can be any value from 1-3 months.
  • the current load of the cluster can be obtained directly from the pre-stored resource configuration information.
  • the current load of the cluster in the pre-stored resource configuration information is updated in real time.
  • the current load of the cluster can be accurately determined, and then provide a basis for whether the business can continue to increase and the increased business scale, which avoids waste of resources and overload
  • the running situation ensures the normal realization of various businesses.
  • the latest load increment can be determined, that is, according to the total processing time, the processing time threshold, the The minimum load of the cluster, the maximum load of the cluster, and the current load of the cluster in the pre-stored resource configuration information determine the latest load increment (also referred to as the acceptable load of the cluster), which may specifically include:
  • the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of .
  • the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information.
  • TotalCallTime MaxCallTime
  • CurrentTPS LowTPS-CurrentTPS
  • TotalCallTime ⁇ MaxCallTime and LowTPS ⁇ CurrentTPS ⁇ UpTPS it is determined that the Regionserver has an idle load, and the load that can be increased is UpTPS- Current TPS.
  • the update duration threshold may be any value in 3-6 minutes, and when the update duration threshold is reached, the rule for acquiring the latest load increment may be automatically triggered, and the latest load increment may be acquired.
  • the quantity threshold may be 10000, and when the number of business processing requests reaches 10000, the rule for acquiring the latest load increment may be automatically triggered, and the latest load increment may be acquired. At the same time, the number of business processing requests can be cleared and the calculation can be restarted from zero.
  • the load increment obtained in the previous acquisition may be used as the newly acquired load increment.
  • Fig. 3 is a schematic flowchart of a method for allocating cluster resource quotas provided by another embodiment of the present application.
  • the method may include: receiving pending requests of pending services, and then The request is parsed to determine the load request volume. After determining the load request amount, the summation result can be determined according to the cluster current load and the load request amount in the pre-stored resource configuration information, and judge whether the summation result exceeds the resource quota allocated for the business to be processed. If not, the pending request is processed. If yes, it is judged whether overflow ratio information is configured. If yes, determine the maximum quota according to the overflow ratio information, and judge whether the summation result exceeds the maximum quota.
  • the maximum quota is not exceeded, obtain the latest load increment, and judge whether the summation result exceeds the sum of the latest load increment and the resource quota allocated for the pending business, if not exceeding the latest load increment and the pending business
  • the sum of the resource quotas allocated by the business will process pending requests. If the sum of the latest load increment and the resource quota allocated for the pending business is exceeded, it will be determined whether to retry according to the pre-stored over-quota request processing rules. If it is retried, it will be added to the request queue again, otherwise, an exception will be thrown directly.
  • the overflow ratio information is not configured, it will be determined whether to retry according to the pre-stored over-quota request processing rules. If it is retried, it will re-join the request queue, otherwise, an exception will be thrown directly.
  • the latest load increment is determined to have two mechanisms to trigger recalculation.
  • the default timing calculation is 5 minutes, and a new round of calculation will be triggered after processing requests reach a certain amount (default 10000).
  • Figure 4 is a schematic structural diagram of the cluster resource quota allocation device provided by the embodiment of this application. As shown in Figure 4, the device provided by this embodiment can be include:
  • the receiving module 401 is configured to receive the service processing request of the service to be processed sent by the client.
  • the processing module 402 is configured to perform resource quota verification on the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result.
  • the service processing request includes a load request amount
  • the processing module 402 is further configured to:
  • the verification result is a verification failure.
  • processing module 402 is also used for:
  • the step of acquiring the latest load increment is performed.
  • processing module 402 is also used for:
  • the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  • processing module 402 is also used for:
  • the maximum quota of the service to be processed is determined according to the overflow ratio information.
  • the processing module 402 is further configured to allocate a resource quota for the service to be processed according to the service processing request if the verification result is passed, and process the service to be processed according to the allocated resource quota, Get the business processing result.
  • the processing module 402 is further configured to process the service to be processed according to a pre-stored over-quota request processing rule if the verification result is that the verification fails.
  • processing module 402 is further configured to:
  • the verification result is that the verification fails, it is judged whether the pre-stored resource configuration information includes a retry flag.
  • the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the service to be processed to a request queue.
  • a processing exception prompt is generated.
  • processing module 402 is further configured to:
  • processing module 402 is further configured to:
  • the processing duration threshold, the total processing duration and the load at the target time are judged according to the preset minimum load judgment rule, and the minimum initial cluster load is determined.
  • the minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
  • processing module 402 is also used for:
  • the processing duration threshold, the total processing duration and the load at the target time are judged according to the preset highest load judgment rule, and the initial maximum load of the cluster is determined.
  • the maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
  • the latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
  • processing module 402 is further configured to:
  • the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of .
  • the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information.
  • processing module 402 is also used for:
  • the device provided in the embodiment of the present application can implement the method in the above embodiment as shown in FIG. 2 , and its implementation principle and technical effect are similar, and will not be repeated here.
  • FIG. 5 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application.
  • a device 500 provided in this embodiment includes a processor 501 and a memory communicatively connected to the processor. Wherein, the processor 501 and the memory 502 are connected through a bus 503 .
  • the processor 501 executes the computer-executed instructions stored in the memory 502, so that the processor 501 executes the method for allocating cluster resource quotas in the foregoing method embodiments.
  • the processor may be a central processing unit (English: Central Processing Unit, referred to as: CPU), can also be other general-purpose processors, digital signal processors (English: Digital Signal Processor, referred to as: DSP), application-specific integrated circuits (English: Application Specific Integrated Circuit, referred to as: ASIC), etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in conjunction with the invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory.
  • the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Device Interconnect (Peripheral Component Interconnect, PCI) bus or Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus, etc.
  • ISA Industry Standard Architecture
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus and so on.
  • the buses in the drawings of the present application are not limited to only one bus or one type of bus.
  • the embodiment of the present application also provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, the cluster resource quota allocation method of the above method embodiment is implemented .
  • An embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, implements the cluster resource quota allocation method as described above.
  • the above-mentioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic Disk or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable Programmable Read Only Memory
  • EPROM Erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic Disk Magnetic Disk or Optical Disk.
  • Readable storage media can be any available media that can be accessed by a general purpose or special purpose computer.
  • An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium.
  • the readable storage medium can also be a component of the processor.
  • the processor and the readable storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC).
  • ASIC Application Specific Integrated Circuits
  • the processor and the readable storage medium can also exist in the device as discrete components.
  • the aforementioned program can be stored in a computer-readable storage medium.
  • the program executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

Provided in the embodiments of the present application are a cluster resource quota allocation method and apparatus, and an electronic device. The method comprises: receiving a service processing request, which is sent by a client for a service to be processed; performing resource quota verification on said service according to the latest load increment and pre-stored resource configuration information, so as to obtain a verification result; if the verification result is that the verification is passed, allocating a resource quota to said service according to the service processing request, and processing said service according to the allocated resource quota, so as to obtain a service processing result; and if the verification result is that the verification is not passed, processing said service according to a pre-stored over-quota request processing rule. By means of the present application, inaccurate determination of a cluster load is reduced, the rationality and accuracy of resource quota allocation are improved, and thus, the normal implementation of various financial services is ensured.

Description

集群资源配额分配方法、装置及电子设备Cluster resource quota allocation method, device and electronic equipment
本申请要求于2021年12月09日提交中国专利局、申请号为202111503812.4、申请名称为“集群资源配额分配方法、装置及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application with application number 202111503812.4 and titled "Cluster Resource Quota Allocation Method, Device, and Electronic Equipment" filed with the China Patent Office on December 09, 2021, the entire contents of which are hereby incorporated by reference In this application.
技术领域technical field
本申请实施例涉及大数据技术领域,尤其涉及一种集群资源配额分配方法、装置及电子设备。The embodiments of the present application relate to the technical field of big data, and in particular to a cluster resource quota allocation method, device and electronic equipment.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,大数据技术也不例外,但由于金融行业的安全性、实时性要求,也对大数据技术提出了更高的要求。为了满足各金融业务增长的需求,集群的应用变的越来越普遍。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming into financial technology (Fintech), and big data technology is no exception. However, due to the security and real-time requirements of the financial industry, It also puts forward higher requirements for big data technology. In order to meet the growing needs of various financial services, the application of clusters has become more and more common.
现有技术中,一个集群通常可以服务多个金融业务,然而,在集群服务多个金融业务时,可能会出现一个业务请求量突增并占用大量集群资源,而导致其它业务资源不足的情况。为了避免上述情况,可以给每个金融业务设置固定的资源配额,在处理各金融业务请求之前判定请求是否超过配额,超过配额则抛出异常。In the prior art, a cluster can usually serve multiple financial services. However, when a cluster serves multiple financial services, there may be a sudden increase in the request volume of one service and occupy a large amount of cluster resources, resulting in insufficient resources of other services. In order to avoid the above situation, it is possible to set a fixed resource quota for each financial business, and determine whether the request exceeds the quota before processing each financial business request, and throw an exception if the quota exceeds the quota.
然而,在配置固定的资源配额时,往往需要知道当前集群的负载与可承受的负载情况,在确定当前集群的负载与可承受的负载情况时,一般是根据集群搭建时的压力测试数据确定的,而集群处理业务请求的能力是动态变化的,最初的压力测试场景和实际生产场景很难一致,经常出现集群负载判断不准确的情况,降低了资源配额分配的准确性,进而影响了各金融业务的正常实现。However, when configuring a fixed resource quota, it is often necessary to know the current cluster load and the tolerable load. When determining the current cluster load and the tolerable load, it is generally determined based on the stress test data when the cluster is built. , while the ability of the cluster to process business requests is dynamically changing, the initial stress test scenario is difficult to be consistent with the actual production scenario, often inaccurate cluster load judgments reduce the accuracy of resource quota allocation, which in turn affects the normal operation of the business.
技术解决方案technical solution
本申请的目的在于提供一种集群资源配额分配方法、装置及电子设备,以提高资源配额分配的准确性。The purpose of the present application is to provide a cluster resource quota allocation method, device and electronic equipment, so as to improve the accuracy of resource quota allocation.
第一方面,本申请实施例提供一种集群资源配额分配方法,包括:In the first aspect, the embodiment of the present application provides a cluster resource quota allocation method, including:
接收客户端发送的待处理业务的业务处理请求;Receive the business processing request of the pending business sent by the client;
根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果;Verifying the resource quota of the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtaining a verification result;
若所述验证结果为验证通过,则根据所述业务处理请求为所述待处理业务分配资源配额,并根据分配的资源配额对所述待处理业务进行处理,得到业务处理结果;If the verification result is that the verification is passed, allocating a resource quota for the pending business according to the business processing request, and processing the pending business according to the allocated resource quota to obtain a business processing result;
若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理。If the verification result is that the verification fails, the pending service is processed according to the pre-stored over-quota request processing rule.
可选的,所述业务处理请求中包含负载请求量,所述根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果,包括:Optionally, the service processing request includes a load request amount, and the resource quota verification is performed on the service to be processed according to the latest load increment and pre-stored resource configuration information, and the verification result is obtained, including:
对所述预存的资源配置信息中的集群当前负载以及所述负载请求量进行求和处理,得到求和结果;summing the current cluster load and the load request in the pre-stored resource configuration information to obtain a summation result;
获取最新的负载增量;Get the latest load increment;
判断所述求和结果是否高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和;judging whether the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information;
若所述求和结果高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证未通过。If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the prestored resource configuration information, it is determined that the verification result is a verification failure.
可选的,在所述获取最新的负载增量的步骤之前,所述方法还包括:Optionally, before the step of obtaining the latest load increment, the method further includes:
判断所述求和结果是否高于所述预存的资源配置信息中为所述待处理业务分配的资源配额;judging whether the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information;
若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额,则执行所述获取最新的负载增量的步骤。If the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the step of acquiring the latest load increment is performed.
可选的,在所述若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额之后,还包括:Optionally, after said if the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the method further includes:
确定所述预存的资源配置信息中是否包含溢出比信息;Determine whether the pre-stored resource configuration information includes overflow ratio information;
若包含溢出比信息,则根据所述溢出比信息确定所述待处理业务的最高配额;If overflow ratio information is included, then determine the maximum quota of the service to be processed according to the overflow ratio information;
判断所述求和结果是否高于所述最高配额;Judging whether the summation result is higher than the maximum quota;
若所述求和结果不高于所述最高配额,则继续执行所述获取最新的负载增量及之后的步骤;If the summation result is not higher than the maximum quota, continue to perform the steps of obtaining the latest load increment and subsequent steps;
若所述求和结果高于所述最高配额,则确定所述验证结果为验证未通过。If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
可选的,所述获取最新的负载增量,包括:Optionally, the acquisition of the latest load increment includes:
按预设获取规则获取总处理时长、处理时长阈值、集群最低负载以及集群最高负载;Obtain the total processing time, processing time threshold, cluster minimum load, and cluster maximum load according to preset acquisition rules;
根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量。The latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
可选的,所述根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量,包括:Optionally, determining the latest load increment according to the total processing time, the processing time threshold, the minimum load of the cluster, the maximum load of the cluster, and the current load of the cluster in the pre-stored resource configuration information, include:
若所述总处理时长大于或等于所述处理时长阈值,则确定最新的负载增量为零;If the total processing time is greater than or equal to the processing time threshold, then determine that the latest load increment is zero;
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载小于所述集群最低负载,则确定最新的负载增量为所述集群最低负载与所述预存的资源配置信息中的集群当前负载之差;If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of ;
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最低负载,并小于所述集群最高负载,则确定最新的负载增量为所述集群最高负载与所述预存的资源配置信息中的集群当前负载之差;If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information;
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最高负载,则确定最新的负载增量为预设负载阈值。If the total processing duration is less than the processing duration threshold, and the current cluster load in the prestored resource configuration information is greater than the cluster maximum load, then determine that the latest load increment is the preset load threshold.
可选的,所述按预设获取规则获取集群最低负载,包括:Optionally, the acquisition of the minimum load of the cluster according to the preset acquisition rules includes:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量;Obtain the preset processing time threshold and the total processing time and load at the target moment;
根据预设的最低负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最低负载;Judging the processing duration threshold and the total processing duration and load at the target time according to the preset minimum load judgment rule, and determining the minimum initial cluster load;
获取预设历史时间段内的若干历史最低负载,并根据所述若干历史最低负载确定历史平均最低负载;Obtaining several historical minimum loads within a preset historical time period, and determining the historical average minimum load according to the several historical minimum loads;
将所述初始集群最低负载和所述历史平均最低负载中的最小值作为集群最低负载。The minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
可选的,所述按预设获取规则获取集群最高负载,包括:Optionally, the acquisition of the highest load of the cluster according to the preset acquisition rules includes:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量;Obtain the preset processing time threshold and the total processing time and load at the target moment;
根据预设的最高负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最高负载;Judging the processing duration threshold and the total processing duration and load at the target time according to the preset highest load judgment rule, and determining the initial cluster maximum load;
获取预设历史时间段内的若干历史最高负载,并根据所述若干历史最高负载确定历史平均最高负载;Obtaining several historical maximum loads within a preset historical time period, and determining the historical average maximum load according to the several historical maximum loads;
将所述初始集群最高负载和所述历史平均最高负载中的最大值作为集群最高负载。The maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
可选的,所述方法还包括:Optionally, the method also includes:
若所述求和结果不高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证通过。If the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
可选的,所述若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理,包括:Optionally, if the verification result is that the verification fails, processing the pending service according to the pre-stored over-quota request processing rules includes:
若所述验证结果为验证未通过,则判断所述预存的资源配置信息中是否包含重试标识;If the verification result is that the verification fails, then judging whether the pre-stored resource configuration information includes a retry flag;
若所述预存的资源配置信息中包含重试标识,则将所述待处理业务的业务处理请求添加至请求队列中;If the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the pending service to a request queue;
若所述预存的资源配置信息中不包含重试标识,则生成处理异常提示。If the pre-stored resource configuration information does not include a retry identifier, a processing exception prompt is generated.
可选的,在所述获取最新的负载增量之前,还包括:Optionally, before acquiring the latest load increment, further include:
判断是否达到预设的更新时长阈值;Determine whether the preset update duration threshold is reached;
若达到所述更新时长阈值,则获取最新的负载增量;If the update duration threshold is reached, the latest load increment is obtained;
或者,判断业务处理请求的总处理数量是否达到预设的数量阈值;Alternatively, it is judged whether the total processing quantity of business processing requests reaches a preset quantity threshold;
若达到所述数量阈值,则获取最新的负载增量。If the quantity threshold is reached, the latest load increment is obtained.
第二方面,本申请实施例提供一种集群资源配额分配装置,包括:In the second aspect, the embodiment of the present application provides a cluster resource quota allocation device, including:
接收模块,用于接收客户端发送的待处理业务的业务处理请求;The receiving module is used to receive the service processing request of the pending service sent by the client;
处理模块,用于根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果;A processing module, configured to verify the resource quota of the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result;
所述处理模块,还用于若所述验证结果为验证通过,则根据所述业务处理请求为所述待处理业务分配资源配额,并根据分配的资源配额对所述待处理业务进行处理,得到业务处理结果;The processing module is further configured to allocate a resource quota for the service to be processed according to the service processing request if the verification result is passed, and process the service to be processed according to the allocated resource quota to obtain Business processing results;
所述处理模块,还用于若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理。The processing module is further configured to process the service to be processed according to a pre-stored over-quota request processing rule if the verification result is that the verification fails.
第三方面,本申请实施例提供一种电子设备,包括:处理器,以及与所述处理器通信连接的存储器;In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
所述存储器存储计算机执行指令;the memory stores computer-executable instructions;
所述处理器执行所述存储器存储的计算机执行指令,实现如上第一方面以及第一方面各种可能的设计所述的集群资源配额分配方法。The processor executes the computer-executed instructions stored in the memory to implement the cluster resource quota allocation method described in the first aspect and various possible designs of the first aspect.
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现如上第一方面以及第一方面各种可能的设计所述的集群资源配额分配方法。In the fourth aspect, the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the above first aspect and the first Aspects of various possible designs of the cluster resource quota allocation method.
第五方面,本申请实施例提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时,实现如上第一方面以及第一方面各种可能的设计所述的集群资源配额分配方法。In the fifth aspect, the embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the cluster resource quota allocation described in the above first aspect and various possible designs of the first aspect is realized. method.
本申请实施例提供了一种集群资源配额分配方法、装置及电子设备,采用上述方案后,可以先接收客户端发送的待处理业务的业务处理请求,然后根据最新的负载增量和预存的资源配置信息对待处理业务进行资源配额验证,得到验证结果。在一种实现方式中,若验证结果为验证通过,则根据业务处理请求为待处理业务分配资源配额,然后根据分配的资源配额对待处理业务进行处理,得到业务处理结果。在另一种实现方式中,若验证结果为验证未通过,则可以根据预存的超配额请求处理规则对待处理业务进行处理。通过将预存的资源配置信息与动态确定的负载增量相结合的方式来为待处理业务进行资源配额分配,减少了集群负载判断不准确的情况,提高了资源配额分配的合理性与准确性,进而保证了各金融业务的正常实现。The embodiment of the present application provides a cluster resource quota allocation method, device, and electronic equipment. After adopting the above scheme, the service processing request of the pending business sent by the client can be received first, and then according to the latest load increment and the pre-stored resource The configuration information is verified by the resource quota of the business to be processed, and the verification result is obtained. In one implementation manner, if the verification result is that the verification is passed, a resource quota is allocated to the pending business according to the business processing request, and then the pending business is processed according to the allocated resource quota to obtain a business processing result. In another implementation manner, if the verification result is that the verification fails, the pending service may be processed according to the pre-stored over-quota request processing rule. By combining pre-stored resource configuration information with dynamically determined load increments, resource quotas are allocated for pending services, which reduces inaccurate cluster load judgments and improves the rationality and accuracy of resource quota allocation. Thus ensuring the normal realization of various financial services.
附图说明Description of drawings
图1为本申请实施例提供的集群资源配额分配方法的应用系统的架构示意图;FIG. 1 is a schematic diagram of the architecture of the application system of the cluster resource quota allocation method provided by the embodiment of the present application;
图2为本申请实施例提供的集群资源配额分配方法的流程示意图;FIG. 2 is a schematic flowchart of a method for allocating cluster resource quotas provided by an embodiment of the present application;
图3为本申请另一实施例提供的集群资源配额分配方法的流程示意图;FIG. 3 is a schematic flowchart of a cluster resource quota allocation method provided by another embodiment of the present application;
图4为本申请实施例提供的集群资源配额分配装置的结构示意图;FIG. 4 is a schematic structural diagram of a cluster resource quota allocation device provided by an embodiment of the present application;
图5为本申请实施例提供的电子设备的硬件结构示意图。FIG. 5 is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
本发明的实施方式Embodiments of the present invention
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例还能够包括除了图示或描述的那些实例以外的其他顺序实例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the above drawings are used to distinguish similar objects and not necessarily Describe a specific order or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are also capable of other sequential instances than those illustrated or described. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
现有技术中,金融业务可以为转账、贷款、贷款额度调整、余额查询等,每个金融业务都需要通过分配的资源配额来实现,且现有技术中一般为每个金融业务分配固定的资源配额。在为各金融业务配置固定的资源配额时,往往需要知道当前集群的负载与可承受的负载情况,在确定当前集群的负载与可承受的负载情况时,一般是根据集群搭建时的压力测试数据确定的,而集群处理业务请求的能力是动态变化的,最初的压力测试场景和实际生产场景很难一致,经常出现集群负载判断不准确的情况,降低了资源配额分配的准确性。此外,在多金融业务场景下,业务请求量往往是一个波动的曲线,业务波峰波谷出现的时间是可以根据业务场景预测的,为了有效的利用集群资源,会将请求高峰分散开的业务共用同一套集群,将请求峰值设置成配额。所以对请求峰值的判定比较重要,该峰值往往依赖运维人员的经验和历史数据,但是当某个业务因为预测之外的突发状况导致业务请求量突增(例如,主机故障导致的集群主备切换等)时,会导致当前的限流逻辑下突增的请求全部请求失败的情况,影响了各金融业务的正常实现。In the existing technology, financial services can be transfer, loan, loan amount adjustment, balance inquiry, etc. Each financial service needs to be realized through the allocated resource quota, and in the prior art, fixed resources are generally allocated to each financial service quota. When configuring fixed resource quotas for various financial services, it is often necessary to know the current cluster load and the tolerable load. When determining the current cluster load and tolerable load, it is generally based on the stress test data when the cluster is built Certainly, but the ability of the cluster to process business requests changes dynamically. It is difficult to be consistent between the initial stress test scenario and the actual production scenario. Inaccurate cluster load judgments often occur, which reduces the accuracy of resource quota allocation. In addition, in multi-financial business scenarios, the volume of business requests is often a fluctuating curve, and the time when business peaks and troughs appear can be predicted according to the business scenario. Set a cluster and set the peak request as a quota. Therefore, it is more important to determine the peak value of requests. The peak value often depends on the experience and historical data of the operation and maintenance personnel. In the event of standby switching, etc.), it will lead to the failure of all the sudden requests under the current current limiting logic, which affects the normal realization of various financial services.
基于上述技术问题,本申请通过将预存的资源配置信息与动态确定的负载增量相结合的方式来为待处理业务进行资源配额分配,达到了既减少了集群负载判断不准确的情况,又提高了资源配额分配的合理性与准确性,进而保证了各金融业务的正常实现的技术效果。Based on the above technical problems, this application allocates resource quotas for pending services by combining pre-stored resource configuration information with dynamically determined load increments, which not only reduces the inaccurate judgment of cluster loads, but also improves This ensures the rationality and accuracy of the allocation of resource quotas, thereby ensuring the technical effects of the normal realization of various financial services.
图1为本申请实施例提供的集群资源配额分配方法的应用系统的架构示意图,如图1所示,所述应用系统包括:集群101、数据库102和客户端103,集群101可以接收客户端103发送的业务处理请求,然后从数据库102中获取预存的资源配置信息,再结合新获取的负载增量对待处理业务进行资源配额验证,得到验证结果,并根据验证结果进一步进行处理。Figure 1 is a schematic diagram of the architecture of the application system of the cluster resource quota allocation method provided by the embodiment of the present application. As shown in Figure 1, the application system includes: a cluster 101, a database 102 and a client 103, and the cluster 101 can receive the client 103 The sent service processing request is then obtained from the database 102 to obtain pre-stored resource configuration information, combined with the newly obtained load increment to verify the resource quota of the service to be processed, obtain the verification result, and further process according to the verification result.
其中,客户端103可以有一个或多个,示例性的,可以为智能手机、平板、个人电脑或者可穿戴智能设备等。Among them, there may be one or more clients 103, for example, they may be smart phones, tablets, personal computers, or wearable smart devices.
集群101可以为Hbase集群,Hbase集群为一个分布式,可伸缩,高可用,高性能的NoSQL数据库,可以支持超大型表的随机或者实时的读与写功能。 The cluster 101 may be an Hbase cluster, and the Hbase cluster is a distributed, scalable, high-availability, high-performance NoSQL database that can support random or real-time read and write functions of very large tables.
下面以具体地实施例对本申请的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solution of the present application will be described in detail below with specific embodiments. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
图2为本申请实施例提供的集群资源配额分配方法的流程示意图,本实施例的方法可以由集群101执行。如图2所示,本实施例的方法,可以包括:FIG. 2 is a schematic flowchart of a method for allocating cluster resource quotas provided by an embodiment of the present application. The method of this embodiment may be executed by the cluster 101 . As shown in Figure 2, the method of this embodiment may include:
S201:接收客户端发送的待处理业务的业务处理请求。S201: Receive a service processing request of a service to be processed sent by a client.
在本实施例中,用户在想实现金融业务时,可以通过客户端向集群发送待处理业务对应的业务处理请求。In this embodiment, when a user wants to implement a financial service, he may send a service processing request corresponding to the service to be processed to the cluster through the client.
S202:根据最新的负载增量和预存的资源配置信息对待处理业务进行资源配额验证,得到验证结果。S202: Perform resource quota verification on the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result.
在本实施例中,在接收到业务处理请求之后,可以获取最新的负载增量和预存的资源配置信息,并根据获取的最新的负载增量和预存的资源配置信息对待处理业务进行资源配额验证,得到验证结果。In this embodiment, after receiving the business processing request, the latest load increment and pre-stored resource configuration information can be obtained, and the resource quota verification of the business to be processed can be performed according to the obtained latest load increment and pre-stored resource configuration information , get the verification result.
其中,预存的资源配置信息中可以包含预先配置的溢出比信息、为每个待处理业务分配的资源配额(RNQ,Request Num Quota),即在单位时间内请求次数的配额,时间单位可以是sec、min、hour、day,请求次数使用req表示,例如1000req/sec、50000req/hour,集群当前负载以及是否重试标记。Among them, the pre-stored resource configuration information may include pre-configured overflow ratio information, resource quota (RNQ, Request Num Quota) allocated for each pending service, that is, the quota of the number of requests per unit time, and the time unit may be sec , min, hour, day, the number of requests is represented by req, such as 1000req/sec, 50000req/hour, the current load of the cluster and whether to retry the mark.
具体的,溢出比信息可以根据实际应用场景自定义进行设置,具体设置方式参照下文的计算方式,通过溢出比信息可以动态的处理业务访问突发问题,当集群资源可用时,不会因为业务应用的资源配额达到限制而使得正常的请求失败。Specifically, the overflow ratio information can be customized and set according to the actual application scenario. For the specific setting method, refer to the calculation method below. The overflow ratio information can dynamically handle business access emergencies. When cluster resources are available, the The resource quota of the resource reaches the limit and normal requests fail.
为每个待处理业务分配资源配额的配置原则为在满足各待处理业务的业务需求的基础上,保证所有待处理业务的RNQ之和小于或等于集群最低保证负载,所有待处理业务的 (配额溢出百分比/100+1)*RNQ 之和小于或等于最高可达负载。其中,配置策略具体可以为集群搭建之初使用现有的压力测试工具对集群进行压力测试,得到集群初始的集群最低负载(LowTPS,Low Transactions Per Second),集群最高负载(UpTPS,Up Transactions Per Second)。在各业务上线时,运维人员可以根据业务系统的业务量评估出业务的TPS(Transactions Per Second,即每秒钟执行的事务数量,是集群吞吐量的重要衡量标准)大小,并将评估出的TPS大小设置为该业务的RNQ值,同时要保证各业务的RNQ之和小于或等于集群最低负载。如果业务的RNQ之和大于集群最低负载,可以对集群进行扩容来提高集群最低负载。对应的,若业务的TPS中包含毛刺,可以将排除毛刺的TPS峰值设置为该业务的RNQ,若业务TPS无毛刺,则可以将业务峰值TPS设置为该业务的RNQ。The configuration principle of allocating resource quotas for each pending business is to ensure that the sum of the RNQs of all pending businesses is less than or equal to the minimum guaranteed load of the cluster on the basis of meeting the business needs of each pending business. Overflow percentage/100+1)*RNQ The sum is less than or equal to the maximum achievable load. Among them, the specific configuration strategy can be to use the existing stress test tool to stress test the cluster at the beginning of the cluster construction, and obtain the initial minimum load of the cluster (LowTPS, Low Transactions Per Second), and the maximum load of the cluster (UpTPS, Up Transactions Per Second ). When each business goes online, the operation and maintenance personnel can evaluate the TPS (Transactions Per Second, that is, the number of transactions executed per second, which is an important measure of cluster throughput) of the business according to the business volume of the business system, and will evaluate the The TPS size of the service is set to the RNQ value of the service, and at the same time, it is necessary to ensure that the sum of the RNQ of each service is less than or equal to the minimum load of the cluster. If the sum of RNQ of the business is greater than the minimum load of the cluster, the cluster can be expanded to increase the minimum load of the cluster. Correspondingly, if the TPS of the service contains glitches, the TPS peak value excluding glitches can be set as the RNQ of the service, and if the TPS of the service has no glitches, the peak TPS of the service can be set as the RNQ of the service.
此外,溢出比信息的计算方式可以为:In addition, the calculation method of overflow ratio information can be:
业务1的毛刺TPS为MTPS1,业务n的毛刺TPS为MTPSn,业务1的溢出比信息为op1,业务n的溢出比信息为opn,则(SUM(MTPS1….MTPSn)/RNQ-1)*100=sum(op1……opn)。The glitch TPS of business 1 is MTPS1, the glitch TPS of business n is MTPSn, the overflow ratio information of business 1 is op1, and the overflow ratio information of business n is opn, then (SUM(MTPS1....MTPSn)/RNQ-1)*100 =sum(op1...opn).
opn = MTPSn/sum(MTPS1….MTPSn)* sum(op1……opn)。opn = MTPSn/sum(MTPS1....MTPSn)*sum(op1...opn).
另外,还可以持续对各业务与集群进行监控,获取最新的各业务的TPS、集群最低负载、集群最高负载以及集群当前负载,并绘制指标图,为后续RNQ和溢出比信息的配置提供数据依据。In addition, it can also continuously monitor each business and cluster, obtain the latest TPS of each business, the minimum load of the cluster, the highest load of the cluster, and the current load of the cluster, and draw an indicator map to provide data basis for the subsequent configuration of RNQ and overflow ratio information .
集群当前负载(CTPS,CurrentTPS)可以通过对集群的RegonServer服务持续进行监控,以固定的时间间隔(默认为5秒钟) 对Regionserver的TotalRequestCount指标进行统计。示例性的,T时刻的TotalRequestCount记为RequestCount(T),T1时刻的TotalRequestCount记为RequestCount(T1),则CurrentTPS=(RequestCount(T1)- RequestCount(T))/(T1-T)。其中,TotalRequestCount表示处理的业务请求的总数量,是集群本身提供的一个指标,可以通过现有的函数直接获取,且为一个动态指标,每处理一个请求,则会在原值的基础上增加1。在得到CurrentTPS之后,可以将CurrentTPS存储至预存的资源配置信息中,即对预存的资源配置信息中的集群当前负载进行更新。The current load of the cluster (CTPS, CurrentTPS) can be continuously monitored by the RegonServer service of the cluster, and the TotalRequestCount indicator of the Regionserver can be counted at a fixed interval (the default is 5 seconds). Exemplarily, the TotalRequestCount at time T is recorded as RequestCount(T), and the TotalRequestCount at time T1 is recorded as RequestCount(T1), then CurrentTPS=(RequestCount(T1)- RequestCount(T))/(T1-T). Among them, TotalRequestCount represents the total number of business requests processed. It is an indicator provided by the cluster itself, which can be obtained directly through existing functions, and is a dynamic indicator. Every time a request is processed, it will be increased by 1 on the basis of the original value. . After the CurrentTPS is obtained, the CurrentTPS can be stored in the pre-stored resource configuration information, that is, the current load of the cluster in the pre-stored resource configuration information is updated.
进一步的,所述业务处理请求中包含负载请求量,根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果,具体可以包括:Further, the service processing request includes the load request amount, and the resource quota verification is performed on the pending business according to the latest load increment and pre-stored resource configuration information, and the verification result is obtained, which may specifically include:
对所述预存的资源配置信息中的集群当前负载以及所述负载请求量进行求和处理,得到求和结果。Summing the current load of the cluster in the pre-stored resource configuration information and the load request amount is performed to obtain a summing result.
获取最新的负载增量。Get the latest load delta.
判断所述求和结果是否高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和。Judging whether the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information.
若所述求和结果高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证未通过。If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the prestored resource configuration information, it is determined that the verification result is a verification failure.
此外,若求和结果不高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证通过。In addition, if the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
此外,在获取最新的负载增量的步骤之前,所述方法还可以包括:判断所述求和结果是否高于所述预存的资源配置信息中为所述待处理业务分配的资源配额。In addition, before the step of acquiring the latest load increment, the method may further include: judging whether the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information.
若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额,则执行所述获取最新的负载增量的步骤。If the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the step of acquiring the latest load increment is performed.
另外,若求和结果不高于所述预存的资源配置信息中为所述待处理业务分配的资源配额,则确定所述验证结果为验证通过。In addition, if the summation result is not higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
具体的,业务处理请求中可以直接包含业务请求量,也可以包含表示不同请求类型的类型标识,不同的类型标识可以对应不同的业务请求量。示例性的,类型标识可以为Put、Get、Scan和Mulit,Put类型标识对应的业务请求量为1次,Get类型标识对应的业务请求量为1次,Scan类型标识对应的业务请求量为1次,Mulit类型标识对应的业务请求量为涉及到的region个数。Specifically, the service processing request may directly contain the service request amount, or may contain type identifiers representing different request types, and different type identifiers may correspond to different service request amounts. Exemplarily, the type identifiers can be Put, Get, Scan, and Mulit. The service request amount corresponding to the Put type identifier is 1 time, the service request amount corresponding to the Get type identifier is 1 time, and the service request amount corresponding to the Scan type identifier is 1 time. Second, the business request volume corresponding to the Mulit type identifier is the number of regions involved.
在得到负载请求量和集群当前负载时,可以先对集群当前负载与负载请求量进行求和处理,得到求和结果。求和结果可以有两种情况,一种情况为求和结果小于或等于预先为待处理业务分配的资源配额,另一种情况为求和结果大于为待处理业务分配的资源配额。在得到求和结果之后,可以直接获取最新的负载增量,然后判断求和结果是否高于最新的负载增量与预存的资源配置信息中为待处理业务分配的资源配额之和,即可以每次都先获取最新的负载增量,然后直接判断求和结果与最新的负载增量与为待处理业务分配的资源配额之和之间的关系,并根据判断结果进一步进行处理。When obtaining the load request amount and the current load of the cluster, the current load of the cluster and the load request amount can be summed first to obtain the summation result. The summation result can have two cases, one case is that the summation result is less than or equal to the resource quota allocated in advance for the service to be processed, and the other case is that the summation result is greater than the resource quota allocated for the service to be processed. After obtaining the summation result, you can directly obtain the latest load increment, and then judge whether the summation result is higher than the sum of the latest load increment and the resource quota allocated for the pending business in the pre-stored resource configuration information, that is, you can Each time, the latest load increment is obtained first, and then the relationship between the summation result and the sum of the latest load increment and the resource quota allocated for the business to be processed is directly judged, and further processing is performed according to the judgment result.
此外,在得到求和结果之后,也可以先不获取最新的负载增量,而是先判断求和结果是否高于预存的资源配置信息中为待处理业务分配的资源配额,若求和结果小于或等于预存的资源配置信息中为待处理业务分配的资源配额,则可以确定验证结果为验证通过,后续可以根据业务处理请求对待处理业务进行处理。若求和结果大于为待处理业务分配的资源配额,即可以获取负载计算动态模块确定的最新的负载增量,然后判断求和结果是否高于最新的负载增量与预存的资源配置信息中为待处理业务分配的资源配额之和。若求和结果小于或等于最新的负载增量与预存的资源配置信息中为待处理业务分配的资源配额之和,则确定验证结果为验证通过,后续可以根据业务处理请求对待处理业务进行处理。若求和结果高于最新的负载增量与预存的资源配置信息中为待处理业务分配的资源配额之和,则可以直接确定验证结果为验证未通过。In addition, after obtaining the summation result, it is also possible not to obtain the latest load increment first, but first to determine whether the summation result is higher than the resource quota allocated for the pending business in the pre-stored resource configuration information, if the summation result is less than or is equal to the resource quota allocated for the pending business in the pre-stored resource configuration information, then it can be determined that the verification result is verified, and the pending business can be processed subsequently according to the business processing request. If the summation result is greater than the resource quota allocated for the business to be processed, you can obtain the latest load increment determined by the load calculation dynamic module, and then judge whether the summation result is higher than the latest load increment and the pre-stored resource configuration information. The sum of the resource quotas allocated by the pending business. If the summation result is less than or equal to the sum of the latest load increment and the resource quota allocated for the pending business in the pre-stored resource configuration information, then the verification result is determined to be verified, and the pending business can be processed according to the business processing request. If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it can be directly determined that the verification result is a verification failure.
其中,可以根据预设的负载增量触发规则触发获取新的负载增量,当达到预设的负载增量触发规则时,新获取的负载增量即为最新的负载增量,若没有达到预设的负载增量触发规则,则最近一次获取的负载增量即为最新的负载增量。Among them, the acquisition of a new load increment can be triggered according to the preset load increment trigger rule. When the preset load increment trigger rule is reached, the newly acquired load increment is the latest load increment. If the load increment trigger rule is set, the load increment acquired last time is the latest load increment.
示例性的,最新的负载增量为10,为该业务分配的资源配额为100,则最新的负载增量与为待处理业务分配的资源配额之和为100+10=110,若当前请求负载量为11,则求和结果为100+11=111,高于最新的负载增量与为待处理业务分配的资源配额之和,得到的验证结果为验证未通过。若当前请求负载量为9,则求和结果为100+9=109,低于最新的负载增量与为待处理业务分配的资源配额之和,得到的验证结果为验证通过,通过设置最新的负载增量的方式,结合最新的负载增量,实现了资源配额的动态准确分配,提高了为待处理业务分配资源配额数量的合理性,进而保证了各业务的正常实现。Exemplarily, the latest load increment is 10, and the resource quota allocated for this business is 100, then the sum of the latest load increment and the resource quota allocated for the pending business is 100+10=110, if the current request load If the amount is 11, the sum result is 100+11=111, which is higher than the sum of the latest load increment and the resource quota allocated for the pending business, and the verification result is that the verification fails. If the current request load is 9, the sum result is 100+9=109, which is lower than the sum of the latest load increment and the resource quota allocated for the business to be processed, and the verification result obtained is verification passed. By setting the latest The method of load increment, combined with the latest load increment, realizes the dynamic and accurate allocation of resource quotas, improves the rationality of allocating resource quotas for pending businesses, and thus ensures the normal realization of each business.
此外,在若求和结果高于预存的资源配置信息中为所述待处理业务分配的资源配额之后,所述方法还可以包括:In addition, after the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the method may further include:
确定所述预存的资源配置信息中是否包含溢出比信息。Determine whether the prestored resource configuration information includes overflow ratio information.
若包含溢出比信息,则根据所述溢出比信息确定所述待处理业务的最高配额。If overflow ratio information is included, the maximum quota of the service to be processed is determined according to the overflow ratio information.
判断所述求和结果是否高于所述最高配额。It is judged whether the summation result is higher than the maximum quota.
若所述求和结果不高于所述最高配额,则继续执行所述获取最新的负载增量及之后的步骤。If the summation result is not higher than the maximum quota, continue to perform the steps of obtaining the latest load increment and subsequent steps.
若求和结果高于所述最高配额,则确定所述验证结果为验证未通过。If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
具体的,在确定求和结果高于预存的资源配置信息中为待处理业务分配的资源配额之后,可以先判断预存的资源配置信息中是否包含了溢出比信息。在为各业务设定资源配额时,还可以设置一个正数作为溢出比信息,即当集群整体资源充足时业务的实际请求量可以超出配额的最大百分比,默认为0无溢出。可以根据溢出比信息确定为待处理业务分配的最高配额,即允许的最大请求量=(配额溢出百分比/100+1)*为待处理业务分配的资源配额。在确定最高配额之后,可以判断求和结果是否大于最高配额,若求和结果小于或等于最高配额,则继续执行获取最新的负载增量,判断求和结果是否高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和。若所述求和结果不高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证通过。若所述求和结果高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证未通过。若求和结果高于最高配额,则确定验证结果为验证未通过。Specifically, after it is determined that the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it may first be determined whether the overflow ratio information is included in the pre-stored resource configuration information. When setting resource quotas for each business, you can also set a positive number as the overflow ratio information, that is, when the overall resources of the cluster are sufficient, the actual request volume of the business can exceed the maximum percentage of the quota, and the default is 0 without overflow. The maximum quota allocated for the pending business can be determined according to the overflow ratio information, that is, the maximum allowed request amount=(quota overflow percentage/100+1)*resource quota allocated for the pending business. After determining the maximum quota, it can be judged whether the summation result is greater than the maximum quota, if the summation result is less than or equal to the maximum quota, continue to obtain the latest load increment, and judge whether the summation result is higher than the latest load increment and the sum of the resource quota allocated for the service to be processed in the pre-stored resource configuration information. If the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification. If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the prestored resource configuration information, it is determined that the verification result is a verification failure. If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
示例性的,最高配额可以为120,最新的负载增量为10,为该业务分配的资源配额为100,则最新的负载增量与为待处理业务分配的资源配额之和为100+10=110,若当前请求负载量为9,则求和结果为100+9=109,则可以得到验证结果为验证通过,通过先将求和结果与最高配额进行比较,在求和结果小于最高配置时,再将求和结果与最新的负载增量与为待处理业务分配的资源配额之和进行比较,通过二次比较的方式,提高了为待处理业务分配资源配额数量的合理性。Exemplarily, the highest quota can be 120, the latest load increment is 10, and the resource quota allocated for this business is 100, then the sum of the latest load increment and the resource quota allocated for the pending business is 100+10= 110. If the current request load is 9, the summation result is 100+9=109, and the verification result can be obtained as verification passed. By comparing the summation result with the maximum quota, when the summation result is less than the maximum configuration , and then compare the summation result with the latest load increment and the sum of the resource quota allocated for the pending business, and improve the rationality of allocating the resource quota for the pending business through the second comparison.
另外,当前请求负载量还可以为11,则求和结果为100+11=111,在该情况下,虽然求和结果比最高配额要低,但是却高于最新的负载增量与为待处理业务分配的资源配额之和,得到的验证结果为验证未通过,通过负载增量的设置,既增加了为待处理业务分配的资源配额的数量,也避免了为待处理业务分配的资源配额的数量过多的情况,进一步提高了为待处理业务分配资源配额数量的合理性,同时降低了当某个业务因为预测之外的突发状况导致业务请求量突增时,使得请求全部失败的情况。In addition, the current request load can also be 11, and the summation result is 100+11=111. In this case, although the summation result is lower than the maximum quota, it is higher than the latest load increment and is pending The sum of the resource quotas allocated by the business, the verification result obtained is that the verification failed. Through the setting of the load increment, the number of resource quotas allocated for the pending business is increased, and the resource quota allocated for the pending business is also avoided. If the number is too large, it further improves the rationality of allocating resource quotas for pending services, and at the same time reduces the situation that all requests fail when a certain service requests a sudden increase due to an unforeseen unexpected situation. .
S203:若验证结果为验证通过,则根据业务处理请求为待处理业务分配资源配额,并根据分配的资源配额对待处理业务进行处理,得到业务处理结果。S203: If the verification result is that the verification is passed, allocate a resource quota for the business to be processed according to the business processing request, process the business to be processed according to the allocated resource quota, and obtain a business processing result.
在本实施例中,验证结果可以包括两种情况,一种为验证通过,另一种为验证未通过。若验证结果为验证通过,表明集群当前的负载情况可以为该待处理业务进行服务,因此,可以根据业务处理请求为待处理业务分配资源配额,并根据分配的资源配额对待处理业务进行处理,得到业务处理结果。In this embodiment, the verification result may include two situations, one is that the verification is passed, and the other is that the verification is not passed. If the verification result is verified as passed, it indicates that the current load of the cluster can serve the pending business. Therefore, the resource quota can be allocated for the pending business according to the business processing request, and the pending business can be processed according to the allocated resource quota. business processing results.
S204:若验证结果为验证未通过,则根据预存的超配额请求处理规则对待处理业务进行处理。S204: If the verification result is that the verification fails, process the pending business according to the pre-stored over-quota request processing rules.
在本实施例中,若验证结果为验证未通过,则可以先获取预存的超配额请求处理规则,然后根据获取的超配额请求处理规则对待处理业务进行处理。In this embodiment, if the verification result is that the verification fails, the pre-stored over-quota request processing rules may be obtained first, and then the pending business is processed according to the obtained over-quota request processing rules.
进一步的,若验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理,具体可以包括:Further, if the verification result is that the verification fails, the pending business is processed according to the pre-stored over-quota request processing rules, which may specifically include:
若所述验证结果为验证未通过,则判断所述预存的资源配置信息中是否包含重试标识。If the verification result is that the verification fails, it is judged whether the pre-stored resource configuration information includes a retry flag.
若所述预存的资源配置信息中包含重试标识,则将所述待处理业务的业务处理请求添加至请求队列中。If the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the service to be processed to a request queue.
若所述预存的资源配置信息中不包含重试标识,则生成处理异常提示。If the pre-stored resource configuration information does not include a retry identifier, a processing exception prompt is generated.
具体的,现有的配额限流逻辑单纯的将请求并发与配额进行比较,大于配额的请求丢弃并抛出异常,对于在超过配额时可以延迟写入但不允许丢弃的场景,现有技术可能会造成数据的丢失,影响数据的完整性。而本申请可以预先为该待处理业务是否需要重试进行配置,并存储于资源配置信息。其中,针对数据一致性要求高,不允许数据写入失败的场景,可以为该待处理业务配置重试标识,以更好的保持数据的完整性。Specifically, the existing quota current limiting logic simply compares the request concurrency with the quota, and discards requests larger than the quota and throws an exception. For scenarios where writing can be delayed but discarding is not allowed when the quota is exceeded, the existing technology may It will cause data loss and affect data integrity. However, in this application, it is possible to pre-configure whether the service to be processed needs to be retried, and store it in the resource configuration information. Among them, for scenarios where data consistency requirements are high and data writing failure is not allowed, a retry flag can be configured for the pending business to better maintain data integrity.
对应的,若预存的资源配置信息中包含重试标识,则可以将待处理业务的业务处理请求添加至请求队列中,集群后续可以根据请求队列中各业务处理请求的添加顺序依次根据各业务处理请求对待处理业务进行处理。若预存的资源配置信息中农工不包含重试标识,则可以生成处理异常提示,即抛出异常,提醒运维人员及时进行维护,且给运维人员在处理超配额情形时提供了更多的选择,以保证各业务的正常实现。Correspondingly, if the pre-stored resource configuration information contains a retry flag, the service processing request of the pending service can be added to the request queue, and the cluster can subsequently process each service according to the order in which the service processing requests are added in the request queue. Request to process pending business. If the pre-stored resource configuration information does not include a retry flag, a processing exception prompt can be generated, that is, an exception is thrown to remind the operation and maintenance personnel to perform maintenance in time, and provide more operations and maintenance personnel when dealing with over-quota situations Select to ensure the normal realization of each business.
采用上述方案后,可以先接收客户端发送的待处理业务的业务处理请求,然后根据最新的负载增量和预存的资源配置信息对待处理业务进行资源配额验证,得到验证结果。在一种实现方式中,若验证结果为验证通过,则根据业务处理请求为待处理业务分配资源配额,然后根据分配的资源配额对待处理业务进行处理,得到业务处理结果。在另一种实现方式中,若验证结果为验证未通过,则可以根据预存的超配额请求处理规则对待处理业务进行处理。通过将预存的资源配置信息与动态确定的负载增量相结合的方式来为待处理业务进行资源配额分配,减少了集群负载判断不准确的情况,提高了资源配额分配的合理性与准确性,进而保证了各金融业务的正常实现。After adopting the above scheme, the service processing request of the pending business sent by the client can be received first, and then the resource quota verification of the pending business can be performed according to the latest load increment and pre-stored resource configuration information, and the verification result can be obtained. In one implementation manner, if the verification result is that the verification is passed, a resource quota is allocated to the pending business according to the business processing request, and then the pending business is processed according to the allocated resource quota to obtain a business processing result. In another implementation manner, if the verification result is that the verification fails, the pending service may be processed according to the pre-stored over-quota request processing rule. By combining pre-stored resource configuration information with dynamically determined load increments, resource quotas are allocated for pending services, which reduces inaccurate cluster load judgments and improves the rationality and accuracy of resource quota allocation. Thus ensuring the normal realization of various financial services.
基于图2的方法,本说明书实施例还提供了该方法的一些具体实施方案,下面进行说明。Based on the method in FIG. 2 , the embodiment of this specification also provides some specific implementations of the method, which will be described below.
此外,在另一实施例中,获取最新的负载增量,可以包括:In addition, in another embodiment, obtaining the latest load increment may include:
按预设获取规则获取总处理时长、处理时长阈值、集群最低负载以及集群最高负载。Obtain the total processing time, processing time threshold, minimum cluster load, and maximum cluster load according to preset acquisition rules.
根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量。The latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
在本实施例中,总处理时长可以用TotalCallTime表示,为一个待处理请求被集群接收并处理完成的时长,该指标可以直接反映出当前Regionserver(即集群)服务的处理性能。对应的,TotalCallTime=QueueCallTime+ ProcessCallTime。其中,QueueCallTime为在集群中Regionserver级别的指标,集群接收到客户端的待处理请求之后可以先将待处理请求放入到请求队列中,然后由专门的线程从队列中消费待处理请求并交给处理线程进行处理,一个待处理请求在队列中等待的时长即为QueutCallTime。ProcessCallTime为在集群中Regionserver级别的指标,指当待处理请求从队列中被消费出来,直至处理完成的时长,该指标为反应集群处理效率的关键指标。In this embodiment, the total processing time can be represented by TotalCallTime, which is the time for a request to be processed to be received and processed by the cluster, and this index can directly reflect the processing performance of the current Regionserver (that is, the cluster) service. Correspondingly, TotalCallTime=QueueCallTime+ ProcessCallTime. Among them, QueueCallTime is an indicator at the Regionserver level in the cluster. After the cluster receives the pending request from the client, it can put the pending request into the request queue first, and then a dedicated thread consumes the pending request from the queue and hands it over for processing. The thread performs processing, and the length of time a pending request waits in the queue is QueutCallTime. ProcessCallTime is an indicator at the Regionserver level in the cluster. It refers to the time from when a pending request is consumed from the queue until the processing is completed. This indicator is a key indicator that reflects the processing efficiency of the cluster.
处理时长阈值可以用MaxCallTime表示,为从业务侧角度设置的业务能够容忍的TotalCallTime的最大值。示例性的,待处理业务的查询最多容忍0.5s的耗时(如果0.5s内请求不能处理完成,业务应用就报错),则可以将MaxCallTime设置成不大于0.5s的数值。The processing time threshold can be represented by MaxCallTime, which is the maximum value of TotalCallTime that can be tolerated by the service set from the perspective of the service side. Exemplarily, the query of the service to be processed can tolerate a maximum time-consuming of 0.5s (if the request cannot be processed within 0.5s, the service application will report an error), then MaxCallTime can be set to a value not greater than 0.5s.
对于集群最低负载,按预设获取规则获取集群最低负载,具体可以包括:For the minimum load of the cluster, obtain the minimum load of the cluster according to the preset acquisition rules, which can include:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量。Obtain the preset processing time threshold and the total processing time and load at the target moment.
根据预设的最低负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最低负载。The processing duration threshold, the total processing duration and the load at the target time are judged according to the preset minimum load judgment rule, and the minimum initial cluster load is determined.
获取预设历史时间段内的若干历史最低负载,并根据所述若干历史最低负载确定历史平均最低负载。Several historical minimum loads within a preset historical time period are obtained, and a historical average minimum load is determined according to the several historical minimum loads.
将所述初始集群最低负载和所述历史平均最低负载中的最小值作为集群最低负载。The minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
具体的,集群最低负载也可称为LowTPS,表示在TotalCallTime达到MaxCallTime时的TPS下限,即当前Regionserver服务在性能最差时能够提供的TPS负载。负载量(TPS,Transactions Per Second)表示每秒钟执行的事务数量,是集群吞吐量的重要衡量标准。对应的,可以对RegionServer服务持续进行监控,计t时刻的TotalCallTime为CTt,TPS为TPSt,然后可以以固定的时间间隔进行计算: Specifically, the minimum cluster load can also be called LowTPS, which means the lower limit of TPS when TotalCallTime reaches MaxCallTime, that is, the TPS load that the current Regionserver service can provide when the performance is the worst. Load (TPS, Transactions Per Second) indicates the number of transactions executed per second, which is an important measure of cluster throughput. Correspondingly, the RegionServer service can be continuously monitored, the TotalCallTime at the time t is CTt, and the TPS is TPSt, and then it can be calculated at a fixed time interval:
取时间间隔内的MaxCallTime*99%<=CTt<=MaxCallTime*101%区间的所有时刻的TPSt的最小值,做为当前时间间隔的LowTPS,并存档。如果当前时间间隔内CTt持续小于 MaxCallTime*99%, 则表明Regionserver为轻负载运行,对CTt进行排序,获取CTt最大时所对应的TPS值作为当前时间间隔的LowTps。如果当前时间间隔的CTt持续大于 MaxCallTime*101%, 则表明Regionserver超负载运行,当前时间间隔无有效LowTPS数据。然后再取历史时间段内的平均LowTPS和最新时间间隔的LowTPS的最小值作为当前集群服务的LowTPS,有效期为时间间隔。其中,时间间隔和历史时间段均可以根据实际应用场景自定义进行设置,示例性的,时间间隔可以为3-6分钟内的任意值。历史时间段可以为1-3个月中的任意值。 Take the minimum value of TPSt at all moments in the MaxCallTime*99%<=CTt<=MaxCallTime*101% interval in the time interval, as the LowTPS of the current time interval, and archive it. If CTt continues to be less than MaxCallTime*99% in the current time interval, it indicates that the Regionserver is running under a light load. Sort the CTt, and obtain the TPS value corresponding to the maximum CTt as the LowTps of the current time interval. If CTt for the current time interval is consistently greater than MaxCallTime*101%, it means that the Regionserver is overloaded and there is no valid LowTPS data in the current time interval. Then take the minimum value of the average LowTPS in the historical time period and the LowTPS of the latest time interval as the LowTPS of the current cluster service, and the validity period is the time interval. Wherein, both the time interval and the historical time period can be customized and set according to actual application scenarios. Exemplarily, the time interval can be any value within 3-6 minutes. The historical time period can be any value from 1-3 months.
对于集群最高负载,按预设获取规则获取集群最高负载,具体可以包括:For the highest cluster load, obtain the highest cluster load according to the preset acquisition rules, which can include:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量。Obtain the preset processing time threshold and the total processing time and load at the target moment.
根据预设的最高负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最高负载。The processing duration threshold, the total processing duration and the load at the target time are judged according to the preset highest load judgment rule, and the initial maximum load of the cluster is determined.
获取预设历史时间段内的若干历史最高负载,并根据所述若干历史最高负载确定历史平均最高负载。Several historical maximum loads within a preset historical time period are obtained, and a historical average maximum load is determined according to the several historical maximum loads.
将所述初始集群最高负载和所述历史平均最高负载中的最大值作为集群最高负载。The maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
具体的,集群最高负载也可称为UpTPS,表示在TotalCallTime达到MaxCallTime时的TPS上限,即当前Regionserver服务在性能最好时能够提供的TPS负载。负载量(TPS,Transactions Per Second)表示每秒钟执行的事务数量,是集群吞吐量的重要衡量标准。对应的,可以对RegionServer服务持续进行监控,计t时刻的TotalCallTime为CTt,TPS为TPSt,然后可以以固定的时间间隔进行计算:Specifically, the highest cluster load can also be called UpTPS, indicating the TPS upper limit when TotalCallTime reaches MaxCallTime, that is, the TPS load that the current RegionServer service can provide when the performance is the best. Load (TPS, Transactions Per Second) indicates the number of transactions executed per second, which is an important measure of cluster throughput. Correspondingly, the RegionServer service can be continuously monitored, the TotalCallTime at the time t is CTt, and the TPS is TPSt, and then it can be calculated at a fixed time interval:
取时间间隔内MaxCallTime*99%<=CTt<=MaxCallTime*101%区间的所有时刻的TPSt的最大值,作为当前时间间隔的UpTPS。如果当前时间间隔内CTt持续小于MaxCallTime*99%, 则表明Regionserver轻负载运行,对CTt进行排序,获取CTt最大时刻所对应的TPS*101%值作为时间间隔的UpTps。如果当前小时的CTt持续大于 MaxCallTime*101%, 则表名regionserver超负载运行,当前时间间隔无有效UpTPS数据。然后再取历史时间段内的平均UpTPS和最新时间间隔的UpTPS的最大值作为当前Rgionserver服务的UpTPS,有效期为时间间隔。其中,时间间隔和历史时间段均可以根据实际应用场景自定义进行设置,示例性的,时间间隔可以为3-6分钟内的任意值。历史时间段可以为1-3个月中的任意值。Take the maximum value of TPSt at all moments in the interval of MaxCallTime*99%<=CTt<=MaxCallTime*101% in the time interval as the UpTPS of the current time interval. If CTt continues to be less than MaxCallTime*99% in the current time interval, It indicates that the Regionserver is running under a light load, sorts the CTt, and obtains the TPS*101% value corresponding to the maximum CTt moment as the UpTps of the time interval. If the CTt of the current hour is continuously greater than MaxCallTime*101%, Then the table name regionserver is overloaded, and there is no valid UpTPS data in the current time interval. Then take the average UpTPS in the historical time period and the maximum value of the UpTPS in the latest time interval as the UpTPS of the current Rgionserver service, and the validity period is the time interval. Wherein, both the time interval and the historical time period can be customized and set according to actual application scenarios. Exemplarily, the time interval can be any value within 3-6 minutes. The historical time period can be any value from 1-3 months.
对于集群当前负载,可以直接从预存的资源配置信息中获取。而预存的资源配置信息中的集群当前负载是实时进行更新的,同前述实施例,可以对RegonServer服务持续进行监控,并在达到固定的时间间隔(默认为5秒钟)之后,对Regionserver的TotalRequestCount指标进行统计,T时刻的TotalRequestCount记为RequestCount(T),T1时刻的TotalRequestCount记为RequestCount(T1),CurrentTPS=(RequestCount(T1)- RequestCount(T))/(T1-T),然后可以将新确定的CurrentTPS存储至资源配置信息中,即更新只有配置信息中的集群当前负载。通过实时更新资源配置信息中的集群当前负载,可以准确的确定集群的当前负载情况,进而为能否继续增加业务以及增加的业务规模提供了依据,既避免了资源的浪费,也避免了超负荷运行的情况,保证了各业务的正常实现。The current load of the cluster can be obtained directly from the pre-stored resource configuration information. The current load of the cluster in the pre-stored resource configuration information is updated in real time. Similar to the previous embodiment, the RegonServer service can be continuously monitored, and after a fixed time interval (5 seconds by default), the TotalRequestCount of the Regionserver Count the indicators, the TotalRequestCount at time T is recorded as RequestCount(T), the TotalRequestCount at time T1 is recorded as RequestCount(T1), CurrentTPS=(RequestCount(T1)- RequestCount(T))/(T1-T), and then the new The determined CurrentTPS is stored in the resource configuration information, that is, only the current load of the cluster in the configuration information is updated. By updating the current load of the cluster in the resource configuration information in real time, the current load of the cluster can be accurately determined, and then provide a basis for whether the business can continue to increase and the increased business scale, which avoids waste of resources and overload The running situation ensures the normal realization of various businesses.
进一步的,在得到总处理时长、处理时长阈值、集群最低负载、集群最高负载以及集群当前负载之后,可以确定最新的负载增量,即根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量(也可称为集群可承受负载),具体可以包括:Further, after obtaining the total processing time, the processing time threshold, the minimum load of the cluster, the maximum load of the cluster, and the current load of the cluster, the latest load increment can be determined, that is, according to the total processing time, the processing time threshold, the The minimum load of the cluster, the maximum load of the cluster, and the current load of the cluster in the pre-stored resource configuration information determine the latest load increment (also referred to as the acceptable load of the cluster), which may specifically include:
若所述总处理时长大于或等于所述处理时长阈值,则确定最新的负载增量为零。If the total processing duration is greater than or equal to the processing duration threshold, it is determined that the latest load increment is zero.
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载小于所述集群最低负载,则确定最新的负载增量为所述集群最低负载与所述预存的资源配置信息中的集群当前负载之差。If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of .
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最低负载,并小于所述集群最高负载,则确定最新的负载增量为所述集群最高负载与所述预存的资源配置信息中的集群当前负载之差。If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information.
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最高负载,则确定最新的负载增量为预设负载阈值。If the total processing duration is less than the processing duration threshold, and the current cluster load in the prestored resource configuration information is greater than the cluster maximum load, then determine that the latest load increment is the preset load threshold.
具体的,如果TotalCallTime >= MaxCallTime,则确定当前Regionserver负载已达最大值,不能进行配额溢出。如果TotalCallTime<MaxCallTime且 CurrentTPS< LowTPS,则确定Regionserver轻负载运行且有空闲负载,可以增加的负载量为LowTPS-CurrentTPS。如果TotalCallTime<MaxCallTime 且LowTPS < CurrentTPS< UpTPS,则确定Regionserver有空闲负载,可以增加的负载量为UpTPS- CurrentTPS。如果TotalCallTime<MaxCallTime 且CurrentTPS>UpTPS,则确定Regionserver负载出现新高,处理能力满足要求,可以小规模增加负载。其中,小规模增加负载的数量可以根据实际应用场景自定义进行设置,示例性的,可以增加10TPS。Specifically, if TotalCallTime >= MaxCallTime, it is determined that the current Regionserver load has reached the maximum value, and quota overflow cannot occur. If TotalCallTime<MaxCallTime and CurrentTPS<LowTPS, it is determined that the Regionserver is running lightly and has idle load, and the load that can be increased is LowTPS-CurrentTPS. If TotalCallTime<MaxCallTime and LowTPS<CurrentTPS<UpTPS, it is determined that the Regionserver has an idle load, and the load that can be increased is UpTPS- Current TPS. If TotalCallTime<MaxCallTime and CurrentTPS>UpTPS, it is determined that the Regionserver load has reached a new high, and the processing capacity meets the requirements, and the load can be increased in a small scale. Wherein, the number of small-scale increased loads can be customized and set according to actual application scenarios, for example, it can be increased by 10TPS.
另外,在获取最新的负载增量时,可以有多种触发机制,具体可以为:In addition, when obtaining the latest load increment, there can be multiple trigger mechanisms, specifically:
在一种实现方式中,可以判断是否达到预设的更新时长阈值。In an implementation manner, it may be determined whether a preset update duration threshold is reached.
若达到所述更新时长阈值,则获取最新的负载增量。If the update duration threshold is reached, the latest load increment is obtained.
示例性的,更新时长阈值可以为3-6分钟中的任意值,在达到更新时长阈值时,可以自动触发获取最新的负载增量规则,并获取最新的负载增量。Exemplarily, the update duration threshold may be any value in 3-6 minutes, and when the update duration threshold is reached, the rule for acquiring the latest load increment may be automatically triggered, and the latest load increment may be acquired.
在另一种实现方式中,可以判断业务处理请求的总处理数量是否达到预设的数量阈值。In another implementation manner, it may be determined whether the total processing quantity of service processing requests reaches a preset quantity threshold.
若达到所述数量阈值,则获取最新的负载增量。If the quantity threshold is reached, the latest load increment is obtained.
示例性的,数量阈值可以为10000,当业务处理请求的数量累计到10000时,可以自动触发获取最新的负载增量规则,并获取最新的负载增量。同时还可以清空业务处理请求的数量,从零开始重新进行计算。Exemplarily, the quantity threshold may be 10000, and when the number of business processing requests reaches 10000, the rule for acquiring the latest load increment may be automatically triggered, and the latest load increment may be acquired. At the same time, the number of business processing requests can be cleared and the calculation can be restarted from zero.
另外,若在获取最新的负载增量时,既没有达到更新时长阈值也没有达到数量阈值,则可以将前一次获取得到的负载增量作为本次新获取的负载增量。In addition, if neither the update duration threshold nor the quantity threshold is reached when the latest load increment is acquired, the load increment obtained in the previous acquisition may be used as the newly acquired load increment.
图3为本申请另一实施例提供的集群资源配额分配方法的流程示意图,如图3所示,在该实施例中,所述方法可以包括:接收待处理业务的待处理请求,然后对待处理请求进行解析,确定负载请求量。确定负载请求量之后,可以根据预存的资源配置信息中的集群当前负载与负载请求量确定求和结果,并判断求和结果是否超过为待处理业务分配的资源配额。若否,则处理待处理请求。若是,则判断是否配置了溢出比信息。若是,则根据溢出比信息确定最高配额,并判断求和结果是否超过最高配额。若没有超过最高配额,则获取最新的负载增量,并判断求和结果是否超过最新的负载增量与为待处理业务分配的资源配额之和,若没有超过最新的负载增量与为待处理业务分配的资源配额之和,则处理待处理请求。若超过最新的负载增量与为待处理业务分配的资源配额之和,则根据预存的超配额请求处理规则确定是否重试,若重试,则重新加入请求队列,否则,直接抛出异常。Fig. 3 is a schematic flowchart of a method for allocating cluster resource quotas provided by another embodiment of the present application. As shown in Fig. 3, in this embodiment, the method may include: receiving pending requests of pending services, and then The request is parsed to determine the load request volume. After determining the load request amount, the summation result can be determined according to the cluster current load and the load request amount in the pre-stored resource configuration information, and judge whether the summation result exceeds the resource quota allocated for the business to be processed. If not, the pending request is processed. If yes, it is judged whether overflow ratio information is configured. If yes, determine the maximum quota according to the overflow ratio information, and judge whether the summation result exceeds the maximum quota. If the maximum quota is not exceeded, obtain the latest load increment, and judge whether the summation result exceeds the sum of the latest load increment and the resource quota allocated for the pending business, if not exceeding the latest load increment and the pending business The sum of the resource quotas allocated by the business will process pending requests. If the sum of the latest load increment and the resource quota allocated for the pending business is exceeded, it will be determined whether to retry according to the pre-stored over-quota request processing rules. If it is retried, it will be added to the request queue again, otherwise, an exception will be thrown directly.
另外,若没有配置溢出比信息,则根据预存的超配额请求处理规则确定是否重试,若重试,则重新加入请求队列,否则,直接抛出异常。In addition, if the overflow ratio information is not configured, it will be determined whether to retry according to the pre-stored over-quota request processing rules. If it is retried, it will re-join the request queue, otherwise, an exception will be thrown directly.
若超过最高配置,则根据预存的超配额请求处理规则确定是否重试,若重试,则重新加入请求队列,否则,直接抛出异常。If the maximum configuration is exceeded, it will be determined whether to retry according to the pre-stored over-quota request processing rules. If it is retried, it will rejoin the request queue, otherwise, an exception will be thrown directly.
其中,最新的负载增量确定有两种触发重新计算的机制,定时计算默认为5分钟,处理请求达到一定量(默认10000)之后也会触发新一轮计算。Among them, the latest load increment is determined to have two mechanisms to trigger recalculation. The default timing calculation is 5 minutes, and a new round of calculation will be triggered after processing requests reach a certain amount (default 10000).
基于同样的思路,本说明书实施例还提供了上述方法对应的装置,图4为本申请实施例提供的集群资源配额分配装置的结构示意图,如图4所示,本实施例提供的装置,可以包括: Based on the same idea, the embodiment of this specification also provides a device corresponding to the above method. Figure 4 is a schematic structural diagram of the cluster resource quota allocation device provided by the embodiment of this application. As shown in Figure 4, the device provided by this embodiment can be include:
接收模块401,用于接收客户端发送的待处理业务的业务处理请求。The receiving module 401 is configured to receive the service processing request of the service to be processed sent by the client.
处理模块402,用于根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果。The processing module 402 is configured to perform resource quota verification on the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result.
在本实施例中,所述业务处理请求中包含负载请求量,所述处理模块402,还用于:In this embodiment, the service processing request includes a load request amount, and the processing module 402 is further configured to:
对所述预存的资源配置信息中的集群当前负载以及所述负载请求量进行求和处理,得到求和结果。Summing the current load of the cluster in the pre-stored resource configuration information and the load request amount is performed to obtain a summing result.
获取最新的负载增量。Get the latest load delta.
判断所述求和结果是否高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和。Judging whether the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information.
若所述求和结果高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证未通过。If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the prestored resource configuration information, it is determined that the verification result is a verification failure.
此外,所述处理模块402,还用于:In addition, the processing module 402 is also used for:
判断所述求和结果是否高于所述预存的资源配置信息中为所述待处理业务分配的资源配额。Judging whether the summation result is higher than the resource quota allocated for the service to be processed in the prestored resource configuration information.
若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额,则执行所述获取最新的负载增量的步骤。If the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the step of acquiring the latest load increment is performed.
此外,所述处理模块402,还用于:In addition, the processing module 402 is also used for:
若所述求和结果不高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证通过。If the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
更进一步的,所述处理模块402,还用于:Furthermore, the processing module 402 is also used for:
确定所述预存的资源配置信息中是否包含溢出比信息。Determine whether the prestored resource configuration information includes overflow ratio information.
若包含溢出比信息,则根据所述溢出比信息确定所述待处理业务的最高配额。If overflow ratio information is included, the maximum quota of the service to be processed is determined according to the overflow ratio information.
判断所述求和结果是否高于所述最高配额。It is judged whether the summation result is higher than the maximum quota.
若所述求和结果不高于所述最高配额,则继续执行所述获取最新的负载增量及之后的步骤。If the summation result is not higher than the maximum quota, continue to perform the steps of obtaining the latest load increment and subsequent steps.
若求和结果高于所述最高配额,则确定所述验证结果为验证未通过。If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
所述处理模块402,还用于若所述验证结果为验证通过,则根据所述业务处理请求为所述待处理业务分配资源配额,并根据分配的资源配额对所述待处理业务进行处理,得到业务处理结果。The processing module 402 is further configured to allocate a resource quota for the service to be processed according to the service processing request if the verification result is passed, and process the service to be processed according to the allocated resource quota, Get the business processing result.
所述处理模块402,还用于若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理。The processing module 402 is further configured to process the service to be processed according to a pre-stored over-quota request processing rule if the verification result is that the verification fails.
在本实施例中,所述处理模块402,还用于:In this embodiment, the processing module 402 is further configured to:
若所述验证结果为验证未通过,则判断所述预存的资源配置信息中是否包含重试标识。If the verification result is that the verification fails, it is judged whether the pre-stored resource configuration information includes a retry flag.
若所述预存的资源配置信息中包含重试标识,则将所述待处理业务的业务处理请求添加至请求队列中。If the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the service to be processed to a request queue.
若所述预存的资源配置信息中不包含重试标识,则生成处理异常提示。If the pre-stored resource configuration information does not include a retry identifier, a processing exception prompt is generated.
此外,在另一实施例中,所述处理模块402,还用于:In addition, in another embodiment, the processing module 402 is further configured to:
按预设获取规则获取总处理时长、处理时长阈值、集群最低负载以及集群最高负载。Obtain the total processing time, processing time threshold, minimum cluster load, and maximum cluster load according to preset acquisition rules.
在本实施例中,所述处理模块402,还用于:In this embodiment, the processing module 402 is further configured to:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量。Obtain the preset processing time threshold and the total processing time and load at the target moment.
根据预设的最低负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最低负载。The processing duration threshold, the total processing duration and the load at the target time are judged according to the preset minimum load judgment rule, and the minimum initial cluster load is determined.
获取预设历史时间段内的若干历史最低负载,并根据所述若干历史最低负载确定历史平均最低负载。Several historical minimum loads within a preset historical time period are obtained, and a historical average minimum load is determined according to the several historical minimum loads.
将所述初始集群最低负载和所述历史平均最低负载中的最小值作为集群最低负载。The minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
另外,所述处理模块402,还用于:In addition, the processing module 402 is also used for:
获取预设的处理时长阈值以及目标时刻的总处理时长和负载量。Obtain the preset processing time threshold and the total processing time and load at the target moment.
根据预设的最高负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最高负载。The processing duration threshold, the total processing duration and the load at the target time are judged according to the preset highest load judgment rule, and the initial maximum load of the cluster is determined.
获取预设历史时间段内的若干历史最高负载,并根据所述若干历史最高负载确定历史平均最高负载。Several historical maximum loads within a preset historical time period are obtained, and a historical average maximum load is determined according to the several historical maximum loads.
将所述初始集群最高负载和所述历史平均最高负载中的最大值作为集群最高负载。The maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量。The latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
在本实施例中,所述处理模块402,还用于:In this embodiment, the processing module 402 is further configured to:
若所述总处理时长大于或等于所述处理时长阈值,则确定最新的负载增量为零。If the total processing duration is greater than or equal to the processing duration threshold, it is determined that the latest load increment is zero.
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载小于所述集群最低负载,则确定最新的负载增量为所述集群最低负载与所述预存的资源配置信息中的集群当前负载之差。If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of .
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最低负载,并小于所述集群最高负载,则确定最新的负载增量为所述集群最高负载与所述预存的资源配置信息中的集群当前负载之差。If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information.
若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最高负载,则确定最新的负载增量为预设负载阈值。If the total processing duration is less than the processing duration threshold, and the current cluster load in the prestored resource configuration information is greater than the cluster maximum load, then determine that the latest load increment is the preset load threshold.
此外,所述处理模块402,还用于:In addition, the processing module 402 is also used for:
判断是否达到预设的更新时长阈值。Determine whether the preset update duration threshold is reached.
若达到所述更新时长阈值,则获取最新的负载增量。If the update duration threshold is reached, the latest load increment is obtained.
或者,判断业务处理请求的总处理数量是否达到预设的数量阈值。Alternatively, it is judged whether the total processing quantity of the service processing request reaches a preset quantity threshold.
若达到所述数量阈值,则获取最新的负载增量。If the quantity threshold is reached, the latest load increment is acquired.
本申请实施例提供的装置,可以实现上述如图2所示的实施例的方法,其实现原理和技术效果类似,此处不再赘述。The device provided in the embodiment of the present application can implement the method in the above embodiment as shown in FIG. 2 , and its implementation principle and technical effect are similar, and will not be repeated here.
图5为本申请实施例提供的电子设备的硬件结构示意图,如图5所示,本实施例提供的设备500包括:处理器501,以及与所述处理器通信连接的存储器。其中,处理器501、存储器502通过总线503连接。FIG. 5 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application. As shown in FIG. 5 , a device 500 provided in this embodiment includes a processor 501 and a memory communicatively connected to the processor. Wherein, the processor 501 and the memory 502 are connected through a bus 503 .
在具体实现过程中,处理器501执行所述存储器502存储的计算机执行指令,使得处理器501执行上述方法实施例中的集群资源配额分配方法。In a specific implementation process, the processor 501 executes the computer-executed instructions stored in the memory 502, so that the processor 501 executes the method for allocating cluster resource quotas in the foregoing method embodiments.
处理器501的具体实现过程可参见上述方法实施例,其实现原理和技术效果类似,本实施例此处不再赘述。For the specific implementation process of the processor 501, reference may be made to the foregoing method embodiments. The implementation principles and technical effects thereof are similar, and details are not repeated here in this embodiment.
在上述的图5所示的实施例中,应理解,处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合发明所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。In the above-mentioned embodiment shown in FIG. 5, it should be understood that the processor may be a central processing unit (English: Central Processing Unit, referred to as: CPU), can also be other general-purpose processors, digital signal processors (English: Digital Signal Processor, referred to as: DSP), application-specific integrated circuits (English: Application Specific Integrated Circuit, referred to as: ASIC), etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in conjunction with the invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
存储器可能包含高速RAM存储器,也可能还包括非易失性存储NVM,例如至少一个磁盘存储器。The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory.
总线可以是工业标准体系结构(Industry Standard Architecture,ISA)总线、外部设备互连(Peripheral Component Interconnect,PCI)总线或扩展工业标准体系结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,本申请附图中的总线并不限定仅有一根总线或一种类型的总线。The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Device Interconnect (Peripheral Component Interconnect, PCI) bus or Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, the buses in the drawings of the present application are not limited to only one bus or one type of bus.
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,实现上述方法实施例的集群资源配额分配方法。The embodiment of the present application also provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, the cluster resource quota allocation method of the above method embodiment is implemented .
本申请实施例还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时,实现如上所述的集群资源配额分配方法。An embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, implements the cluster resource quota allocation method as described above.
上述的计算机可读存储介质,上述可读存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。可读存储介质可以是通用或专用计算机能够存取的任何可用介质。The above-mentioned computer-readable storage medium, the above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic Disk or Optical Disk. Readable storage media can be any available media that can be accessed by a general purpose or special purpose computer.
一种示例性的可读存储介质耦合至处理器,从而使处理器能够从该可读存储介质读取信息,且可向该可读存储介质写入信息。当然,可读存储介质也可以是处理器的组成部分。处理器和可读存储介质可以位于专用集成电路(Application Specific Integrated Circuits,简称:ASIC)中。当然,处理器和可读存储介质也可以作为分立组件存在于设备中。An exemplary readable storage medium is coupled to the processor such the processor can read information from, and write information to, the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limiting them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present application. scope.

Claims (15)

  1. 一种集群资源配额分配方法,其特征在于,包括:A method for allocating cluster resource quotas, comprising:
    接收客户端发送的待处理业务的业务处理请求;Receive the business processing request of the pending business sent by the client;
    根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果;Verifying the resource quota of the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtaining a verification result;
    若所述验证结果为验证通过,则根据所述业务处理请求为所述待处理业务分配资源配额,并根据分配的资源配额对所述待处理业务进行处理,得到业务处理结果;If the verification result is that the verification is passed, allocating a resource quota for the pending business according to the business processing request, and processing the pending business according to the allocated resource quota to obtain a business processing result;
    若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理。If the verification result is that the verification fails, the pending service is processed according to the pre-stored over-quota request processing rule.
  2. 根据权利要求1所述的方法,其特征在于,所述业务处理请求中包含负载请求量,所述根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果,包括:The method according to claim 1, wherein the service processing request includes a load request amount, and the resource quota verification is performed on the pending service according to the latest load increment and pre-stored resource configuration information to obtain Verify results, including:
    对所述预存的资源配置信息中的集群当前负载以及所述负载请求量进行求和处理,得到求和结果;summing the current cluster load and the load request in the pre-stored resource configuration information to obtain a summation result;
    获取最新的负载增量;Get the latest load increment;
    判断所述求和结果是否高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和;judging whether the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information;
    若所述求和结果高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证未通过。If the summation result is higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the prestored resource configuration information, it is determined that the verification result is a verification failure.
  3. 根据权利要求2所述的方法,其特征在于,在所述获取最新的负载增量的步骤之前,所述方法还包括:The method according to claim 2, wherein, before the step of obtaining the latest load increment, the method further comprises:
    判断所述求和结果是否高于所述预存的资源配置信息中为所述待处理业务分配的资源配额;judging whether the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information;
    若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额,则执行所述获取最新的负载增量的步骤。If the summation result is higher than the resource quota allocated for the service to be processed in the pre-stored resource configuration information, the step of acquiring the latest load increment is performed.
  4. 根据权利要求3所述的方法,其特征在于,在所述若所述求和结果高于所述预存的资源配置信息中为所述待处理业务分配的资源配额之后,还包括:The method according to claim 3, further comprising:
    确定所述预存的资源配置信息中是否包含溢出比信息;Determine whether the pre-stored resource configuration information includes overflow ratio information;
    若包含溢出比信息,则根据所述溢出比信息确定所述待处理业务的最高配额;If overflow ratio information is included, then determine the maximum quota of the service to be processed according to the overflow ratio information;
    判断所述求和结果是否高于所述最高配额;Judging whether the summation result is higher than the maximum quota;
    若所述求和结果不高于所述最高配额,则继续执行所述获取最新的负载增量及之后的步骤;If the summation result is not higher than the maximum quota, continue to perform the steps of obtaining the latest load increment and subsequent steps;
    若所述求和结果高于所述最高配额,则确定所述验证结果为验证未通过。If the summation result is higher than the maximum quota, it is determined that the verification result is verification failure.
  5. 根据权利要求2-4任一项所述的方法,其特征在于,所述获取最新的负载增量,包括:The method according to any one of claims 2-4, wherein said obtaining the latest load increment comprises:
    按预设获取规则获取总处理时长、处理时长阈值、集群最低负载以及集群最高负载;Obtain the total processing time, processing time threshold, cluster minimum load, and cluster maximum load according to preset acquisition rules;
    根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量。The latest load increment is determined according to the total processing duration, the processing duration threshold, the cluster minimum load, the cluster maximum load, and the cluster current load in the prestored resource configuration information.
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述总处理时长、所述处理时长阈值、所述集群最低负载、所述集群最高负载以及所述预存的资源配置信息中的集群当前负载确定最新的负载增量,包括:The method according to claim 5, characterized in that, according to the total processing duration, the processing duration threshold, the minimum load of the cluster, the maximum load of the cluster, and the clusters in the pre-stored resource configuration information The current load determines the latest load increment, including:
    若所述总处理时长大于或等于所述处理时长阈值,则确定最新的负载增量为零;If the total processing time is greater than or equal to the processing time threshold, then determine that the latest load increment is zero;
    若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载小于所述集群最低负载,则确定最新的负载增量为所述集群最低负载与所述预存的资源配置信息中的集群当前负载之差;If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is less than the minimum load of the cluster, then determine that the latest load increment is the minimum load of the cluster and the pre-stored The difference between the current load of the cluster in the resource configuration information of ;
    若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最低负载,并小于所述集群最高负载,则确定最新的负载增量为所述集群最高负载与所述预存的资源配置信息中的集群当前负载之差;If the total processing duration is less than the processing duration threshold, and the current load of the cluster in the pre-stored resource configuration information is greater than the minimum load of the cluster and less than the maximum load of the cluster, then determine that the latest load increment is the The difference between the highest load of the cluster and the current load of the cluster in the pre-stored resource configuration information;
    若所述总处理时长小于所述处理时长阈值,且所述预存的资源配置信息中的集群当前负载大于所述集群最高负载,则确定最新的负载增量为预设负载阈值。If the total processing duration is less than the processing duration threshold, and the current cluster load in the prestored resource configuration information is greater than the cluster maximum load, then determine that the latest load increment is the preset load threshold.
  7. 根据权利要求5或6所述的方法,其特征在于,所述按预设获取规则获取集群最低负载,包括:The method according to claim 5 or 6, wherein the obtaining the minimum load of the cluster according to the preset obtaining rules includes:
    获取预设的处理时长阈值以及目标时刻的总处理时长和负载量;Obtain the preset processing time threshold and the total processing time and load at the target moment;
    根据预设的最低负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最低负载;Judging the processing duration threshold and the total processing duration and load at the target time according to the preset minimum load judgment rule, and determining the minimum initial cluster load;
    获取预设历史时间段内的若干历史最低负载,并根据所述若干历史最低负载确定历史平均最低负载;Obtaining several historical minimum loads within a preset historical time period, and determining the historical average minimum load according to the several historical minimum loads;
    将所述初始集群最低负载和所述历史平均最低负载中的最小值作为集群最低负载。The minimum value of the initial cluster minimum load and the historical average minimum load is used as the cluster minimum load.
  8. 根据权利要求5-7任一项所述的方法,其特征在于,所述按预设获取规则获取集群最高负载,包括:The method according to any one of claims 5-7, wherein the obtaining the highest load of the cluster according to preset obtaining rules includes:
    获取预设的处理时长阈值以及目标时刻的总处理时长和负载量;Obtain the preset processing time threshold and the total processing time and load at the target moment;
    根据预设的最高负载判断规则对所述处理时长阈值以及所述目标时刻的总处理时长和负载量进行判断,确定初始集群最高负载;Judging the processing duration threshold and the total processing duration and load at the target time according to the preset highest load judgment rule, and determining the initial cluster maximum load;
    获取预设历史时间段内的若干历史最高负载,并根据所述若干历史最高负载确定历史平均最高负载;Obtaining several historical maximum loads within a preset historical time period, and determining the historical average maximum load according to the several historical maximum loads;
    将所述初始集群最高负载和所述历史平均最高负载中的最大值作为集群最高负载。The maximum value of the initial cluster maximum load and the historical average maximum load is used as the maximum cluster load.
  9. 根据权利要求2-8任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 2-8, wherein the method further comprises:
    若所述求和结果不高于所述最新的负载增量与所述预存的资源配置信息中为所述待处理业务分配的资源配额之和,则确定所述验证结果为验证通过。If the summation result is not higher than the sum of the latest load increment and the resource quota allocated for the service to be processed in the pre-stored resource configuration information, it is determined that the verification result is passed the verification.
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理,包括:The method according to any one of claims 1-9, wherein if the verification result is that the verification fails, processing the pending business according to the pre-stored over-quota request processing rules includes:
    若所述验证结果为验证未通过,则判断所述预存的资源配置信息中是否包含重试标识;If the verification result is that the verification fails, then judging whether the pre-stored resource configuration information includes a retry flag;
    若所述预存的资源配置信息中包含重试标识,则将所述待处理业务的业务处理请求添加至请求队列中;If the pre-stored resource configuration information includes a retry identifier, adding the service processing request of the pending service to a request queue;
    若所述预存的资源配置信息中不包含重试标识,则生成处理异常提示。If the pre-stored resource configuration information does not include a retry identifier, a processing exception prompt is generated.
  11. 根据权利要求2-9任一项所述的方法,其特征在于,在所述获取最新的负载增量之前,还包括:The method according to any one of claims 2-9, characterized in that, before acquiring the latest load increment, further comprising:
    判断是否达到预设的更新时长阈值;Determine whether the preset update duration threshold is reached;
    若达到所述更新时长阈值,则获取最新的负载增量;If the update duration threshold is reached, the latest load increment is obtained;
    或者,判断业务处理请求的总处理数量是否达到预设的数量阈值;Alternatively, it is judged whether the total processing quantity of business processing requests reaches a preset quantity threshold;
    若达到所述数量阈值,则获取最新的负载增量。If the quantity threshold is reached, the latest load increment is obtained.
  12. 一种集群资源配额分配装置,其特征在于,包括:A device for allocating cluster resource quotas, comprising:
    接收模块,用于接收客户端发送的待处理业务的业务处理请求;The receiving module is used to receive the service processing request of the pending service sent by the client;
    处理模块,用于根据最新的负载增量和预存的资源配置信息对所述待处理业务进行资源配额验证,得到验证结果;A processing module, configured to verify the resource quota of the service to be processed according to the latest load increment and pre-stored resource configuration information, and obtain a verification result;
    所述处理模块,还用于若所述验证结果为验证通过,则根据所述业务处理请求为所述待处理业务分配资源配额,并根据分配的资源配额对所述待处理业务进行处理,得到业务处理结果;The processing module is further configured to allocate a resource quota for the service to be processed according to the service processing request if the verification result is passed, and process the service to be processed according to the allocated resource quota to obtain Business processing results;
    所述处理模块,还用于若所述验证结果为验证未通过,则根据预存的超配额请求处理规则对所述待处理业务进行处理。The processing module is further configured to process the service to be processed according to a pre-stored over-quota request processing rule if the verification result is that the verification fails.
  13. 一种电子设备,其特征在于,包括:处理器,以及与所述处理器通信连接的存储器;An electronic device, characterized by comprising: a processor, and a memory connected to the processor in communication;
    所述存储器存储计算机执行指令;the memory stores computer-executable instructions;
    所述处理器执行所述存储器存储的计算机执行指令,以实现如权利要求1至11任一项所述的集群资源配额分配方法。The processor executes the computer-executed instructions stored in the memory, so as to realize the cluster resource quota allocation method according to any one of claims 1 to 11.
  14. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机执行指令,当处理器执行所述计算机执行指令时,以实现如权利要求1至11任一项所述的集群资源配额分配方法。A computer-readable storage medium, characterized in that, computer-executable instructions are stored in the computer-readable storage medium, and when the processor executes the computer-executable instructions, in order to realize any one of claims 1 to 11 The cluster resource quota allocation method.
  15. 一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至11任一项所述的集群资源配额分配方法。A computer program product, comprising a computer program, characterized in that, when the computer program is executed by a processor, the cluster resource quota allocation method according to any one of claims 1 to 11 is implemented.
PCT/CN2022/100694 2021-12-09 2022-06-23 Cluster resource quota allocation method and apparatus, and electronic device WO2023103342A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111503812.4 2021-12-09
CN202111503812.4A CN114143327B (en) 2021-12-09 2021-12-09 Cluster resource quota allocation method and device and electronic equipment

Publications (1)

Publication Number Publication Date
WO2023103342A1 true WO2023103342A1 (en) 2023-06-15

Family

ID=80385618

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/100694 WO2023103342A1 (en) 2021-12-09 2022-06-23 Cluster resource quota allocation method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN114143327B (en)
WO (1) WO2023103342A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932290A (en) * 2023-09-18 2023-10-24 北京睿企信息科技有限公司 Data processing system for obtaining target model

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114143327B (en) * 2021-12-09 2024-04-09 深圳前海微众银行股份有限公司 Cluster resource quota allocation method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784963A (en) * 2017-11-14 2019-05-21 阿里巴巴集团控股有限公司 A kind of resource management system, method, server and computer storage medium
US20190297487A1 (en) * 2018-03-22 2019-09-26 Verizon Patent And Licensing Inc. Systems and methods for intelligent data quota allocation and management
CN111611516A (en) * 2020-04-11 2020-09-01 上海淇玥信息技术有限公司 Resource allocation method and device and electronic equipment
CN113010309A (en) * 2021-03-02 2021-06-22 北京达佳互联信息技术有限公司 Cluster resource scheduling method, device, storage medium, equipment and program product
CN114143327A (en) * 2021-12-09 2022-03-04 深圳前海微众银行股份有限公司 Cluster resource quota allocation method and device and electronic equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100717846B1 (en) * 2005-12-09 2007-05-14 한국전자통신연구원 Dynamic resource allocation apparatus for furnishing good quality of service in interactive satellite multimedia system and its method
CN107040567A (en) * 2016-09-27 2017-08-11 阿里巴巴集团控股有限公司 The management-control method and device of pre-allocation of resources amount
CN106921754B (en) * 2017-05-04 2020-07-28 泰康保险集团股份有限公司 Load balancing method, device, medium and electronic equipment of cluster system
CN109271232B (en) * 2018-07-03 2019-11-19 广东省城乡规划设计研究院 A kind of cluster resource distribution method based on cloud computing platform
CN110008050B (en) * 2019-04-11 2023-06-30 北京百度网讯科技有限公司 Method and device for processing information
CN112445857A (en) * 2019-08-28 2021-03-05 北京京东尚科信息技术有限公司 Resource quota management method and device based on database
CN110855741B (en) * 2019-09-29 2022-01-11 北京奇艺世纪科技有限公司 Service self-adaptive access method and device, storage medium and electronic device
CN111222780A (en) * 2019-12-31 2020-06-02 东方微银科技(北京)有限公司 Resource allocation method, device, equipment and storage medium
CN112015557A (en) * 2020-08-31 2020-12-01 北京金山云网络技术有限公司 Resource adjusting method and device and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109784963A (en) * 2017-11-14 2019-05-21 阿里巴巴集团控股有限公司 A kind of resource management system, method, server and computer storage medium
US20190297487A1 (en) * 2018-03-22 2019-09-26 Verizon Patent And Licensing Inc. Systems and methods for intelligent data quota allocation and management
CN111611516A (en) * 2020-04-11 2020-09-01 上海淇玥信息技术有限公司 Resource allocation method and device and electronic equipment
CN113010309A (en) * 2021-03-02 2021-06-22 北京达佳互联信息技术有限公司 Cluster resource scheduling method, device, storage medium, equipment and program product
CN114143327A (en) * 2021-12-09 2022-03-04 深圳前海微众银行股份有限公司 Cluster resource quota allocation method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932290A (en) * 2023-09-18 2023-10-24 北京睿企信息科技有限公司 Data processing system for obtaining target model
CN116932290B (en) * 2023-09-18 2023-12-08 北京睿企信息科技有限公司 Data processing system for obtaining target model

Also Published As

Publication number Publication date
CN114143327A (en) 2022-03-04
CN114143327B (en) 2024-04-09

Similar Documents

Publication Publication Date Title
WO2023103342A1 (en) Cluster resource quota allocation method and apparatus, and electronic device
CN109936511B (en) Token obtaining method, device, server, terminal equipment and medium
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
US9529626B2 (en) Facilitating equitable distribution of thread resources for job types associated with tenants in a multi-tenant on-demand services environment
US9548912B2 (en) System and method for supporting smart buffer management in a distributed data grid
US9329901B2 (en) Resource health based scheduling of workload tasks
CN106713028B (en) Service degradation method and device and distributed task scheduling system
CN110858843B (en) Service request processing method and device and computer readable storage medium
US20170126583A1 (en) Method and electronic device for bandwidth allocation based on online media services
US20200351207A1 (en) Method and system of limiting traffic
US7694054B2 (en) Governing access to a computing resource
WO2020220646A1 (en) Data storage method based on distributed storage system, and storage node and medium
WO2017016423A1 (en) Real-time new data update method and device
TW201743223A (en) Self-adaptive resource allocation method and device
WO2021088351A1 (en) Node data deployment method, deployment node, system and medium
WO2019232926A1 (en) Method and apparatus for data consistency checking and flow control, electronic device and storage medium
EP3951607A1 (en) Data reading method, data writing method, and server
WO2024027548A1 (en) Node election method and apparatus, and storage medium and electronic device
US11863675B2 (en) Data flow control in distributed computing systems
WO2018166145A1 (en) Method and device for batch offering of repayment data
WO2021164164A1 (en) Storage service quality control method, apparatus and device, and storage medium
WO2020259208A1 (en) Memory scheduling method and apparatus, device and storage medium
US11709707B2 (en) Low latency distributed counters for quotas
WO2023093194A1 (en) Cloud monitoring method and cloud management platform
CN111488373A (en) Method and system for processing request

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22902779

Country of ref document: EP

Kind code of ref document: A1