Pressing rate control method, device and system

By dividing each second into N time points and dynamically adjusting the token bucket size, the problem of QPS surge in the existing technology is solved, precise pressure rate control is achieved, and the pressure capacity loss of the press is reduced.

CN116647512BActive Publication Date: 2025-10-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210136636.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-15
Publication Date
2025-10-21
Estimated Expiration
2042-02-15

AI Technical Summary

Technical Problem

The existing RPS pressure mode and token bucket algorithm cannot dynamically adjust the number of threads, resulting in a sudden increase in QPS. During the test, the QPS may reach 2-3 times the target QPS, resulting in the risk of the tested service being suspended.

Method used

By dividing each second into N time points, if the QPS is greater than N and cannot be divided by N, the token bucket size for K time points is selected as M+1, and the token bucket size for other time points is M, accurately controlling the token issuance.

Benefits of technology

It solves the problem of QPS sudden increase caused by vocabulary or other factors, realizes accurate pressure rate control, and reduces the loss of press pressure capacity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116647512B_ABST
    Figure CN116647512B_ABST
Patent Text Reader

Abstract

The application provides a press rate control method, device and system. The method comprises the following steps: acquiring a query per second (QPS) distributed by a press scheduling device; dividing each second into N time points; if it is determined that the QPS is greater than N and the QPS cannot be divided by N, setting the token bucket size of K time points as M+1; setting the token bucket size of other time points as M; wherein K is the remainder of the QPS divided by N, and M is the quotient of the QPS divided by N; and sending tokens according to the size of the token bucket of each time point. The method can accurately control the press rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of performance testing, and in particular to a pressure generation rate control method, device and system. Background Art

[0002] Current stress modes in performance testing include concurrency based on the number of virtual users and throughput based on requests per second (RPS). Existing RPS stress modes primarily control RPS by limiting the number of concurrent threads and timer counters. The token bucket algorithm is often used for server-side rate limiting, which is achieved by adding tokens to a token bucket at a constant rate.

[0003] In the process of implementing this application, the inventors found that the throughput mode based on RPS can set the expected access volume, but the existing implementation method is to achieve the effect of limiting the overall RPS by limiting the pressure rate of a single thread and setting the number of threads. It relies on reasonable thread settings and cannot dynamically adjust the number of threads. The existing token bucket algorithm can also achieve the purpose of current limiting by issuing tokens equal to the number of queries per second (Query Per Second, QPS) value to the token bucket every second, focusing on process control. In actual test results, since the request vocabulary needs to be loaded before pressure is issued and the vocabulary size is not fixed, requests may be sent unevenly, resulting in a sudden increase in QPS in a certain second. In the test, the sudden increase in QPS is 2-3 times the target QPS, and the tested service is at risk of being interrupted. Summary of the Invention

[0004] In view of this, the present application provides a pressure rate control method, device and system, which can accurately control the pressure rate.

[0005] To solve the above technical problems, the technical solution of this application is implemented as follows:

[0006] In one embodiment, a method for controlling a pressure generation rate is provided, the method comprising:

[0007] Get the number of queries per second (QPS) allocated by the press scheduling device;

[0008] Divide each second into N time points;

[0009] If it is determined that the QPS is greater than N and the QPS is not divisible by N, the token bucket size of K time points is set to M+1; the token bucket size of other time points is set to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N;

[0010] Tokens are sent according to the size of the token bucket at each time point.

[0011] In another embodiment, a pressure rate control device is provided, the device comprising: an acquisition unit, a processing unit, a determination unit, a setting unit, and a sending unit;

[0012] The acquisition unit is used to acquire the number of queries per second (QPS) allocated by the press scheduling device;

[0013] The processing unit is used to divide each second into N time points;

[0014] The determining unit is configured to determine whether the QPS is greater than N;

[0015] The setting unit is configured to, if the determining unit determines that the QPS is greater than N and the QPS is not divisible by N, select K time points and set the token bucket size to M+1; and set the token bucket size at other time points to M; wherein K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N;

[0016] The sending unit sends tokens according to the size of the token bucket at each time point set by the setting unit.

[0017] In another embodiment, a press rate control system is provided, the system comprising: a press scheduling device and a press;

[0018] The press scheduling device is used to allocate QPS to the press;

[0019] The press is used to obtain the number of queries per second (QPS) allocated by the press scheduling device; divide each second into N time points; if it is determined that the QPS is greater than N and the QPS cannot be divided by N, then select the token bucket size of K time points and set it to M+1; the token bucket size of other time points is set to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N; tokens are sent according to the size of the token bucket at each time point.

[0020] In another embodiment, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the pressure rate control method when executing the program.

[0021] In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the steps of the pressure rate control method are implemented.

[0022] As can be seen from the above technical solution, the above embodiment controls token issuance by cutting time into a finer granularity than seconds, which can solve the problem of QPS surge and QPS out of control caused by the vocabulary or other factors, and can accurately control the issuance rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0024] Figure 1 This is a schematic diagram of the pressure rate control process in one embodiment of the present application;

[0025] Figure 2 This is a schematic diagram of the QPS flow chart for the press scheduling device allocation in an embodiment of the present application;

[0026] Figure 3 This is a schematic diagram of the pressure rate control process in another embodiment of the present application;

[0027] Figure 4 This is a schematic diagram of a pressure rate control system in an embodiment of the present application;

[0028] Figure 5 This is a schematic structural diagram of a pressure rate control device in an embodiment of the present application;

[0029] Figure 6 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way are interchangeable where appropriate, so that the embodiments of the invention described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or that are inherent to these processes, methods, products or apparatus.

[0032] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0033] The present invention provides a method for controlling the transmission rate of a data rate control system. This method improves upon the existing token bucket algorithm, combining process control with a results-oriented approach. While limiting the transmission rate of a single QPS, it also incorporates finer granularity than seconds and offset calculation. This algorithm addresses the issues of QPS spikes and instability caused by vocabulary or other factors, achieving precise control of the transmission rate.

[0034] The following describes in detail the process of controlling the pressure rate in accordance with the embodiment of the present application in conjunction with the accompanying drawings.

[0035] See also Figure 1 , Figure 1 This is a schematic diagram of the pressure rate control process in one embodiment of the present application. The specific steps are:

[0036] Step 101: Obtain the QPS assigned by the press scheduling device.

[0037] The press scheduling equipment pre-occupies presses mainly by making full use of press resources through allocation algorithms and accurately calculating the actual pressure load borne by each press.

[0038] See also Figure 2 , Figure 2 This is a schematic diagram of the QPS flow chart for the press scheduling device allocation in an embodiment of the present application.

[0039] The specific steps are:

[0040] Step 201: Obtain the QPS to be allocated.

[0041] When the press scheduling device receives the QPS request task, it obtains the QPS to be allocated.

[0042] Step 202: Obtain a press machine to which QPS can be allocated.

[0043] A press that can allocate QPS is a press that has no QPS allocated, or a press that allocates QPS but does not reach the maximum QPS supported by the press is a press that cannot allocate QPS.

[0044] In specific implementation, the presses that can be assigned QPS can be determined by recording which presses are the presses that can be assigned QPS, or by directly determining which presses are the presses that can be assigned QPS in the following way:

[0045] Determine whether the QPS allocated to the press has reached the maximum QPS of the press. If so, determine that the press is a press that cannot be allocated QPS; otherwise, determine that the press is a press that can be allocated QPS.

[0046] If no press to which QPS can be allocated is obtained, the allocation of QPS is terminated directly.

[0047] In specific implementation, when obtaining a press that can allocate QPS, if there is a press that has already allocated QPS, the press that has already allocated QPS will be given priority.

[0048] Step 203: Determine the QPS that can be allocated to the press.

[0049] The QPS that can be allocated by the press is the difference between the maximum QPS supported by the press and the allocated QPS.

[0050] Step 204 , determining whether the QPS to be allocated is greater than the QPS that can be allocated by the press, if so, executing step 205 ; otherwise, executing step 206 .

[0051] Step 205 : Allocate the allocable QPS to the press, update the QPS to be allocated, and execute step 202 .

[0052] In this step, after allocating the allocable QPS to the press, the press is recorded as a press to which the QPS cannot be allocated.

[0053] Step 206: Allocate the QPS to be allocated to the press.

[0054] After allocating the QPS to be allocated to the press, determine whether all QPS allocated to the press has reached the maximum QPS supported by the press. If so, record the press as a press that cannot allocate QPS; otherwise, record it as a press that can allocate QPS.

[0055] Step 102: Divide each second into N time points.

[0056] Dividing each second into N time points is to control token issuance by cutting time at the millisecond level.

[0057] The value range of N can be [200-5000], and there is no restriction on this in specific implementation.

[0058] Step 103: If it is determined that the QPS is greater than N and the QPS is not divisible by N, the token bucket sizes of K time points are set to M+1; the token bucket sizes of other time points are set to M.

[0059] Where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N;

[0060] In the embodiment of the present application, how the total capacity offset is allocated to the token bucket at the corresponding time point for sending is not limited in the embodiment of the present application:

[0061] For example, it can be random selection, evenly distributed, or selecting the first K time points;

[0062] In the specific implementation of the embodiment of the present application, how to achieve the effect of setting the token bucket size of K time points to M+1 and setting the token bucket size of other time points to M can be achieved by the following but not limited to the following implementation methods:

[0063] Calculate the token bucket size at each time point as M;

[0064] Calculate the total capacity offset of the token bucket as K;

[0065] Traverse the time points. Each time a time point is traversed, the token bucket size of the corresponding time is increased by 1; the total capacity offset of the token bucket is reduced by 1 until the total capacity offset of the token bucket is 0, and the traversal of the time points is ended.

[0066] Step 104: Send tokens according to the size of the token bucket at each time point.

[0067] In this embodiment, token issuance is controlled by cutting time into a granularity finer than seconds, which can solve the problem of QPS surge and QPS out of control caused by the vocabulary or other factors, and can accurately control the issuance rate.

[0068] See also Figure 3 , Figure 3 This is a schematic diagram of the pressure rate control process in another embodiment of the present application. The specific steps are:

[0069] Step 301: Obtain the QPS assigned by the press scheduling device.

[0070] The press scheduling equipment pre-occupies presses mainly by making full use of press resources through allocation algorithms and accurately calculating the actual pressure load borne by each press.

[0071] Step 302: Divide each second into N time points.

[0072] Dividing each second into N time points is to control token issuance by cutting time at the millisecond level.

[0073] In step 303 , if it is determined that the QPS is greater than N and the QPS is not divisible by N, the token bucket sizes of K selected time points are set to M+1; the token bucket sizes of other time points are set to M. Execute step 306 .

[0074] Wherein, K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N.

[0075] If it is determined that the QPS is greater than N and the QPS cannot be divided by N, if N is 1000, it is equivalent to sending M QPS per millisecond and there are K QPS not sent. At this time, the total capacity offset of the token bucket is K.

[0076] The embodiment of the present application does not limit how the total capacity offset is allocated to the token bucket at the corresponding time point for sending:

[0077] For example, it can be random selection, evenly distributed, or selecting the first K time points;

[0078] Get the millisecond token bucket size, that is, determine the number of tokens issued per millisecond.

[0079] In step 304 , if it is determined that the QPS is greater than N and the QPS is divisible by N, the token bucket size at each time point is set to the quotient of the QPS divided by N. Execute step 306 .

[0080] Step 305: If it is determined that the QPS is not greater than N, the token bucket size at the selected QPS time points is set to 1, and the token bucket size at other time points is set to 0.

[0081] In the specific implementation, how to determine which time point to send QPS and which time point not to send QPS is not limited in the embodiment of the present application, such as randomly selecting N time points from the QPS time points to send QPS, selecting the first N time points to send QPS, etc.;

[0082] In the specific implementation of the embodiment of the present application, how to achieve the effect of setting the token bucket size of the selected QPS time point to 1 and the token bucket size of the other time points to 0 can be achieved by, but not limited to, the following methods:

[0083] Set the initial token bucket size at each time point to 0;

[0084] Calculate the total time offset as QPS-N;

[0085] Traverse the time points, and for each time point traversed, increase the token bucket size of the traversed time point by 1, and reduce the total time offset by 1;

[0086] Until the total time offset reaches 0, the traversal of the time points ends.

[0087] Step 306: Send tokens according to the size of the token bucket at each time point.

[0088] In the embodiment of the present application, the value range of N can be [200-5000], which is not limited in the specific implementation, for example, it can be 1000, 500, 2000, etc.

[0089] The following examples illustrate the determination of the token bucket size at the corresponding time point based on N being 1000, 500, or 2000:

[0090] Assume that the QPS is 1500 and N is 1000, and divide each second into 1000 time points;

[0091] Compare the size of 1500 and 1000;

[0092] Determine that 1500 is greater than 1000 and the 1500 is not divisible by 1000, then select 500 (the remainder of 1500 divided by 1000) time points and set the token bucket size to 1 (the quotient of 1500 divided by 1000) + 1 = 2; the token bucket size of the other 500 time points is set to 1.

[0093] Assume that the QPS is 1500 and N is 500, and divide each second into 500 time points;

[0094] Compare the sizes of 1500 and 500;

[0095] It is determined that 1500 is greater than 500 and 1500 is divisible by 500, so the token bucket size at each time point is set to 1500 / 500=3.

[0096] Assuming the QPS is 1500 and N is 2000, each second is divided into 2000 time points;

[0097] Compare the sizes of 1500 and 2000;

[0098] If 1500 is less than 2000, the token bucket size of 1500 time points is set to 1, and the token bucket size of the remaining 500 time points is set to 0.

[0099] In this embodiment, token issuance is controlled by cutting the time into milliseconds, which can solve the problem of QPS surge and QPS out of control caused by the vocabulary or other factors, and can accurately control the issuance rate.

[0100] After testing, it was found that if milliseconds were used to control token sending, the press's pressure-generating capacity would only be reduced by 0.125 times.

[0101] The present application also provides a pressure rate control system. Figure 4 , Figure 4 This is a schematic diagram of a press rate control system in an embodiment of the present application. The system includes: a press scheduling device and a press;

[0102] Press scheduling equipment, used to allocate QPS to presses;

[0103] A press is used to obtain the number of queries per second (QPS) allocated by the press scheduling device; divide each second into N time points; if it is determined that the QPS is greater than N and the QPS cannot be divided by N, then select K time points and set the token bucket size to M+1; the token bucket size of other time points is set to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N; and tokens are sent according to the size of the token bucket at each time point.

[0104] If it is determined that the QPS is greater than N, and the QPS is divisible by N, then the token bucket size at each time point is set to the quotient of QPS divided by N;

[0105] If it is determined that the QPS is not greater than N, the token bucket size at the selected QPS time points is set to 1, and the token bucket size at other time points is set to 0.

[0106] The specific process of the press scheduling device allocating QPS to the press is as follows:

[0107] Get the QPS to be allocated;

[0108] Get a press that can allocate QPS;

[0109] The QPS that the press can allocate is determined.

[0110] Determine whether the QPS to be allocated is greater than the QPS that can be allocated by the press. If not, allocate the QPS to be allocated to the press; if yes, allocate the allocatable QPS to the press, update the QPS to be allocated, and obtain the press that can allocate the QPS again until the QPS to be allocated is allocated or there is no press that can allocate the QPS.

[0111] Wherein, it is determined whether the QPS allocated to the press has reached the maximum QPS of the press. If so, the press is determined to be a press that cannot be allocated QPS; otherwise, the press is determined to be a press that can be allocated QPS.

[0112] in,

[0113] When selecting a press for QPS allocation from among the presses that can be allocated QPS, if there is a press that has already been allocated QPS, the press that has been allocated QPS will be given priority.

[0114] Based on the same inventive concept, the present application also provides a pressure rate control device. Figure 5 , Figure 5This is a schematic diagram of the structure of the pressure rate control device in an embodiment of the present application. The device includes: an acquisition unit 501, a processing unit 502, a determination unit 503, a setting unit 504 and a sending unit 505;

[0115] An acquiring unit 501 is configured to acquire the number of queries per second (QPS) allocated by a press scheduling device;

[0116] A processing unit 502 is configured to divide each second into N time points;

[0117] A determining unit 503 is configured to determine whether the QPS is greater than N;

[0118] A setting unit 504 is configured to, if the determining unit 503 determines that the QPS is greater than N and the QPS is not divisible by N, select K time points and set the token bucket size to M+1; and set the token bucket size at other time points to M; where K is the remainder of the QPS divided by N, and M is the quotient of the QPS divided by N;

[0119] The sending unit 505 sends tokens according to the size of the token bucket at each time point set by the setting unit 504.

[0120] In another embodiment,

[0121] Setting unit 504 is specifically used to calculate the token bucket size at each time point as M; calculate the total capacity offset of the token bucket as K; traverse the time points, and add 1 to the token bucket size of the corresponding time at each time point traversed to a time point; reduce the total capacity offset of the token bucket by 1 until the total capacity offset of the token bucket is 0, and end the traversal of the time points.

[0122] The setting unit 504 is further configured to set the token bucket size at each time point to the quotient of QPS divided by N if the determining unit 503 determines that the QPS is greater than N and the QPS is divisible by N.

[0123] In another embodiment,

[0124] The setting unit 504 is further configured to set the token bucket size of QPS time points to 1 if the determining unit 503 determines that the QPS is not greater than N, and set the token bucket size of other time points to 0.

[0125] In another embodiment,

[0126] The setting unit 504 is specifically used to set the initial token bucket size of each time point to 0; calculate the total time offset as QPS-N; traverse the time points, and each time a time point is traversed, the token bucket size of the traversed time point is increased by 1, and the total time offset is reduced by 1; until the total time offset is 0, the traversal of the time points is ended.

[0127] The units in the above embodiments may be integrated into one body or deployed separately; they may be combined into one unit or further divided into multiple sub-units.

[0128] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the voltage control rate method are implemented when the processor executes the program.

[0129] In another embodiment, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps in the pressure rate control method can be implemented.

[0130] Figure 6 Schematic diagram of the physical structure of the electronic device provided by the embodiment of the present invention. Figure 6 As shown, the electronic device may include: a processor (Processor) 610, a communication interface (Communications Interface) 620, a memory (Memory) 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the following method:

[0131] Get the number of queries per second (QPS) allocated by the press scheduling device;

[0132] Divide each second into N time points;

[0133] If it is determined that the QPS is greater than N and the QPS is not divisible by N, the token bucket size of K time points is set to M+1; the token bucket size of other time points is set to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N;

[0134] Tokens are sent according to the size of the token bucket at each time point.

[0135] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0137] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.

[0138] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A pressure generating rate control method, characterized in that: The method comprises: Get the number of queries per second (QPS) allocated by the press scheduling device; Divide each second into N time points; If it is determined that the QPS is greater than N and the QPS is not divisible by N, the token bucket size of K time points is set to M+1; the token bucket size of other time points is set to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N; Send tokens according to the size of the token bucket at each time point; The method further includes: if it is determined that the QPS is greater than N, and the QPS is divisible by N, setting the token bucket size at each time point to the quotient of the QPS divided by N; If it is determined that the QPS is not greater than N, the token bucket size at the selected QPS time points is set to 1, and the token bucket size at other time points is set to 0.

2. The method according to claim 1, characterized in that The token bucket size of the selected K time points is set to M+1; the token bucket size of other time points is set to M, including: Calculate the token bucket size at each time point as M; Calculate the total capacity offset of the token bucket as K; Traverse the time points. Each time a time point is traversed, the token bucket size of the corresponding time is increased by 1; the total capacity offset of the token bucket is reduced by 1 until the total capacity offset of the token bucket is 0, and the traversal of the time points is ended.

3. The method according to claim 1, characterized in that The token bucket size of the selected QPS time points is set to 1, and the token bucket size of other time points is set to 0, including: Set the initial token bucket size at each time point to 0; Calculate the total time offset as QPS-N; Traverse the time points, and for each time point traversed, increase the token bucket size of the traversed time point by 1, and reduce the total time offset by 1; Until the total time offset reaches 0, the traversal of the time points ends.

4. The method according to any one of claims 1 to 3, characterized in that The press scheduling device allocates QPS, including: Get the QPS to be allocated; Get a press that can allocate QPS; Determining the QPS allocatable to the press; Determine whether the QPS to be allocated is greater than the QPS that can be allocated by the press. If not, allocate the QPS to be allocated to the press; if yes, allocate the allocatable QPS to the press, update the QPS to be allocated, and obtain the press that can allocate the QPS again until the QPS to be allocated is allocated or there is no press that can allocate the QPS.

5. The method according to claim 4, characterized in that Determine whether the press is a QPS-assignable press, including: Determine whether the QPS allocated to the press has reached the maximum QPS of the press. If so, determine that the press is a press that cannot be allocated QPS; otherwise, determine that the press is a press that can be allocated QPS.

6. The method according to claim 4, characterized in that The method further comprises: When selecting a press for QPS allocation from among the presses that can be allocated QPS, if there is a press that has already been allocated QPS, the press that has been allocated QPS will be given priority.

7. A pressure rate control device, characterized in that: The device includes: an acquisition unit, a processing unit, a determination unit, a setting unit and a sending unit; The acquisition unit is used to acquire the number of queries per second (QPS) allocated by the press scheduling device; The processing unit is used to divide each second into N time points; The determining unit is configured to determine whether the QPS is greater than N; The setting unit is configured to, if the determining unit determines that the QPS is greater than N and the QPS is not divisible by N, select K time points and set the token bucket size to M+1; and set the token bucket size at other time points to M; wherein K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N; The sending unit sends tokens according to the size of the token bucket at each time point set by the setting unit; If the determining unit determines that the QPS is greater than N and the QPS is divisible by N, then setting the token bucket size at each time point to the quotient of the QPS divided by N; If the determining unit determines that the QPS is not greater than N, the token bucket sizes at the selected QPS time points are set to 1, and the token bucket sizes at other time points are set to 0.

8. A pressure generation rate control system, characterized in that: The system includes: a press scheduling device and a press; The press scheduling device is used to allocate QPS to the press; The press is configured to obtain the number of queries per second (QPS) assigned by the press scheduling device; divide each second into N time points; if it is determined that the QPS is greater than N and the QPS is not divisible by N, set the token bucket size of K time points to M+1; and set the token bucket size of other time points to M; where K is the remainder of QPS divided by N, and M is the quotient of QPS divided by N; and send tokens according to the size of the token bucket at each time point; If it is determined that the QPS is greater than N, and the QPS is divisible by N, then the token bucket size at each time point is set to the quotient of QPS divided by N; If it is determined that the QPS is not greater than N, the token bucket size at the selected QPS time points is set to 1, and the token bucket size at other time points is set to 0.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method and device for dividing filling rate interval based on token bucket algorithm

    CN101778043A

  • Flow control method and device and storage medium

    CN110198272A