CN113469661A - Service current limiting method, device, computer equipment and storage medium - Google Patents
Service current limiting method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN113469661A CN113469661A CN202110824360.3A CN202110824360A CN113469661A CN 113469661 A CN113469661 A CN 113469661A CN 202110824360 A CN202110824360 A CN 202110824360A CN 113469661 A CN113469661 A CN 113469661A
- Authority
- CN
- China
- Prior art keywords
- user
- current
- service
- current limiting
- queuing
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 101
- 238000003860 storage Methods 0.000 title claims abstract description 22
- 238000012545 processing Methods 0.000 claims abstract description 159
- 238000012795 verification Methods 0.000 claims description 27
- 230000007246 mechanism Effects 0.000 claims description 26
- 230000008569 process Effects 0.000 claims description 20
- 230000001960 triggered effect Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 6
- 239000002699 waste material Substances 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000011664 signaling Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000593 degrading effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 230000001172 regenerating effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/10—Office automation; Time management
- G06Q10/103—Workflow collaboration or project management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0631—Resource planning, allocation, distributing or scheduling for enterprises or organisations
- G06Q10/06316—Sequencing of tasks or work
Landscapes
- Business, Economics & Management (AREA)
- Human Resources & Organizations (AREA)
- Engineering & Computer Science (AREA)
- Strategic Management (AREA)
- Entrepreneurship & Innovation (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Marketing (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Tourism & Hospitality (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Development Economics (AREA)
- Educational Administration (AREA)
- Game Theory and Decision Science (AREA)
- Telephonic Communication Services (AREA)
Abstract
The embodiment of the invention discloses a method and a device for limiting service current, computer equipment and a storage medium. The service current limiting method is applied to a current limiting rear end, and specifically comprises the following steps: acquiring a service current limiting processing request sent by a current limiting front end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence; and performing service current limiting processing on the user according to the service application authority of the user. The technical scheme of the embodiment of the invention can effectively control the flow of the current-limiting service, reduce the back-end processing pressure of the service current limitation and improve the user experience.
Description
Technical Field
The embodiment of the invention relates to the technical field of internet data processing, in particular to a service current limiting method, a service current limiting device, computer equipment and a storage medium.
Background
High concurrency means that a large number of user requests arrive at the server at the same time, and the server needs to process the requests and return response information in time. With the development of internet technology, high-concurrency scenes are increasing, and common countermeasures of a high-concurrency system comprise caching, current limiting and degrading. Wherein the throttling relieves server stress by reducing the frequency of requests.
The existing current limiting mostly adopts a thread number current limiting method, a front-end current limiting method and the like. The thread number current limiting method actively returns the transaction which reaches the maximum thread number and cannot be processed to achieve the purpose of current limiting by calculating the thread number of a single container; the front-end flow limiting control method reduces the pressure of the server by controlling the click times of a user through the front end, so as to achieve the purpose of limiting the flow.
In the process of implementing the invention, the inventor finds that the prior art has the following defects: in the aspect of performance, the thread number flow limiting method can only control the flow of a single container, the request reaching the thread number is returned by the server to be limited, the front end prompts that a user cannot respond, the performance of the server cannot be accurately calculated aiming at the multi-container service, and if the distribution is not uniform, the resource waste of the server can be caused; the front-end flow limiting control method can only control the user click frequency, cannot monitor the back-end service performance, and cannot fully utilize the server performance. In the aspect of experience: the thread number current limiting method can not process direct response of transactions exceeding the thread number, a user needs to click a request again to realize triggering, a server can not be recovered in a peak period, and the experience received by the user is not good because the front end can not judge the performance of the back end; the front-end flow limiting control method has the advantages that a user needs to wait for a long time to trigger again after clicking each time, and the use experience is not friendly.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for limiting a flow of a service, a computer device, and a storage medium, which effectively control a flow of a flow-limiting service, reduce a back-end processing pressure of the flow-limiting service, and improve user experience.
In a first aspect, an embodiment of the present invention provides a method for limiting a service current, where the method is applied to a current-limiting backend; the method comprises the following steps:
acquiring a service current limiting processing request sent by a current limiting front end;
determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence;
and performing service current limiting processing on the user according to the service application authority of the user.
In a second aspect, an embodiment of the present invention further provides a service current limiting device, configured at a current limiting backend, including:
the service current limiting processing request acquisition module is used for acquiring a service current limiting processing request sent by a current limiting front end;
the service application authority determining module of the user is used for determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence;
and the service current limiting processing execution module is used for performing service current limiting processing on the user according to the service application authority of the user.
In a third aspect, an embodiment of the present invention further provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the traffic throttling method provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the service throttling method provided in any embodiment of the present invention.
The embodiment of the invention obtains the service current limiting processing request sent by the current limiting front end through the current limiting back end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending and current limiting strategy processed according to a user queuing sequence number sequence; the method further carries out service current limiting processing on the user according to the service application authority of the user, solves the problems of server resource waste, poor user experience and the like in the prior art, thereby effectively controlling the flow of the current limiting service, reducing the back-end processing pressure of the service current limiting and improving the user experience.
Drawings
Fig. 1 is a flowchart of a method for limiting traffic flow according to an embodiment of the present invention;
fig. 2 is a flowchart of a service current limiting method according to a second embodiment of the present invention;
fig. 3 is a schematic flow chart of a service current limiting method according to a third embodiment of the present invention;
fig. 4 is a schematic flowchart of a token bucket throttling policy according to a third embodiment of the present invention;
FIG. 5 is a schematic diagram of token bucket throttling according to a third embodiment of the present invention;
fig. 6 is a schematic flow chart of a signaling current limiting strategy according to a third embodiment of the present invention;
fig. 7 is a schematic diagram of a traffic current limiting apparatus according to a fourth embodiment of the present invention;
fig. 8 is a schematic structural diagram of a computer device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention.
It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The terms "first" and "second," and the like in the description and claims of embodiments of the invention and in the drawings, are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not set forth for a listed step or element but may include steps or elements not listed.
Example one
Fig. 1 is a flowchart of a service current limiting method according to an embodiment of the present invention, where this embodiment may be applicable to a case where a signaling current limiting policy is used to limit current for various services that need to be limited, and the method may be executed by a service current limiting device, where the device may be implemented in a software and/or hardware manner, and may generally be directly integrated in a computer device that executes the method, where the computer device may be a current limiting backend device, such as a server that implements a current limiting function. Specifically, as shown in fig. 1, the method is applied to the current-limiting rear end, and specifically includes the following steps:
s110, acquiring a service current limiting processing request sent by a current limiting front end.
The flow limiting front end may be used for a user to trigger a service flow limiting processing request, and may be a client, for example. The traffic throttling processing request may be a traffic throttling processing request generated by a user-triggered throttling front end in a traffic throttling scenario. For example, the service current limiting scenario may be a scenario that current limiting is required when a second-killing and first-aid purchase is performed, or may be a scenario that current limiting is required when a service of an automated production system is in a peak period, or any other scenario that current limiting is required.
In the embodiment of the invention, after a user triggers a service current limiting processing request at the current limiting front end, the current limiting front end can send the service current limiting processing request to the current limiting back end, and at the moment, the current limiting back end can obtain the service current limiting processing request.
S120, determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number.
The current limiting policy may be a policy for limiting a current of the service current limiting processing request when the service current limiting processing request is too many, so as to implement current limiting processing of the service. For example, the throttling policy may include, but is not limited to, a layer-by-layer throttling policy, a number-sending throttling policy, a token bucket throttling policy, and the like, which is not limited by the embodiment of the present invention. The service application permission may be a service permission corresponding to the service current limiting scenario, for example, a second killing permission for killing the robbery service in seconds, or a production permission for the automated production service, and the like. The user queuing serial number may be a queuing serial number issued by the current limiting back end to the user after the user triggers the service current limiting processing request of the current limiting front end in the service current limiting scenario, and may be, for example, a simple digital serial number, or may also be a digital combination serial number with a certain setting rule, and the like. For example, the current limiting backend may issue a user queuing number with a queuing number of "0010" to the 10 th user that triggers the traffic current limiting processing request. Or, the current-limiting back end may also issue a user queuing sequence number with a queuing sequence number of "current time + N" to the nth user that triggers the service current-limiting processing request. The signaling current-limiting policy may be a current-limiting policy processed by the current-limiting back end according to the sequence of the user queuing serial numbers, for example, the current-limiting policy may be processed sequentially according to the user queuing serial numbers, or may be processed sequentially in batch according to the user queuing serial numbers, and the like. For example, after acquiring the service current limiting processing request with the user queuing serial number N, the current limiting back end may sequentially acquire the service current limiting processing requests with the user queuing serial number N + 1. Or, after acquiring the service current limiting processing request with the user queuing serial number N, the current limiting back end may acquire the service current limiting processing requests with the user queuing serial numbers N to N + K, where K is the number of service current limiting processing requests processed by the set current limiting back end each time.
In the embodiment of the invention, after the current-limiting back end acquires the service current-limiting processing request sent by the current-limiting front end, a number-sending current-limiting strategy processed according to the sequence of the queuing number of the user can be further adopted according to the service current-limiting processing request so as to determine the service application permission of the user.
S130, performing service current limiting processing on the user according to the service application authority of the user.
The service throttling processing may be a response of the throttling back end to a service throttling processing request of the user, for example, the user may be allowed to execute the service operation, or the user may not be allowed to execute the service operation, and the specific content of the service throttling processing is not limited in the embodiment of the present invention. For example, in an application scenario of second-killing and first-order purchasing, the service throttling process may be to allow the user to perform second-killing operations, such as following order and payment service flow operations.
In the embodiment of the invention, after the current-limiting back end determines the service application authority of the user by adopting the current-limiting strategy according to the service current-limiting processing request, the service current-limiting processing can be further carried out on the user according to the service application authority of the user, so that the purpose of service current limiting is achieved. It can be understood that, if the user obtains the service application permission, which indicates that the user has the permission to execute the service operation, the current limiting back end may respond to the service current limiting processing request of the user to execute the corresponding service operation. If the user does not obtain the service application permission, which indicates that the user does not have the permission to execute the service operation, the current-limiting back end can respond to the service current-limiting processing request of the user without executing the service operation. For example, in an application scenario of a second killing and first-time purchasing service, if a user obtains a second killing right, the user may perform a second killing operation. Accordingly, if the user does not obtain the second killing authority, the user cannot perform the second killing operation.
The embodiment of the invention obtains the service current limiting processing request sent by the current limiting front end through the current limiting back end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending and current limiting strategy processed according to a user queuing sequence number sequence; the method further carries out service current limiting processing on the user according to the service application authority of the user, solves the problems of server resource waste, poor user experience and the like in the prior art, thereby effectively controlling the flow of the current limiting service, reducing the back-end processing pressure of the service current limiting and improving the user experience.
Example two
Fig. 2 is a flowchart of a traffic throttling method according to a second embodiment of the present invention. The embodiment is a further refinement of the above technical solutions, and provides various specific optional implementation manners for obtaining a service current limiting processing request sent by a current limiting front end, determining a service application permission of a user by using a current limiting policy according to the service current limiting processing request, and performing service current limiting processing on the user according to the service application permission of the user. The solution in this embodiment may be combined with the individual alternatives in one or more of the embodiments described above.
In an optional implementation manner of the embodiment of the present invention, the traffic throttling processing request may include a first queuing request.
Accordingly, as shown in fig. 2, the method of the present embodiment may include the following steps:
s210, a first queuing request sent by the current limiting front end is obtained.
The first queuing request may be a queuing request generated by a user triggering the current limiting front end, or a queuing request re-triggered by the user after the user does not obtain a service application right, and the like. Alternatively, the first queuing request may be the first queuing request sent by the user through the current limiting front-end at each round of participation in the service.
Specifically, the service current limiting processing request sent by the current limiting front end acquired by the current limiting back end may include a first queuing request sent by the current limiting front end.
In an optional implementation manner of the embodiment of the present invention, the current limiting front end may include a current limiting component, and the current limiting component may include a service submission button and a current limiting switch; when the service submitting button is triggered by the user and the current limiting switch is in an open state, the current limiting component generates the service current limiting processing request and sends the service current limiting processing request to the current limiting rear end; and under the condition that the service submission button is triggered by the user and the current limiting switch is in a closed state, the current limiting component executes a service processing flow under an infinite flow state.
The current limiting component may be a component for limiting current disposed at a front end of the current limiting. The business submission button may be a precondition to enter an activity page, which may be used for a user to submit a business operation. For example, in the second-killing and first-order-purchasing service, the service submitting button may be a "purchase" button or a "second-killing" button, which is not limited in this embodiment of the present invention. The current limit switch may be used to open or close a current limit switch. It is understood that in a service scenario where current limiting is required, a current limit switch may be opened to limit the current of the service. Accordingly, in a service scenario where current limiting is not required, the current limiting switch may be turned off to process the service normally. The service processing flow may be a flow for performing processing operation on a service, for example, a flow for performing processing operation on a service by a current limiting front end when current limiting is not needed, or a flow for performing processing operation on a service after current limiting is performed by a current limiting back end when current limiting is needed, which is not limited in the embodiment of the present invention.
Specifically, after a service submission button at the current limiting front end is triggered by a user, whether a current limiting switch is in an open state or not can be further judged, if the current limiting switch is in the open state and indicates that current limiting is required, a current limiting component at the current limiting front end generates a service current limiting processing request and sends the service current limiting processing request to the current limiting rear end; if the current limiting switch is in a closed state, which indicates that current limiting is not needed, the current limiting component at the front end of the current limiting executes a service processing flow in an infinite flow state.
Typically, the current limit front-end generates a first queuing request when a user first triggers a service submit button of the current limit front-end. Or, when the user fails to participate in the current limiting service again and re-participates in the current limiting service, and the service submission button of the current limiting front end is re-triggered, the current limiting front end also generates a first queuing request.
S220, generating a user queuing sequence number of the user according to the first queuing request.
In the embodiment of the present invention, after the current-limiting back end receives the first queuing request in the service current-limiting processing request sent by the current-limiting front end, a user queuing number of the user may be further generated according to the first queuing request, so as to determine the service application permission of the user.
In an optional implementation manner of the embodiment of the present invention, generating the user queuing number of the user according to the first queuing request may include: and under the condition that the first queuing request does not comprise the user queuing serial number, acquiring the current queuing serial number, and distributing the user queuing serial number to the user according to the current queuing serial number.
Wherein the current queuing number may be the largest queuing number that has been currently assigned to the user.
Specifically, the user queue number assigned to the user according to the current queue number may be a user queue number assigned to "current queue number + 1", for example, if the current queue number is 54, the user queue number assigned to the user may be 55. Or the user queuing number can be distributed to the user according to the current queuing number according to a set rule. The embodiments of the present invention do not limit this.
In this embodiment of the present invention, after the current limiting backend obtains the first queuing request, it may be further determined whether the first queuing request includes the user queuing number. And if the user queuing sequence number is not included, distributing the user queuing sequence number to the user according to the current queuing sequence number. It will be appreciated that typically the first queuing request is the first queuing request triggered by a user, and no user queuing number has been assigned to the user making the request, so that the user initiating the first queuing request may be assigned a user queuing number. If the first queuing request is the first queuing request which is re-triggered by the user after the user does not obtain the service application authority, a new user queuing number needs to be re-allocated to the user.
And S230, generating expected admission time of the user according to the current system time, the user queuing serial number, the current admission serial number and the current limiting rate.
Wherein the current system time may be the system time when the user clicks the service submit button at the current limit front-end point. The current admission sequence number may be the largest sequence number that can currently obtain the service application authority. The current limit rate may be the time required for the current limit back-end to perform a traffic processing flow for one user. The expected admission time may be an expected time for a user to obtain service application authority.
In the embodiment of the present invention, after the current limit back end generates the user queuing serial number of the user, the expected admission time of the user can be further generated according to the current system time, the user queuing serial number, the current admission serial number and the current limit rate, so as to determine whether the user passes the first request verification.
In an optional implementation manner of the embodiment of the present invention, the current admission sequence number may be determined based on the following formula: current admission sequence number + last admission sequence number (current user expected admission time-last time of refresh of admission sequence number) current limit rate.
The last admission serial number may be a queuing serial number of a last admitted user allowed to obtain the service application authority by the current limiting backend. The current user expected admission time may be an expected time that a user currently allowed to obtain the service application authority is allowed to obtain the service application authority. The last time of refreshing the admission sequence number may be the system time when the user corresponding to the last admission sequence number obtains the service application right.
Specifically, after the current limit back end obtains the last admission sequence number, the expected admission time of the current user, the last time refreshing time of the admission sequence number, and the current limit rate, the method may further include: and calculating the current admission sequence number (the last admission sequence number + (the expected admission time of the current user-the last refreshing time of the admission sequence number)) and the current flow limiting rate so as to further calculate the expected admission time of the user.
In an optional implementation manner of the embodiment of the present invention, the generating an expected admission time of the user according to the current system time, the user queuing number, the current admission number, and the current throttling rate may include: according to the formula: and the expected admission time is equal to the current time + (user queuing number-current admission number)/the current limiting rate, and the expected admission time of the user is generated.
Specifically, after the user queuing serial number of the user is generated at the current limiting back end, the current admission serial number can be further calculated, and then according to the formula: the expected admission time is current time + (user queuing number-current admission number)/current limiting rate, and the expected admission time of the user is generated so as to determine whether the user passes the first request authentication.
S240, verifying the user queuing sequence number according to the first queuing request.
In the embodiment of the present invention, after the current-limiting back end generates the user queuing serial number of the user according to the first queuing request, the user queuing serial number can be further verified according to the first queuing request to determine whether the user queuing serial number belongs to the current access serial number range, that is, whether the user sending the first queuing request can obtain the service application permission is determined.
S250, judging whether the user queuing serial number belongs to the current access serial number range; if not, go to S260, and if so, go to S270.
The current admission sequence number range may be a sequence number range which is preset at the back end of the current limit and allows obtaining the service application authority.
In the embodiment of the invention, after the current-limiting back end verifies the user queuing sequence number according to the first queuing request, whether the user queuing sequence number belongs to the current access sequence number range can be further judged. It can be understood that if the queuing number of the user belongs to the current access number range, which indicates that the user can perform the service operation, the user can obtain the service application authority. Correspondingly, if the queuing number of the user does not belong to the range of the current access number, which indicates that the user cannot execute the service operation, the user cannot obtain the service application authority.
In an optional implementation manner of the embodiment of the present invention, determining that the user queuing number belongs to the current admission number range may include: under the condition that the user queuing serial number is determined to be smaller than or equal to the current access serial number, determining that the user queuing serial number belongs to the current access serial number range; and/or determining that the user queuing sequence number belongs to the current admission sequence number range under the condition that the expected admission time corresponding to the user queuing sequence number is determined to be less than or equal to the current time.
The current time may be the system current time corresponding to the current admission sequence number.
Specifically, if the user queuing sequence number is less than or equal to the current admission sequence number, it may be determined that the user queuing sequence number belongs to the current admission sequence number range. And/or if the expected admission time corresponding to the user queuing sequence number is less than or equal to the current time, determining that the user queuing sequence number belongs to the current admission sequence number range.
And S260, determining that the user queuing sequence number does not pass the first request verification.
In the embodiment of the invention, if the current limiting back end judges that the user queuing serial number does not belong to the range of the current access serial number, which indicates that the user can not execute the service operation, the user queuing serial number can be determined not to pass the first request verification, namely the user can not obtain the service application authority.
In an optional implementation manner of the embodiment of the present invention, after determining that the user queue number fails to pass the first request verification, the method may further include: acquiring a user queuing result; the user queuing result comprises at least one of a user queuing serial number, a current admission serial number and expected admission time; and feeding back the user queuing result to the current-limiting front end so as to display the user queuing result to the user in real time through the current-limiting front end.
The user queuing result may be a queuing result of the user, for example, the number of serial numbers that the user needs to wait, or the time that the user needs to wait, and the like, which is not limited in the embodiment of the present invention.
Specifically, if the user queuing serial number does not pass the first request verification, the current-limiting back end obtains at least one of the user queuing serial number, the current admission serial number and the expected admission time in the user queuing result, and feeds back the user queuing result to the current-limiting front end, so that the user queuing result is displayed in real time through the current-limiting front end.
In an optional implementation manner of the embodiment of the present invention, the service flow limitation processing request may further include a second queuing request; after determining that the user queue number is not verified by the first request, the method may further include: verifying the queuing number of the user again according to the second queuing request; under the condition that the user queuing serial number is determined to belong to the range of the current access serial number, determining that the user queuing serial number passes the second request verification, and generating the service application authority of the user; and under the condition that the queuing serial number of the user is determined not to belong to the range of the current access serial number, determining that the user does not pass the second request verification, and refusing to generate the service application authority of the user.
The second queued request may be another queued request of the user, and may be a queued request that is automatically generated by the current limiting backend after the user fails to verify the first request, which is not limited in the embodiment of the present invention. The second request verification may be verification of a second queuing request of the user by the current limiting backend to determine whether the user can obtain the service application authority.
Specifically, after the current-limiting back-end determines that the user queuing number fails the first request verification, the current-limiting front-end may automatically trigger the second queuing request according to the expected admission time of the user. For example, when the current system time reaches the expected admission time of the user, the current limit front-end automatically generates and sends a second queued request of the user to the current limit back-end. The back end of the current limit can further verify the queuing number of the user again according to the second queuing request in the service current limit processing request. If the user queue serial number belongs to the range of the current access serial number, which indicates that the user can execute the service operation, the user queue serial number is determined to pass the second request verification, so as to generate the service application authority of the user. And if the user queuing serial number does not belong to the range of the current admission serial number, which indicates that the user can not execute the service operation, determining that the user does not pass the second request verification so as to refuse to generate the service application authority of the user.
It should be noted that, in general, the processing speed of the current-limiting backend for the queued request is constant, and the processing performance of the current-limiting backend for the queued request is also known. Therefore, the expected admission time calculated by the current limiting back-end is typically more accurate. That is, when the current system time reaches the expected admission time, the queuing request triggered by the user is normally processed.
S270, determining that the user queuing serial number passes the first request verification, and generating the service application authority of the user.
The first request verification may be verification of a current limiting backend on a first queuing request of a user to determine whether the user can obtain a service application right.
In the embodiment of the invention, if the current limiting back end judges that the user queuing serial number belongs to the range of the current access serial number, which indicates that the user can execute the service operation, the user queuing serial number can be determined to pass the first request verification, so as to further generate the service application authority of the user.
In an optional implementation manner of the embodiment of the present invention, after generating the service application authority of the user, the method may further include: and updating the last refresh time of the admission sequence number according to the expected admission time of the current user.
Specifically, after the current-limiting back end generates the service application authority of the user, the last time refreshing time of the admission sequence number may be further updated according to the expected admission time of the current user, so that the current-limiting back end may determine the current admission sequence number according to the last time refreshing time of the admission sequence number. Specifically, the current limiting backend may directly use the expected admission time of the current user as the last time refreshing time of the admission sequence number. That is, each pair of users at the current-limiting back end generates a service application authority, and then the time when the user acquires the service application authority can be used as the last time refreshing time of the admission serial number.
S280, performing service current limiting processing on the user according to the service application authority of the user.
In an optional implementation manner of the embodiment of the present invention, performing service flow limitation processing on a user according to a service application authority of the user may include: under the condition that the user is determined to obtain the service application authority, executing a service processing flow according to a service processing request submitted by the user; under the condition that the user is determined not to acquire the service application authority, triggering an authority acquisition overtime mechanism; and triggering the current-limiting front end to execute the authority acquisition overtime process through an authority acquisition overtime mechanism.
The permission obtaining timeout mechanism may be a mechanism triggered when the user does not obtain the service application permission, for example, the permission obtaining timeout mechanism may be a waiting mechanism, a retry mechanism, or a direct current limiting mechanism. The authority acquisition timeout procedure may be a process procedure corresponding to the authority acquisition timeout mechanism. Illustratively, if the permission acquisition timeout mechanism is a wait mechanism, the permission acquisition timeout flow may be a wait process flow corresponding to the wait mechanism. If the rights acquisition timeout mechanism is a retry mechanism, the rights acquisition timeout procedure may be a retry process procedure corresponding to the retry mechanism. If the rights acquisition timeout mechanism is a direct current limit mechanism, the rights acquisition timeout procedure may be a direct current limit processing procedure corresponding to the direct current limit mechanism. The embodiments of the present invention do not limit this.
Specifically, after the current-limiting back end determines the service application authority of the user by using the current-limiting strategy according to the service current-limiting processing request, the service processing flow can be further executed according to the service processing request submitted by the user when the user is determined to obtain the service application authority. For example, in a second killing and first-aid purchasing service scenario, when the user acquires the second killing authority, the current-limiting back end may perform operations such as payment and purchase according to a second killing service processing request submitted by the user. And if the user is determined not to acquire the service application permission, triggering a permission acquisition timeout mechanism so as to trigger the current-limiting front end to execute a permission acquisition timeout process through the permission acquisition timeout mechanism. For example, in a second killing and robbery service scenario, when a user does not acquire a second killing service application right, the current-limiting back end may trigger a second killing waiting mechanism, so that the current-limiting front end executes a second killing waiting operation, so that the user waits, and the problem of increased server pressure caused by multiple second killing requests triggered is avoided.
In an optional implementation manner of the embodiment of the present invention, executing a business processing flow according to a business processing request submitted by a user may include: verifying the service application authority of the user according to the service processing request; and under the condition that the user is determined to have the service application authority, responding to the service processing request, and executing the service processing flow.
Specifically, after the current-limiting back end determines that the user acquires the service application permission, in order to avoid a system leak causing the user to skip a number-sending current-limiting process and directly acquire the service application permission, the current-limiting back end may further verify the service application permission of the user according to the service processing request. If the user is determined to have the service application authority, the current-limiting back end responds to a service processing request sent by the current-limiting front end so as to execute a service processing flow; otherwise, the current-limiting back end sends a verification failure report to enable the current-limiting front end to display a prompt for triggering the service current-limiting processing request again to the user, so that the user can trigger the current-limiting front end to obtain the latest service current-limiting processing request again.
On the basis of the technical scheme, the current limiting strategy can also comprise a token bucket current limiting strategy; the token bucket current limiting strategy issues tokens to the user according to the configuration parameters of the token bucket current limiting strategy so as to determine the service application authority of the user; the configuration parameters of the token bucket current limiting strategy comprise the number of released tokens per second, the size of a token bucket and waiting time; the method further comprises the following steps: under the condition that a token bucket current limiting strategy is adopted to determine that a user does not acquire a service application authority according to a service current limiting processing request, feeding back a preset display technique to a current limiting front end so as to display the preset display technique to the user in real time through the current limiting front end; after the interval waiting time, the error information is fed back to the current limiting front end, so that the service current limiting processing request is regenerated through the current limiting front end.
Where the latency may be a client retry interval allowed by the current limit front-end. The preset display dialog may be used to remind the user to wait, for example, "in-line … …," and the specific content of the preset display dialog is not limited by the embodiment of the present invention.
Specifically, after the current-limiting back end obtains the service current-limiting processing request sent by the current-limiting front end, the current-limiting back end can further determine the service application permission of the user by adopting a token bucket current-limiting strategy according to the service current-limiting processing request. Optionally, the token bucket throttling policy may issue a token to the user according to the configuration parameters of the token bucket throttling policy to determine the service application authority of the user; the configuration parameters of the token bucket throttling policy comprise the number of released tokens per second, the size of the token bucket and the waiting time.
Specifically, if the current-limiting back end determines that the user does not acquire the service application authority by adopting a token bucket current-limiting strategy according to the service current-limiting processing request, the preset display dialect is fed back to the current-limiting front end so as to display the preset display dialect to the user in real time through the current-limiting front end, thereby reminding the user to wait; and after the interval waiting time, feeding back error information to the current limiting front end to guide the user to re-trigger a service submission button of the current limiting front end so as to regenerate the service current limiting processing request.
The benefits of this arrangement are: and issuing a fixed number of tokens in a sliding time window according to the configuration parameters of the current-limiting rear end, and allowing the current-limiting front end to access a user request after the current-limiting front end successfully takes the tokens, so that the user can be selected randomly and successfully killing the tokens in seconds.
According to the technical scheme of the embodiment, a service current-limiting processing request sent by a current-limiting front end is obtained through a current-limiting rear end, a user queuing serial number of a user is generated according to a first queuing request, expected access time of the user is generated according to current system time, the user queuing serial number, a current access serial number and a current-limiting rate, the user queuing serial number is verified according to the first queuing request, and when the user queuing serial number does not belong to the current access serial number range, the user queuing serial number is determined to fail to pass the first request verification; when the user queuing serial number belongs to the range of the current access serial number, determining that the user queuing serial number passes the first request verification, and generating the service application authority of the user, so as to perform service current limiting processing on the user according to the service application authority of the user; the problems of waste of server resources, poor user experience and the like in the prior art are solved, so that the flow of the current-limiting service is effectively controlled, the back-end processing pressure of the service current limiting is reduced, and the user experience is improved.
EXAMPLE III
The embodiment of the invention specifically explains the application scene of killing and robbery at the end of the channel by taking the second as an example. At present, the second killing and rush-purchasing scenes are increased day by day, the related rush-purchasing scenes are typical burr-type requests, the impact on the back-end service is huge, and the waste of machine resources can be caused. Fig. 3 is a schematic flow chart of a service current limiting method according to a third embodiment of the present invention, as shown in fig. 3, a channel end is divided into a current limiting front end and a current limiting back end; the current limiting front end mainly has a page function, and is interacted with a current limiting service through a current limiting component to control transaction frequency; the current limiting back end is a transaction service, a distributed current limiting service is provided by using a lua script in a Remote Dictionary Server (Redis), and a specific current limiting strategy is configurable.
In the embodiment of the present invention, the throttling policy may specifically include a token bucket throttling policy and a number-sending throttling policy.
Fig. 4 is a schematic flowchart of a token bucket throttling policy according to a third embodiment of the present invention, and as shown in fig. 4, the front end of the token bucket throttling policy is submitted in a two-stage manner, and the back end issues a token through a throttling service.
In the embodiment of the present invention, the processing flow of the current limiting front end includes: the method comprises the steps that a current limiting component at the current limiting front end requests a token obtaining transaction of a back-end current limiting service before transaction submission is carried out after a user clicks a submission button, and the token transaction adopts a token bucket mode and is used for evaluating whether the flow rate exceeds a preset value or not; wherein the current limiting component may be integrated into the submit button; if the token is successfully acquired, directly allowing the user to submit the request; if the token acquisition fails, popping up a prompt dialog and reporting an error after waiting time to control a retry period; wherein the prompt dialog may be "in-line … …" and the wait time may be a return value for the current limit service so that users in line cannot continue killing seconds, thereby reducing server stress.
The token obtaining transaction of the current limiting service at the current limiting back end issues tokens according to the current limiting strategy, and the configuration parameters of the token bucket current limiting strategy comprise: rate: number of tokens released per second; capacity: the size of the token bucket corresponds to the maximum number of concurrent transactions allowed to be submitted; retryInterval: the current limit front-end allows the client to retry the interval, unit: and second.
Fig. 5 is a schematic diagram illustrating a token bucket throttling principle provided by a third embodiment of the present invention, and as shown in fig. 5, the token bucket may be regarded as a container for storing tokens, and a certain capacity is preset. The system places tokens into the bucket at a set rate, and when the bucket is full of tokens, excess tokens overflow. When a data stream arrives at a device, the amount of tokens corresponding to the data size is first taken from the token bucket according to the data size For transmitting the data, and the RFC (Request For Comments, a series of files with a scheduled number) standard defines b/s as a unit. That is, to have data transferred, it must be guaranteed that there are enough tokens in the token bucket, and if there are not enough tokens, the data (user request) will be discarded or buffered. Therefore, the flow of the message can be limited to be less than or equal to the token generation speed, and the purpose of limiting the flow is achieved.
According to the technical scheme, a fixed number of tokens are issued in the sliding time window according to the rear-end configuration parameters, the current-limiting front end successfully takes the tokens and then allows the user to access the user request, and therefore in the second killing scene, the user can be randomly selected to successfully kill the second.
Fig. 6 is a schematic flow chart of a number-sending and current-limiting policy according to a third embodiment of the present invention, as shown in fig. 6, a current-limiting front end of the number-sending and current-limiting policy is submitted in a two-stage manner, and a current-limiting back end performs a number-calling queuing operation through a current-limiting service, similar to a restaurant number-calling system, and admits user requests in sequence.
In an embodiment of the present invention, the processing of the current-limiting front end includes: the flow limiting component requests a number calling queuing transaction of the flow limiting service before the transaction is submitted; the user requests for taking the number for the first time and judges whether the number is reached, and if the number is returned, the user is directly admitted to submit the request; if the number is not reached, popping up a prompt dialog at the front end of the current limit and retrying the number calling and queuing transaction after waiting time; the prompt dialog may include a current serial number, a current number, or a predicted waiting time of the user.
The number calling queuing transaction of the current limiting service at the current limiting back end calls the number and queues according to the current limiting strategy, and the configuration parameters of the number sending current limiting strategy comprise: rate: number calling per second; duration: and the activity duration determines the expiration time of the number-calling related data in the Redis.
The number calling queuing transaction of the current limiting service is realized by using a Redis + lua script;
wherein, the relevant data storage in Redis includes: current queuing number: recording the maximum serial number which is sent currently; current admission sequence number: recording the maximum sequence number of the current access; last refresh time of admission sequence number: recording the refreshing time of the last admission sequence number for calculating the next admission sequence number; queuing number metadata information (hash): expected admission times and states, where 0 means not verified and 1 means verified.
The lua script logic includes: judging whether a queuing serial number exists in a user request or not; if the current queue serial number does not exist, the current queue serial number is represented as the queue serial number, the queue serial number is equal to the current queue serial number +1, and the expected admission time (expected waiting time) is equal to the current time + (the queue serial number-the current admission serial number)/the current limiting rate; obtaining expected admission time according to the current client queuing serial number, if the expected admission time is greater than the current time, the queuing serial number does not allow admission, and exiting the script logic; if the expected admission time is less than or equal to the current time, the queuing serial number is allowed to be admitted, and the expected admission time in the metadata information of the queuing serial number is obtained; current admission sequence number (last admission sequence number + (expected admission time of current user-last refresh time (recorded)) and current limiting rate; the last time of refreshing the access sequence number is equal to the expected access time of the current customer queuing sequence number; and finally returning a queuing result.
According to the technical scheme, the number is called in sequence according to the configuration parameters, and the user request is admitted after the number is reached, so that in a second killing scene, whether second killing is successful or not is determined according to the arrival time of the second killing request of the user.
According to the technical scheme of the embodiment, the distributed current limiting is realized by the current limiting service at the current limiting rear end through the Redis + lua script by providing the current limiting strategies of token bucket current limiting and number sending current limiting, and the problem that the current limiting operation cannot accurately control the flow can be effectively solved by configuring the specific current limiting strategy through the management end, so that the accuracy of the flow control is improved; the transaction frequency is controlled through interaction of the front-end current limiting component and the current limiting service, customer experience is improved, and the problem that background pressure cannot be released due to frequent refreshing of the customer after current limiting due to fuzzy current limiting prompt is solved; based on a Redis cache mechanism, the performance of the current limiting component is further improved; current limiting parameters are dynamically configured, and manual operation and maintenance cost is reduced; a data billboard is provided, and the operation capacity is improved; health detection is added, real-time monitoring and alarming are carried out, and high availability of services is guaranteed.
Example four
Fig. 7 is a schematic diagram of a traffic current limiting apparatus according to a fourth embodiment of the present invention, and as shown in fig. 7, the apparatus includes: a service current limiting processing request obtaining module 710, a service application authority determining module 720 of a user, and a service current limiting processing executing module 730, wherein:
a service current limiting processing request obtaining module 710, configured to obtain a service current limiting processing request sent by a current limiting front end;
a service application authority determining module 720 of the user, configured to determine a service application authority of the user by using a current limiting policy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence;
and a service current limiting processing execution module 730, configured to perform service current limiting processing on the user according to the service application permission of the user.
Optionally, the traffic throttling processing request may include a first queuing request; the service application authority determining module 720 of the user may be further configured to:
generating a user queuing sequence number of the user according to the first queuing request;
generating expected admission time of the user according to the current system time, the user queuing serial number, the current admission serial number and the current limiting rate;
verifying the user queuing sequence number according to the first queuing request;
under the condition that the user queuing serial number is determined to belong to the current access serial number range, determining that the user queuing serial number passes the first request verification, and generating the service application authority of the user;
and under the condition that the user queuing sequence number is determined not to belong to the current access sequence number range, determining that the user queuing sequence number does not pass the first request verification.
Optionally, the module 720 for determining service application authority of the user may be further configured to:
acquiring a user queuing result; wherein the user queuing result comprises at least one of the user queuing sequence number, the current admission sequence number and the expected admission time;
and feeding back the user queuing result to the current-limiting front end so as to display the user queuing result to the user in real time through the current-limiting front end.
Optionally, the traffic throttling processing request may further include a second queuing request; the module 720 for determining the service application authority of the user may further be configured to:
verifying the user queuing sequence number again according to the second queuing request;
under the condition that the user queuing serial number is determined to belong to the current access serial number range, determining that the user queuing serial number passes the second request verification, and generating the service application authority of the user;
and under the condition that the user queuing serial number is determined not to belong to the range of the current access serial number, determining that the user does not pass the second request verification, and refusing to generate the service application authority of the user.
Optionally, the service application authority determining module 720 of the user may be further specifically configured to:
under the condition that the first queuing request does not comprise the user queuing serial number, acquiring a current queuing serial number, and distributing the user queuing serial number to the user according to the current queuing serial number;
according to the formula: and the expected admission time is equal to the current time + (user queuing number-current admission number)/the current limiting rate, and the expected admission time of the user is generated.
Optionally, the service application authority determining module 720 of the user may be further specifically configured to:
determining the current admission sequence number based on the following formula:
the current admission sequence number is the last admission sequence number + (the expected admission time of the current user-the last refreshing time of the admission sequence number) and the current limiting rate;
and updating the last time refreshing time of the admission sequence number according to the expected admission time of the current user.
Optionally, the module 720 for determining service application authority of the user may be further configured to:
under the condition that the user queuing serial number is determined to be smaller than or equal to the current access serial number, determining that the user queuing serial number belongs to the current access serial number range; and/or
And under the condition that the expected admission time corresponding to the user queuing serial number is determined to be less than or equal to the current time, determining that the user queuing serial number belongs to the current admission serial number range.
Optionally, the traffic throttling processing execution module 730 may be further configured to:
under the condition that the user is determined to obtain the service application authority, executing a service processing flow according to a service processing request submitted by the user;
under the condition that the user is determined not to acquire the service application authority, triggering an authority acquisition overtime mechanism;
and triggering the current-limiting front end to execute the authority acquisition overtime process through the authority acquisition overtime mechanism.
Optionally, the service flow restriction processing execution module 730 may be further configured to:
verifying the service application authority of the user according to the service processing request;
and under the condition that the user is determined to have the service application authority, responding to the service processing request, and executing the service processing flow.
Optionally, the current limit front end may include a current limit component, and the current limit component may include a service submission button and a current limit switch;
when the service submitting button is triggered by the user and the current limiting switch is in an open state, the current limiting component generates the service current limiting processing request and sends the service current limiting processing request to the current limiting rear end;
and under the condition that the service submission button is triggered by the user and the current limiting switch is in a closed state, the current limiting component executes a service processing flow under an infinite flow state.
Optionally, the throttling policy may further include a token bucket throttling policy; the token bucket current limiting strategy can issue tokens to the user according to the configuration parameters of the token bucket current limiting strategy so as to determine the service application authority of the user; the configuration parameters of the token bucket throttling policy can include the number of released tokens per second, the size of the token bucket and the waiting time;
the device further comprises:
a preset display dialect display module, configured to feed back a preset display dialect to the current-limiting front end to display the preset display dialect to the user in real time through the current-limiting front end under the condition that it is determined that the user does not obtain the service application permission by using the token bucket current-limiting policy according to the service current-limiting processing request;
and the service current limiting processing request regenerating module is used for feeding back error information to the current limiting front end after the waiting time interval so as to regenerate the service current limiting processing request through the current limiting front end.
Optionally, the service application permission may be a second killing permission for killing the rob-purchase service in seconds.
The service current limiting device can execute the service current limiting method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For details of the service throttling method provided in any embodiment of the present invention, reference may be made to the technical details not described in detail in this embodiment.
The embodiment of the invention obtains the service current limiting processing request sent by the current limiting front end through the current limiting back end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending and current limiting strategy processed according to a user queuing sequence number sequence; the method further carries out service current limiting processing on the user according to the service application authority of the user, solves the problems of server resource waste, poor user experience and the like in the prior art, thereby effectively controlling the flow of the current limiting service, reducing the back-end processing pressure of the service current limiting and improving the user experience.
Since the above-described traffic current limiting device is a device capable of executing the traffic current limiting method in the embodiment of the present invention, based on the traffic current limiting method described in the embodiment of the present invention, those skilled in the art can understand the specific implementation manner of the traffic current limiting device in the embodiment and various variations thereof, so that how to implement the traffic current limiting method in the embodiment of the present invention by the traffic current limiting device is not described in detail herein. The device used by those skilled in the art to implement the method for limiting traffic flow in the embodiments of the present invention is within the scope of the present application.
EXAMPLE five
Fig. 8 is a schematic structural diagram of a computer apparatus according to a fifth embodiment of the present invention, as shown in fig. 8, the computer apparatus includes a processor 810, a memory 820, an input device 830, and an output device 840; the number of the processors 810 in the computer device may be one or more, and one processor 810 is taken as an example in fig. 8; the processor 810, the memory 820, the input device 830 and the output device 840 in the computer apparatus may be connected by a bus or other means, and fig. 8 illustrates the connection by a bus as an example.
The memory 820 is a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the service throttling method in the embodiment of the present invention (for example, the service throttling processing request obtaining module 710, the service application authority determining module 720 of the user, and the service throttling processing executing module 730 in the service throttling device). The processor 810 executes various functional applications and data processing of the computer device by executing software programs, instructions and modules stored in the memory 820, namely, the service current limiting method is implemented, and is applied to a current limiting backend, and the method includes: acquiring a service current limiting processing request sent by a current limiting front end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence; and performing service current limiting processing on the user according to the service application authority of the user.
The memory 820 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 820 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 820 may further include memory located remotely from the processor 810, which may be connected to a computer device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 830 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the computer apparatus. The output device 840 may include a display device such as a display screen.
EXAMPLE six
An embodiment of the present invention further provides a computer storage medium storing a computer program, where the computer program is executed by a computer processor to perform the service current limiting method according to any one of the above embodiments of the present invention, and is applied to a current limiting backend, where the method includes: acquiring a service current limiting processing request sent by a current limiting front end; determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence; and performing service current limiting processing on the user according to the service application authority of the user.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM) or flash Memory), an optical fiber, a portable compact disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (15)
1. A service current limiting method is characterized in that the method is applied to a current limiting back end; the method comprises the following steps:
acquiring a service current limiting processing request sent by a current limiting front end;
determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence;
and performing service current limiting processing on the user according to the service application authority of the user.
2. The method of claim 1, wherein the traffic throttling processing request comprises a first queuing request;
the determining the service application authority of the user by adopting the current limiting strategy according to the service current limiting processing request comprises the following steps:
generating a user queuing sequence number of the user according to the first queuing request;
generating expected admission time of the user according to the current system time, the user queuing serial number, the current admission serial number and the current limiting rate;
verifying the user queuing sequence number according to the first queuing request;
under the condition that the user queuing serial number is determined to belong to the current access serial number range, determining that the user queuing serial number passes the first request verification, and generating the service application authority of the user;
and under the condition that the user queuing sequence number is determined not to belong to the current access sequence number range, determining that the user queuing sequence number does not pass the first request verification.
3. The method of claim 2, further comprising, after said determining that said user queued sequence number has not been validated by the first request:
acquiring a user queuing result; wherein the user queuing result comprises at least one of the user queuing sequence number, the current admission sequence number and the expected admission time;
and feeding back the user queuing result to the current-limiting front end so as to display the user queuing result to the user in real time through the current-limiting front end.
4. The method of claim 3, wherein the traffic throttling processing request further comprises a second queued request;
after the determining that the user queue number is not verified by the first request, the method further comprises:
verifying the user queuing sequence number again according to the second queuing request;
under the condition that the user queuing serial number is determined to belong to the current access serial number range, determining that the user queuing serial number passes the second request verification, and generating the service application authority of the user;
and under the condition that the user queuing serial number is determined not to belong to the range of the current access serial number, determining that the user does not pass the second request verification, and refusing to generate the service application authority of the user.
5. The method of claim 4, wherein the generating a user queuing number for the user according to the first queuing request comprises:
under the condition that the first queuing request does not comprise the user queuing serial number, acquiring a current queuing serial number, and distributing the user queuing serial number to the user according to the current queuing serial number;
the generating the expected admission time of the user according to the current system time, the user queuing serial number, the current admission serial number and the current limiting rate comprises the following steps:
according to the formula: and the expected admission time is equal to the current time + (user queuing number-current admission number)/the current limiting rate, and the expected admission time of the user is generated.
6. The method of claim 5, wherein the current admission sequence number is determined based on the following formula:
the current admission sequence number is the last admission sequence number + (the expected admission time of the current user-the last refreshing time of the admission sequence number) and the current limiting rate;
after the generating of the service application authority of the user, the method further includes:
and updating the last time refreshing time of the admission sequence number according to the expected admission time of the current user.
7. The method of claim 4, wherein the determining that the user queuing number belongs to a current range of admission numbers comprises:
under the condition that the user queuing serial number is determined to be smaller than or equal to the current access serial number, determining that the user queuing serial number belongs to the current access serial number range; and/or
And under the condition that the expected admission time corresponding to the user queuing serial number is determined to be less than or equal to the current time, determining that the user queuing serial number belongs to the current admission serial number range.
8. The method according to any one of claims 1 to 7, wherein the performing the service throttling processing on the user according to the service application authority of the user comprises:
under the condition that the user is determined to obtain the service application authority, executing a service processing flow according to a service processing request submitted by the user;
under the condition that the user is determined not to acquire the service application authority, triggering an authority acquisition overtime mechanism;
and triggering the current-limiting front end to execute the authority acquisition overtime process through the authority acquisition overtime mechanism.
9. The method according to claim 8, wherein the executing the business process flow according to the business process request submitted by the user comprises:
verifying the service application authority of the user according to the service processing request;
and under the condition that the user is determined to have the service application authority, responding to the service processing request, and executing the service processing flow.
10. The method of any of claims 1-7, wherein the current limit front end comprises a current limit component comprising a service commit button and a current limit switch;
when the service submitting button is triggered by the user and the current limiting switch is in an open state, the current limiting component generates the service current limiting processing request and sends the service current limiting processing request to the current limiting rear end;
and under the condition that the service submission button is triggered by the user and the current limiting switch is in a closed state, the current limiting component executes a service processing flow under an infinite flow state.
11. The method of claims 1-7, wherein the throttling policy further comprises a token bucket throttling policy; the token bucket current limiting strategy issues tokens to the user according to the configuration parameters of the token bucket current limiting strategy so as to determine the service application authority of the user; the configuration parameters of the token bucket current limiting strategy comprise the number of released tokens per second, the size of a token bucket and waiting time;
the method further comprises the following steps:
under the condition that the token bucket current limiting strategy is adopted to determine that the user does not acquire the service application permission according to the service current limiting processing request, feeding back a preset display session to the current limiting front end so as to display the preset display session to the user in real time through the current limiting front end;
and after the waiting time is separated, feeding back error information to the current limiting front end so as to regenerate the service current limiting processing request through the current limiting front end.
12. The method according to claims 1-7, wherein the service application right is a second killing right for second-killing the rob-purchase service.
13. A traffic limiting apparatus, configured at a current limiting backend, comprising:
the service current limiting processing request acquisition module is used for acquiring a service current limiting processing request sent by a current limiting front end;
the service application authority determining module of the user is used for determining the service application authority of the user by adopting a current limiting strategy according to the service current limiting processing request; the current limiting strategy comprises a number sending current limiting strategy processed according to a user queuing sequence number sequence;
and the service current limiting processing execution module is used for performing service current limiting processing on the user according to the service application authority of the user.
14. A computer device, characterized in that the computer device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the traffic throttling method of any of claims 1-12.
15. A computer storage medium having a computer program stored thereon, the program, when executed by a processor, implementing a method of traffic throttling according to any of claims 1-12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110824360.3A CN113469661A (en) | 2021-07-21 | 2021-07-21 | Service current limiting method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110824360.3A CN113469661A (en) | 2021-07-21 | 2021-07-21 | Service current limiting method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113469661A true CN113469661A (en) | 2021-10-01 |
Family
ID=77881617
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110824360.3A Pending CN113469661A (en) | 2021-07-21 | 2021-07-21 | Service current limiting method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113469661A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114079635A (en) * | 2021-11-17 | 2022-02-22 | 中国工商银行股份有限公司 | Service flow current limiting method and device based on polynomial fitting |
CN116260875A (en) * | 2022-09-09 | 2023-06-13 | 中国人民财产保险股份有限公司 | Service request current limiting method, current limiting device and electronic equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106355470A (en) * | 2016-08-30 | 2017-01-25 | 福建新大陆软件工程有限公司 | E-commerce snapping-up method and system |
CN106713388A (en) * | 2015-11-13 | 2017-05-24 | 阿里巴巴集团控股有限公司 | Emergent business processing method and device |
CN110248211A (en) * | 2018-03-07 | 2019-09-17 | 香港乐蜜有限公司 | Direct broadcasting room message current-limiting method, device, electronic equipment and storage medium |
CN110348833A (en) * | 2019-06-28 | 2019-10-18 | 北京你财富计算机科技有限公司 | A kind of processing method of payment request, device and electronic equipment |
CN111831453A (en) * | 2020-07-24 | 2020-10-27 | 中国工商银行股份有限公司 | Information processing method, information processing apparatus, electronic device, and medium |
CN112286693A (en) * | 2020-11-24 | 2021-01-29 | 上海浦东发展银行股份有限公司 | Refined current limiting processing method and device for emergency purchasing activities in high-concurrency scene |
CN112785323A (en) * | 2019-11-07 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | Resource allocation method and device and electronic equipment |
-
2021
- 2021-07-21 CN CN202110824360.3A patent/CN113469661A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106713388A (en) * | 2015-11-13 | 2017-05-24 | 阿里巴巴集团控股有限公司 | Emergent business processing method and device |
CN106355470A (en) * | 2016-08-30 | 2017-01-25 | 福建新大陆软件工程有限公司 | E-commerce snapping-up method and system |
CN110248211A (en) * | 2018-03-07 | 2019-09-17 | 香港乐蜜有限公司 | Direct broadcasting room message current-limiting method, device, electronic equipment and storage medium |
CN110348833A (en) * | 2019-06-28 | 2019-10-18 | 北京你财富计算机科技有限公司 | A kind of processing method of payment request, device and electronic equipment |
CN112785323A (en) * | 2019-11-07 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | Resource allocation method and device and electronic equipment |
CN111831453A (en) * | 2020-07-24 | 2020-10-27 | 中国工商银行股份有限公司 | Information processing method, information processing apparatus, electronic device, and medium |
CN112286693A (en) * | 2020-11-24 | 2021-01-29 | 上海浦东发展银行股份有限公司 | Refined current limiting processing method and device for emergency purchasing activities in high-concurrency scene |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114079635A (en) * | 2021-11-17 | 2022-02-22 | 中国工商银行股份有限公司 | Service flow current limiting method and device based on polynomial fitting |
CN116260875A (en) * | 2022-09-09 | 2023-06-13 | 中国人民财产保险股份有限公司 | Service request current limiting method, current limiting device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3929762A1 (en) | Method for recording data block on blockchain, and leader accounting node and medium | |
CN110809011B (en) | Access control method and system, and storage medium | |
EP2830044B1 (en) | Instruction processing method, apparatus, and system | |
CN107592345B (en) | Transaction current limiting device, method and transaction system | |
CN113469661A (en) | Service current limiting method, device, computer equipment and storage medium | |
CN109672612A (en) | API gateway system | |
CN106873961B (en) | Method and device for awakening APP through mobile browser | |
CN107241380B (en) | Method and apparatus for time-based adjusted load balancing | |
CN110930157B (en) | Delayed transaction processing method, device and storage medium | |
CN111290696A (en) | Flow control method and device for application program assembly | |
US11134078B2 (en) | User-specific session timeouts | |
CN108541314A (en) | The sequence-dependent operation processing of packet-based data-message transmission | |
US20220116476A1 (en) | Surrogate cache for optimized service access with compact user objects and offline database updates | |
CN114124490B (en) | Method and device for publishing new media content, storage medium and electronic equipment | |
CN110177086A (en) | A kind of cloud mobile phone screen sharing method, system and device | |
CN111694645B (en) | Task processing method and related device in distributed task scheduling system | |
CN107026879A (en) | A kind of data cache method and background application system | |
CN114328132A (en) | Method, device, equipment and medium for monitoring state of external data source | |
CN113344453A (en) | Risk monitoring method, device, system, storage medium and equipment | |
CN110262955A (en) | Application performance monitoring tools based on pinpoint | |
CN113346973A (en) | Event prompting method and device, electronic equipment and computer readable storage medium | |
CN103841081A (en) | Capability scheduling method and system | |
WO2020173013A1 (en) | Method and apparatus for repeatedly opening compartment, and device and medium | |
CN106294457B (en) | Network information pushing method and device | |
US10862811B1 (en) | Message brokering for asynchronous status updates |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20211001 |