CN111163123A - Service request processing method and device - Google Patents

Service request processing method and device Download PDF

Info

Publication number
CN111163123A
CN111163123A CN201911168835.7A CN201911168835A CN111163123A CN 111163123 A CN111163123 A CN 111163123A CN 201911168835 A CN201911168835 A CN 201911168835A CN 111163123 A CN111163123 A CN 111163123A
Authority
CN
China
Prior art keywords
current limiting
target
mode
dimension
calculation result
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
Application number
CN201911168835.7A
Other languages
Chinese (zh)
Inventor
周通
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Tongbang Zhuoyi Technology Co Ltd
Original Assignee
Beijing Tongbang Zhuoyi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Tongbang Zhuoyi Technology Co Ltd filed Critical Beijing Tongbang Zhuoyi Technology Co Ltd
Priority to CN201911168835.7A priority Critical patent/CN111163123A/en
Publication of CN111163123A publication Critical patent/CN111163123A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The application relates to a method and a device for processing a service request, wherein the method comprises the following steps: receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application; determining a target application current limiting mode corresponding to a target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that a target application current limiting logic is adopted to process a target service; processing the target service request by adopting target application current-limiting logic to obtain a target processing result; and feeding back a target processing result to the target application. The method and the device solve the technical problem of poor flexibility in processing the service request.

Description

Service request processing method and device
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for processing a service request.
Background
Currently, in service current limiting design, common current limiting algorithms mainly include a counter algorithm, a leaky bucket algorithm and a token bucket algorithm. The method is basically realized based on the three algorithms on the basis of the design and the realization of the mainstream current limiting service architecture. Most current-limiting service current-limiting modes are relatively fixed, and switching is difficult to perform according to different application scenes. Resulting in poor flexibility in handling service requests.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the present application provides a method and an apparatus for processing a service request.
According to an aspect of an embodiment of the present application, there is provided a method for processing a service request, including:
receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application;
determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that target service is processed by adopting target application current limiting logic;
processing the target service request by adopting the target application current limiting logic to obtain a target processing result;
and feeding back the target processing result to the target application.
Optionally, determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes includes one of:
acquiring the target application current limiting mode corresponding to the target application from the applications with the corresponding relation and the application current limiting modes, wherein the plurality of application current limiting modes comprise: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application;
selecting the target application current limiting mode matched with the application attribute of the target application from the plurality of application current limiting modes, wherein the plurality of application current limiting modes comprise: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application.
Optionally, processing the target service request by using the target application current limiting logic, and obtaining a target processing result includes:
under the condition that the target application current limiting mode is the first mode, performing current limiting calculation on the target service to obtain a calculation result, wherein the calculation result is used for indicating whether to perform current limiting on the target service or not; determining the calculation result as the target processing result;
under the condition that the target application current limiting mode is the second mode, performing current limiting calculation on the target service to obtain a calculation result, wherein the calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released;
and under the condition that the target application current limiting mode is the third mode, directly determining a preset result as the target processing result, wherein the preset result is used for indicating the target service to be released.
Optionally, when the current limiting mode of the target application is the first mode or the second mode, performing current limiting calculation on the target service, and obtaining a calculation result includes:
acquiring a current limiting dimension set corresponding to the target service, wherein the current limiting dimension set comprises one or more current limiting dimensions;
determining a target dimension current limiting mode corresponding to each current limiting dimension in the current limiting dimension set from a plurality of dimension current limiting modes, wherein the target dimension current limiting mode is used for indicating that each current limiting dimension is processed by adopting target dimension current limiting logic;
processing each current-limiting dimension by adopting the corresponding target dimension current-limiting logic to obtain one or more processing results;
determining the calculation result according to the one or more processing results.
Optionally, determining the target dimension current limiting mode corresponding to each current limiting dimension in the set of current limiting dimensions from the plurality of dimension current limiting modes comprises one of:
obtaining the target dimension current limiting mode corresponding to each current limiting dimension from the dimension and dimension current limiting modes with corresponding relations, wherein the plurality of dimension current limiting modes comprise: a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension;
selecting the target dimension current limiting mode matched with the dimension attribute of each current limiting dimension from the plurality of dimension current limiting modes, wherein the plurality of dimension current limiting modes comprise: the current limiting device comprises a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension.
Optionally, processing each current-limiting dimension by using the corresponding target dimension current-limiting logic to obtain one or more processing results includes:
under the condition that the target dimension current limiting mode is a fourth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining the current limiting calculation result as a processing result corresponding to each current limiting dimension;
under the condition that the target dimension current limiting mode is a fifth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited;
and under the condition that the target dimension current limiting mode is a sixth mode, directly determining the preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited.
Optionally, when the set of current limiting dimensions includes a plurality of current limiting dimensions, processing each current limiting dimension by using the corresponding target dimension current limiting logic, and obtaining the one or more processing results includes:
determining a calculation order of the plurality of current limiting dimensions;
and processing each current limiting dimension in the plurality of current limiting dimensions by adopting the corresponding target dimension current limiting logic according to the calculation sequence.
Optionally, determining the calculation result according to the one or more processing results comprises:
determining the calculation result as a first calculation result under the condition that at least one of the one or more processing results is used for indicating to limit the current of the target service, wherein the first calculation result is used for indicating to limit the current of the target service;
and determining the calculation result as a second calculation result under the condition that all the one or more processing results are used for indicating that the target service is not limited, wherein the second calculation result is used for indicating that the target service is not limited.
According to another aspect of the embodiments of the present application, there is also provided a device for processing a service request, including:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a target service request sent by a target application, and the target service request is used for requesting to provide a target service for the target application;
the determining module is used for determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that target service is processed by adopting target application current limiting logic;
the processing module is used for processing the target service request by adopting the target application current-limiting logic to obtain a target processing result;
and the feedback module is used for feeding back the target processing result to the target application.
Optionally, the determining module comprises one of:
an obtaining unit, configured to obtain a target application current limiting mode corresponding to the target application in an application and an application current limiting mode having a corresponding relationship, where the plurality of application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application;
a selecting unit, configured to select, from the multiple application current limiting modes, the target application current limiting mode that matches an application attribute of the target application, where the multiple application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application.
Optionally, the processing module includes:
a first determining unit, configured to perform a current limiting calculation on the target service to obtain a calculation result when the current limiting mode of the target application is a first mode, where the calculation result is used to indicate whether to perform current limiting on the target service; determining the calculation result as the target processing result;
a second determining unit, configured to perform, when the target application current limiting mode is a second mode, a current limiting calculation on the target service to obtain a calculation result, where the calculation result is used to indicate whether to perform current limiting on the target service; determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released;
a third determining unit, configured to directly determine a preset result as the target processing result when the target application current limiting mode is the third mode, where the preset result is used to indicate that the target service is released.
Optionally, when the target application current limiting mode is the first mode or the second mode, the first determining unit or the second determining unit includes:
an obtaining subunit, configured to obtain a current limiting dimension set corresponding to the target service, where the current limiting dimension set includes one or more current limiting dimensions;
a first determining subunit, configured to determine, from a plurality of dimension current limiting modes, a target dimension current limiting mode corresponding to each current limiting dimension in the current limiting dimension set, where the target dimension current limiting mode is used to instruct processing of each current limiting dimension by using target dimension current limiting logic;
the processing subunit is configured to process each current-limiting dimension by using the corresponding target dimension current-limiting logic to obtain one or more processing results;
a second determining subunit, configured to determine the calculation result according to the one or more processing results.
Optionally, the first determining subunit is configured to:
obtaining the target dimension current limiting mode corresponding to each current limiting dimension from the dimension and dimension current limiting modes with corresponding relations, wherein the plurality of dimension current limiting modes comprise: a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension;
selecting the target dimension current limiting mode matched with the dimension attribute of each current limiting dimension from the plurality of dimension current limiting modes, wherein the plurality of dimension current limiting modes comprise: the current limiting device comprises a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension.
Optionally, the processing subunit is configured to:
under the condition that the target dimension current limiting mode is a fourth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining the current limiting calculation result as a processing result corresponding to each current limiting dimension;
under the condition that the target dimension current limiting mode is a fifth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited;
and under the condition that the target dimension current limiting mode is a sixth mode, directly determining the preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited.
Optionally, in a case that the set of current limiting dimensions includes a plurality of current limiting dimensions, the processing subunit is configured to:
determining a calculation order of the plurality of current limiting dimensions;
and processing each current limiting dimension in the plurality of current limiting dimensions by adopting the corresponding target dimension current limiting logic according to the calculation sequence.
Optionally, the second determining subunit is configured to:
determining the calculation result as a first calculation result under the condition that at least one of the one or more processing results is used for indicating to limit the current of the target service, wherein the first calculation result is used for indicating to limit the current of the target service;
and determining the calculation result as a second calculation result under the condition that all the one or more processing results are used for indicating that the target service is not limited, wherein the second calculation result is used for indicating that the target service is not limited.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program which, when executed, performs the above-described method.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the above method through the computer program.
In the embodiment of the application, a target service request sent by a target application is received, wherein the target service request is used for requesting to provide a target service for the target application; determining a target application current limiting mode corresponding to a target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that a target application current limiting logic is adopted to process a target service; processing the target service request by adopting target application current-limiting logic to obtain a target processing result; the method for feeding back the target processing result to the target application determines the target application current limiting mode corresponding to the target service request initiated by the target application, so that the target service requested by the target application is processed by adopting the target application current limiting logic matched with the target application current limiting mode, the purpose of switching the application current limiting mode according to the requirement is achieved, the technical effect of improving the flexibility of processing the service request is achieved, and the technical problem of poor flexibility of processing the service request is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment for a method of processing a service request according to an embodiment of the application;
FIG. 2 is a flow chart of an alternative method of processing a service request according to an embodiment of the present application;
FIG. 3 is a flow chart of an alternative method of processing a service request according to an alternative embodiment of the present application;
FIG. 4 is a schematic diagram of an alternative service request processing apparatus according to an embodiment of the application;
and
fig. 5 is a block diagram of a terminal according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of embodiments of the present application, an embodiment of a method for processing a service request is provided.
Alternatively, in the present embodiment, the processing method of the service request may be applied to a hardware environment formed by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, a server 103 is connected to a terminal 101 through a network, which may be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal, and a database may be provided on the server or separately from the server for providing data storage services for the server 103, and the network includes but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, and the like. The method for processing the service request according to the embodiment of the present application may be executed by the server 103, the terminal 101, or both the server 103 and the terminal 101. The method for the terminal 101 to execute the service request according to the embodiment of the present application may be executed by a client installed thereon.
Fig. 2 is a flowchart of an alternative service request processing method according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
step S202, receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application;
step S204, determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that a target application current limiting logic is adopted to process the target service;
step S206, processing the target service request by adopting the target application current-limiting logic to obtain a target processing result;
step S208, feeding back the target processing result to the target application.
Through the steps S202 to S208, the target application current limiting mode corresponding to the target service request initiated by the target application is determined, so that the target service requested by the target application is processed by using the target application current limiting logic matched with the target application current limiting mode, and the purpose of switching the application current limiting mode according to the requirement is achieved, thereby achieving the technical effect of improving the flexibility of processing the service request, and further solving the technical problem of poor flexibility of processing the service request.
In the technical solution provided in step S202, the target application may include, but is not limited to, various types of applications, such as: a game application, a shopping application, a financial application, a multimedia application, an instant messaging application, a social application, a browser application, a lifestyle application, an information push application, and the like. The target application may be, but is not limited to, a client installed on the device or a function provided on the client.
Optionally, in this embodiment, the target service request may include, but is not limited to, a transaction request, a configuration request, a resource scheduling request, an information issuing request, an inquiry request, and the like. Such as: a game item transaction request in a game application, an order submission request in a shopping application, a transfer request in a financial application, a financing product purchase request in a financing application, a video playing request in a multimedia application, a session request in an instant messaging application, a state publishing request in a social application, a web page login request in a browser application, a consultation query request in a life tool application, a news push refresh request in an information push application, and the like.
In the technical solution provided in step S204, each application current limiting mode in the plurality of application current limiting modes is used to instruct application current limiting logic corresponding to the application current limiting mode to process the service request initiated by the application. The multiple application current limiting modes provide different current limiting modes for different applications or the same application in different running states, so that the system can flexibly process service requests initiated by various applications in various application scenes.
Optionally, in this embodiment, the application scenarios may include, but are not limited to: the method comprises the steps of applying a normal running scene, applying an online trial running scene, and applying a scene that a dependent service such as a cache, a database and the like has a fault.
In the technical solution provided in step S206, the application current limiting logic corresponding to each application current limiting mode may be, but is not limited to, a flow indicating the current limiting process. Such as: a standard current limiting process flow is preset, and one application current limiting logic may be to execute the standard current limiting process flow and take a process result obtained by the standard current limiting process flow as a final current limiting result. The second application current limiting logic may execute the standard current limiting process flow and use a preset process result as the final current limiting result. The third application current limiting logic may be to directly use a preset processing result as the final current limiting result without executing the standard current limiting processing flow.
In the technical solution provided in step S208, the target application may determine whether to perform current limiting on the requested target service according to the received target processing result. One target processing result indicates that the target application needs to perform current limiting on the target service requested by the target application, and the other target processing result indicates that the target application releases the target service requested by the target application.
Optionally, in this embodiment, the counter algorithm in the current limiting service may be implemented by, but is not limited to, the technology of Redis + lua.
The function of the counter is realized through redis + lua, so that the atomicity of operation is guaranteed, and the high performance is also guaranteed. Each key in the redis can be used as a counter, and the redis can set the failure time of the key, so that the method is simple and completely feasible in implementation. And meanwhile, the threshold value and the failure time of the counter are set to be 1s, and the design principle is matched with the QPS concept of the system. Reasonable flow limiting value is the basis of flow limiting, and the QPS which is maximally born by the system can be estimated by means of pressure measurement and the like, so that the flow limiting can be carried out more reasonably and reasonably.
As an optional embodiment, determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes includes one of:
s1, obtaining the target application current limiting mode corresponding to the target application from the application and application current limiting modes having the corresponding relationship, where the plurality of application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application;
s2, selecting the target application current limiting mode matching with the application attribute of the target application from the plurality of application current limiting modes, where the plurality of application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application.
Optionally, in this embodiment, the applications and the application current limiting modes corresponding to the applications may be configured in advance, and the application current limiting modes corresponding to each application in different application scenarios may be configured, so that the applications and the application current limiting modes having the corresponding relationship are obtained and stored in the database.
Optionally, in this embodiment, the application current limiting mode corresponding to the application may be determined according to attribute information of the application, for example: the application is set with priority, and an application with high priority indicates that its service request needs to be processed preferentially, so that it can be determined that its corresponding application current limiting mode is a third mode in which current limiting calculation is not needed.
As an optional embodiment, processing the target service request by using the target application current limiting logic, and obtaining a target processing result includes:
s1, performing current limiting calculation on the target service to obtain a calculation result under the condition that the target application current limiting mode is the first mode, wherein the calculation result is used for indicating whether to perform current limiting on the target service; determining the calculation result as the target processing result;
s2, performing current limiting calculation on the target service to obtain a calculation result under the condition that the target application current limiting mode is the second mode, wherein the calculation result is used for indicating whether to perform current limiting on the target service; determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released;
and S3, when the target application current limiting mode is the third mode, directly determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released.
Optionally, in this embodiment, the first mode may be, but is not limited to, a limited mode (LIMIT), the external application requests a current limiting service, the current limiting service performs normal current limiting logic (i.e., the current limiting calculation), and returns a current limiting result (i.e., the calculation result) to the caller.
Optionally, in this embodiment, the second mode may be, but is not limited to, a so-called CROSS-country mode (CROSS), the external application requests a current limiting service, and the current limiting service executes normal current limiting logic, but always returns to release the current transaction (i.e., the target service) when returning to the caller, that is, the current limiting execution result is not used as a criterion, and only a CROSS-country is taken. The method can be used for a scene of online test running of the current-limiting service application.
Blind mode (IGNORE): the external requests the current limiting service, the current limiting service does not execute the current limiting logic and directly returns to pass the current transaction. The method and the device can be suitable for the scene that the current-limiting service application depends on services such as cache, database and the like with faults, so that the transaction of a calling party is not influenced.
Optionally, in this embodiment, when the current limiting mode is applied to the target, and is the first mode or the second mode, the current limiting calculation may be performed on the target service in the following manner, without limitation, to obtain a calculation result:
s1, acquiring a current limiting dimension set corresponding to the target service, wherein the current limiting dimension set comprises one or more current limiting dimensions;
s2, determining a target dimension current limiting mode corresponding to each current limiting dimension in the current limiting dimension set from a plurality of dimension current limiting modes, wherein the target dimension current limiting mode is used for indicating that each current limiting dimension is processed by target dimension current limiting logic;
s3, processing each current-limiting dimension by adopting the corresponding target dimension current-limiting logic to obtain one or more processing results;
s4, determining the calculation result according to the one or more processing results.
Optionally, in this embodiment, when performing the current limiting calculation, multiple dimensions may be introduced at a time to perform the calculation.
Optionally, in this embodiment, the current limiting mode may be configured by configuring: a restricted mode, a field-pass mode, and an invisible mode. The mode configuration can be configured to either the entire current limiting service application or to a single current limiting dimension. The modes of all dimensions are not affected, and the application mode and the dimension mode are matched with each other to play a role.
As an optional embodiment, determining the target dimension current limiting mode corresponding to each current limiting dimension in the set of current limiting dimensions from the plurality of dimension current limiting modes includes one of:
s1, obtaining the target dimension current limiting mode corresponding to each current limiting dimension from the dimension and dimension current limiting modes having the corresponding relationship, where the plurality of dimension current limiting modes include: a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension;
s2, selecting the target dimension current limiting mode matching the dimension attribute of each current limiting dimension from the plurality of dimension current limiting modes, where the plurality of dimension current limiting modes include: the current limiting device comprises a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension.
Optionally, in this embodiment, the correspondence between the current limiting dimension and the dimension current limiting mode may be obtained from a dimension and a dimension current limiting mode that are stored in advance and have a correspondence, or may be determined according to a dimension attribute of each current limiting dimension.
As an optional embodiment, processing each current-limiting dimension by using the corresponding target dimension current-limiting logic to obtain one or more processing results includes:
s1, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result under the condition that the target dimension current limiting mode is a fourth mode, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service; determining the current limiting calculation result as a processing result corresponding to each current limiting dimension;
s2, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result under the condition that the target dimension current limiting mode is a fifth mode, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service; determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited;
and S3, when the target dimension current limiting mode is a sixth mode, directly determining the preset current limiting calculation result as a processing result corresponding to each current limiting dimension, where the preset current limiting calculation result is used to indicate that the target service is not to be limited.
Optionally, in this embodiment, the dimension current limiting mode may also be divided into the above-mentioned limiting mode, the passing-field mode and the blind mode, and the normal current limiting logic is executed in the limiting mode, and the current limiting result is used as the calculation result. And executing normal current limiting logic in the field passing mode, and taking a preset current limiting result as a calculation result. And in the invisibility mode, normal current limiting logic is not executed, and a preset current limiting result is directly used as a calculation result.
As an optional embodiment, in a case that the set of current limiting dimensions includes a plurality of current limiting dimensions, processing each current limiting dimension with the corresponding target dimension current limiting logic to obtain the one or more processing results includes:
s1, determining the calculation sequence of the plurality of current limiting dimensions;
s2, processing each current limiting dimension in the multiple current limiting dimensions by adopting the corresponding target dimension current limiting logic according to the calculation sequence.
Optionally, in this embodiment, the plurality of flow-limiting dimensions may be calculated according to a certain calculation order, and the calculation order of the calculation dimensions may be automatically sorted by the caller to determine the calculation order.
As an alternative embodiment, determining the calculation result according to the one or more processing results comprises:
s1, determining the calculation result as a first calculation result when at least one of the one or more processing results is used for indicating current limiting on the target service, wherein the first calculation result is used for indicating current limiting on the target service;
s2, when all of the one or more processing results are used to indicate that the current limitation is not performed on the target service, determining that the calculation result is a second calculation result, where the second calculation result is used to indicate that the current limitation is not performed on the target service.
Optionally, in this embodiment, if at least one processing result is used to indicate that the current limitation is performed on the target service, it is determined that the current limitation is required. And all processing results are used for indicating that the target service is not limited, and then the current limitation is determined not to be needed.
The present application further provides an optional embodiment, which provides a multi-mode multi-dimensional current limiting service processing method. In the optional embodiment, the current limiting service is combined with a multi-mode and multi-dimensional design concept, so that the available high-efficiency current limiting service with switchable modes and adjustable dimensions is realized.
In this alternative embodiment, the counter algorithm is implemented using Redis + lua's technique. The function of the counter is realized through redis + lua, so that the atomicity of operation is guaranteed, and the high performance is also guaranteed. Each key in the redis can be used as a counter, and the redis can set the failure time of the key, so that the method is simple and completely feasible in implementation. And meanwhile, the threshold value and the failure time of the counter are set to be 1s, and the design principle is matched with the QPS concept of the system.
In this alternative embodiment, the current limit mode may be configured by configuration as: a restricted mode, a field-pass mode, and an invisible mode. The mode configuration can be configured to either the entire current limiting service application or to a single current limiting dimension. The modes of all dimensions are not affected, and the application mode and the dimension mode are matched with each other to play a role.
In the LIMIT mode (LIMIT), an external request for a current limiting service, the current limiting service performs normal current limiting logic, and returns a current limiting result to a caller.
In the CROSS-country mode (CROSS), the external requests a current limiting service, which executes normal current limiting logic, but returns to pass the current transaction forever when returning to the caller, i.e. not subject to the current limiting execution result, but only goes through the CROSS-country. The method is used for a scene of online test running of the current limiting service application.
In the blind mode (IGNORE), the external requests for a current limiting service that does not execute the current limiting logic to directly return to pass the current transaction. The method is suitable for the scene that the current-limiting service application depends on the service such as cache, database and the like with faults, so that the transaction of the calling party is not influenced.
When the current limiting calculation is carried out, a plurality of dimensions can be transmitted at one time for calculation, and the calculation dimensions can be automatically sequenced by a calling party to determine the calculation sequence.
When bearing the dimension of the current-limiting calculation, Map is used for storage, and the KEY value of the Map determines the sequence of the dimension current-limiting calculation. The KEY value for Map is designed as follows:
public enum RateLimitKeyOrderEnum{
ONE("1","1"),
TWO("2","2"),
THREE("3","3"),
FOUR("4","4"),
FIVE("5","5"),
SIX("6","6"),
SEVEN("7","7"),
EIGHT("8","8"),
NINE("9","9"),
TEN("10","10")
before carrying out dimension current limiting calculation, sorting dimensions through KEY values:
Map<RateLimitKeyOrderEnum,String>keyMap=XXX.getLimitKeyMap();
Collection<RateLimitKeyOrderEnum>keyset=keyMap.keySet();
List<RateLimitKeyOrderEnum>list=new ArrayList<>(keyset);
Collections.sort(list);
and after sorting, calculating the current limiting result of each dimension in sequence.
Fig. 3 is a flowchart of an alternative service request processing method according to an alternative embodiment of the present application, and as shown in fig. 3, the flowchart includes the following steps:
step 1, an external application requests a current limiting service.
And 2, judging the applied current limiting mode, and returning to the non-current limiting mode if the applied current limiting mode is the invisible mode. If not, step 3 is executed.
And 3, acquiring all current limiting dimensions.
And 4, sequencing the current limiting dimensions.
And 5, performing circulating treatment according to the arrangement sequence. And judging the current limiting mode of the dimensionality, and returning no current limiting if the current limiting mode is the invisible mode. If the current limiting mode is not the invisible mode, calculating a current limiting result, judging whether to limit the current or not, if not, executing the next cycle, if so, judging the current limiting mode of the dimensionality, if the process mode is the process mode, executing the next cycle without limiting the current, and if the process mode is the limiting mode or all the dimensionalities do not need to limit the current, executing the step 6.
And 6, analyzing the current limiting result.
And 7, judging the applied current limiting mode, and if the applied current limiting mode is the limiting mode, returning the obtained current limiting result. If the process mode is the process mode, the non-current limit is returned.
Through the optional embodiment, the multi-mode controllable and multi-dimensional adjustable current limiting service is realized on the basis of the current limiting service, so that the current limiting service has more flexibility and practicability.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
According to another aspect of the embodiment of the present application, there is also provided a service request processing apparatus for implementing the service request processing method. Fig. 4 is a schematic diagram of an alternative service request processing apparatus according to an embodiment of the present application, and as shown in fig. 4, the apparatus may include:
a receiving module 42, configured to receive a target service request sent by a target application, where the target service request is used to request to provide a target service to the target application;
a determining module 44, configured to determine a target application current limiting mode corresponding to the target application from multiple application current limiting modes, where the target application current limiting mode is used to instruct processing of the target service by using target application current limiting logic;
a processing module 46, configured to process the target service request by using the target application current limiting logic, so as to obtain a target processing result;
a feedback module 48, configured to feed back the target processing result to the target application.
It should be noted that the receiving module 42 in this embodiment may be configured to execute the step S202 in this embodiment, the determining module 44 in this embodiment may be configured to execute the step S204 in this embodiment, the processing module 46 in this embodiment may be configured to execute the step S206 in this embodiment, and the feedback module 48 in this embodiment may be configured to execute the step S208 in this embodiment.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.
Through the module, the target application current limiting mode corresponding to the target application is determined through the target service request initiated for the target application, so that the target service requested by the target application is processed by adopting the target application current limiting logic matched with the target application current limiting mode, the purpose of switching the application current limiting mode according to requirements is achieved, the technical effect of improving the flexibility of processing the service request is achieved, and the technical problem of poor flexibility of processing the service request is solved.
As an alternative embodiment, the determining module comprises one of:
an obtaining unit, configured to obtain a target application current limiting mode corresponding to the target application in an application and an application current limiting mode having a corresponding relationship, where the plurality of application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application;
a selecting unit, configured to select, from the multiple application current limiting modes, the target application current limiting mode that matches an application attribute of the target application, where the multiple application current limiting modes include: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application.
As an alternative embodiment, the processing module comprises:
a first determining unit, configured to perform a current limiting calculation on the target service to obtain a calculation result when the current limiting mode of the target application is a first mode, where the calculation result is used to indicate whether to perform current limiting on the target service; determining the calculation result as the target processing result;
a second determining unit, configured to perform, when the target application current limiting mode is a second mode, a current limiting calculation on the target service to obtain a calculation result, where the calculation result is used to indicate whether to perform current limiting on the target service; determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released;
a third determining unit, configured to directly determine a preset result as the target processing result when the target application current limiting mode is the third mode, where the preset result is used to indicate that the target service is released.
As an optional embodiment, in a case that the target application current limiting mode is the first mode or the second mode, the first determining unit or the second determining unit includes:
an obtaining subunit, configured to obtain a current limiting dimension set corresponding to the target service, where the current limiting dimension set includes one or more current limiting dimensions;
a first determining subunit, configured to determine, from a plurality of dimension current limiting modes, a target dimension current limiting mode corresponding to each current limiting dimension in the current limiting dimension set, where the target dimension current limiting mode is used to instruct processing of each current limiting dimension by using target dimension current limiting logic;
the processing subunit is configured to process each current-limiting dimension by using the corresponding target dimension current-limiting logic to obtain one or more processing results;
a second determining subunit, configured to determine the calculation result according to the one or more processing results.
As an alternative embodiment, the first determining subunit is configured to:
obtaining the target dimension current limiting mode corresponding to each current limiting dimension from the dimension and dimension current limiting modes with corresponding relations, wherein the plurality of dimension current limiting modes comprise: a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension;
selecting the target dimension current limiting mode matched with the dimension attribute of each current limiting dimension from the plurality of dimension current limiting modes, wherein the plurality of dimension current limiting modes comprise: the current limiting device comprises a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension.
As an alternative embodiment, the processing subunit is configured to:
under the condition that the target dimension current limiting mode is a fourth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining the current limiting calculation result as a processing result corresponding to each current limiting dimension;
under the condition that the target dimension current limiting mode is a fifth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited;
and under the condition that the target dimension current limiting mode is a sixth mode, directly determining the preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited.
As an alternative embodiment, in case the set of current limiting dimensions comprises a plurality of current limiting dimensions, the processing subunit is configured to:
determining a calculation order of the plurality of current limiting dimensions;
and processing each current limiting dimension in the plurality of current limiting dimensions by adopting the corresponding target dimension current limiting logic according to the calculation sequence.
As an alternative embodiment, the second determining subunit is configured to:
determining the calculation result as a first calculation result under the condition that at least one of the one or more processing results is used for indicating to limit the current of the target service, wherein the first calculation result is used for indicating to limit the current of the target service;
and determining the calculation result as a second calculation result under the condition that all the one or more processing results are used for indicating that the target service is not limited, wherein the second calculation result is used for indicating that the target service is not limited.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the present application, a server or a terminal for implementing the processing method of the service request is also provided.
Fig. 5 is a block diagram of a terminal according to an embodiment of the present application, and as shown in fig. 5, the terminal may include: one or more processors 501 (only one of which is shown), a memory 503, and a transmission means 505. as shown in fig. 5, the terminal may further include an input/output device 507.
The memory 503 may be used to store software programs and modules, such as program instructions/modules corresponding to the service request processing method and apparatus in the embodiment of the present application, and the processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 503, that is, implements the service request processing method described above. The memory 503 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 503 may further include memory located remotely from the processor 501, which may be connected to the terminal 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 transmission means 505 is used for receiving or sending data via a network, and may also be used for data transmission between the processor and the memory. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 505 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 505 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Among them, the memory 503 is used to store an application program in particular.
The processor 501 may call the application stored in the memory 503 through the transmission means 505 to perform the following steps:
s1, receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application;
s2, determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that the target service is processed by adopting target application current limiting logic;
s3, processing the target service request by adopting the target application current-limiting logic to obtain a target processing result;
s4, feeding back the target processing result to the target application.
By adopting the embodiment of the application, a scheme for processing the service request is provided. The target application current limiting mode corresponding to the target application is determined by the target service request initiated by the target application, so that the target service requested by the target application is processed by adopting the target application current limiting logic matched with the target application current limiting mode, the purpose of switching the application current limiting mode according to requirements is achieved, the technical effect of improving the flexibility of processing the service request is achieved, and the technical problem of poor flexibility of processing the service request is solved.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 5 is only an illustration, and the terminal may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a Mobile Internet Device (MID), a PAD, etc. Fig. 5 is a diagram illustrating a structure of the electronic device. For example, the terminal may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 5, or have a different configuration than shown in FIG. 5.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Embodiments of the present application also provide a storage medium. Alternatively, in this embodiment, the storage medium may be a program code for executing a processing method of a service request.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
s1, receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application;
s2, determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that the target service is processed by adopting target application current limiting logic;
s3, processing the target service request by adopting the target application current-limiting logic to obtain a target processing result;
s4, feeding back the target processing result to the target application.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (11)

1. A method for processing a service request, comprising:
receiving a target service request sent by a target application, wherein the target service request is used for requesting to provide a target service for the target application;
determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that target service is processed by adopting target application current limiting logic;
processing the target service request by adopting the target application current limiting logic to obtain a target processing result;
and feeding back the target processing result to the target application.
2. The method of claim 1, wherein determining a target application current limit mode corresponding to the target application from a plurality of application current limit modes comprises one of:
acquiring the target application current limiting mode corresponding to the target application from the applications with the corresponding relation and the application current limiting modes, wherein the plurality of application current limiting modes comprise: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application;
selecting the target application current limiting mode matched with the application attribute of the target application from the plurality of application current limiting modes, wherein the plurality of application current limiting modes comprise: the system comprises a first mode, a second mode and a third mode, wherein the first mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding the calculation result back to the target application, the second mode is used for indicating that the current limiting calculation is carried out on the target service to obtain a calculation result and feeding a preset result back to the target application, and the third mode is used for indicating that the preset result is directly fed back to the target application.
3. The method of claim 1, wherein processing the target service request with the target application throttling logic to obtain a target processing result comprises:
under the condition that the target application current limiting mode is the first mode, performing current limiting calculation on the target service to obtain a calculation result, wherein the calculation result is used for indicating whether to perform current limiting on the target service or not; determining the calculation result as the target processing result;
under the condition that the target application current limiting mode is the second mode, performing current limiting calculation on the target service to obtain a calculation result, wherein the calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset result as the target processing result, wherein the preset result is used for indicating that the target service is released;
and under the condition that the target application current limiting mode is the third mode, directly determining a preset result as the target processing result, wherein the preset result is used for indicating the target service to be released.
4. The method according to claim 3, wherein when the target application current limiting mode is the first mode or the second mode, performing current limiting calculation on the target service, and obtaining a calculation result comprises:
acquiring a current limiting dimension set corresponding to the target service, wherein the current limiting dimension set comprises one or more current limiting dimensions;
determining a target dimension current limiting mode corresponding to each current limiting dimension in the current limiting dimension set from a plurality of dimension current limiting modes, wherein the target dimension current limiting mode is used for indicating that each current limiting dimension is processed by adopting target dimension current limiting logic;
processing each current-limiting dimension by adopting the corresponding target dimension current-limiting logic to obtain one or more processing results;
determining the calculation result according to the one or more processing results.
5. The method of claim 4, wherein determining the target dimension current limit mode for each current limit dimension of the set of current limit dimensions from the plurality of dimension current limit modes comprises one of:
obtaining the target dimension current limiting mode corresponding to each current limiting dimension from the dimension and dimension current limiting modes with corresponding relations, wherein the plurality of dimension current limiting modes comprise: a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is performed on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension;
selecting the target dimension current limiting mode matched with the dimension attribute of each current limiting dimension from the plurality of dimension current limiting modes, wherein the plurality of dimension current limiting modes comprise: the current limiting device comprises a fourth mode, a fifth mode and a sixth mode, wherein the fourth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining the current limiting calculation result as a processing result corresponding to each current limiting dimension, the fifth mode is used for indicating that current limiting calculation is carried out on each current limiting dimension to obtain a current limiting calculation result and determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, and the sixth mode is used for indicating that the preset current limiting calculation result is directly determined as a processing result corresponding to each current limiting dimension.
6. The method of claim 4, wherein processing each current limiting dimension with the corresponding target dimension current limiting logic to obtain one or more processing results comprises:
under the condition that the target dimension current limiting mode is a fourth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining the current limiting calculation result as a processing result corresponding to each current limiting dimension;
under the condition that the target dimension current limiting mode is a fifth mode, performing current limiting calculation on each current limiting dimension to obtain a current limiting calculation result, wherein the current limiting calculation result is used for indicating whether to perform current limiting on the target service or not; determining a preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited;
and under the condition that the target dimension current limiting mode is a sixth mode, directly determining the preset current limiting calculation result as a processing result corresponding to each current limiting dimension, wherein the preset current limiting calculation result is used for indicating that the target service is not limited.
7. The method of claim 4, wherein, in a case that the set of current limiting dimensions includes a plurality of current limiting dimensions, processing each current limiting dimension with the corresponding target dimension current limiting logic to obtain the one or more processing results comprises:
determining a calculation order of the plurality of current limiting dimensions;
and processing each current limiting dimension in the plurality of current limiting dimensions by adopting the corresponding target dimension current limiting logic according to the calculation sequence.
8. The method of claim 4, wherein determining the calculation result from the one or more processing results comprises:
determining the calculation result as a first calculation result under the condition that at least one of the one or more processing results is used for indicating to limit the current of the target service, wherein the first calculation result is used for indicating to limit the current of the target service;
and determining the calculation result as a second calculation result under the condition that all the one or more processing results are used for indicating that the target service is not limited, wherein the second calculation result is used for indicating that the target service is not limited.
9. An apparatus for processing a service request, comprising:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a target service request sent by a target application, and the target service request is used for requesting to provide a target service for the target application;
the determining module is used for determining a target application current limiting mode corresponding to the target application from a plurality of application current limiting modes, wherein the target application current limiting mode is used for indicating that target service is processed by adopting target application current limiting logic;
the processing module is used for processing the target service request by adopting the target application current-limiting logic to obtain a target processing result;
and the feedback module is used for feeding back the target processing result to the target application.
10. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program when executed performs the method of any of the preceding claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the method of any of the preceding claims 1 to 8 by means of the computer program.
CN201911168835.7A 2019-11-25 2019-11-25 Service request processing method and device Pending CN111163123A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911168835.7A CN111163123A (en) 2019-11-25 2019-11-25 Service request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911168835.7A CN111163123A (en) 2019-11-25 2019-11-25 Service request processing method and device

Publications (1)

Publication Number Publication Date
CN111163123A true CN111163123A (en) 2020-05-15

Family

ID=70556013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911168835.7A Pending CN111163123A (en) 2019-11-25 2019-11-25 Service request processing method and device

Country Status (1)

Country Link
CN (1) CN111163123A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114567507A (en) * 2022-03-11 2022-05-31 平安普惠企业管理有限公司 Current limiting method, system, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375472A (en) * 2016-09-29 2017-02-01 北京三快在线科技有限公司 Access request processing method and apparatus, and server
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN108418764A (en) * 2018-02-07 2018-08-17 深圳壹账通智能科技有限公司 Current-limiting method, device, computer equipment and storage medium
CN109871260A (en) * 2019-02-22 2019-06-11 今天东翼科技有限公司 A kind of various dimensions service current-limiting method and system based on shared drive between container

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170272371A1 (en) * 2016-03-21 2017-09-21 Alibaba Group Holding Limited Flow control in connection with an access request
CN106375472A (en) * 2016-09-29 2017-02-01 北京三快在线科技有限公司 Access request processing method and apparatus, and server
CN108418764A (en) * 2018-02-07 2018-08-17 深圳壹账通智能科技有限公司 Current-limiting method, device, computer equipment and storage medium
CN109871260A (en) * 2019-02-22 2019-06-11 今天东翼科技有限公司 A kind of various dimensions service current-limiting method and system based on shared drive between container

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114567507A (en) * 2022-03-11 2022-05-31 平安普惠企业管理有限公司 Current limiting method, system, device and storage medium

Similar Documents

Publication Publication Date Title
CN107682397B (en) Customer resources acquisition methods, device, terminal device and storage medium
CN108961052A (en) Verification method, storage method, device, equipment and the medium of block chain data
CN106933871A (en) Short linking processing method, device and short linked server
CN107920094B (en) Data acquisition method and device, server and network equipment
CN108718337B (en) Website account login, verification and verification information processing method, device and system
CN106649446B (en) Information pushing method and device
CN112800466B (en) Data processing method and device based on privacy protection and server
CN106534268B (en) Data sharing method and device
CN109214543B (en) Data processing method and device
CN104618388B (en) Fast registration login method and corresponding resetting server, information server
CN107807935B (en) Using recommended method and device
CN106998314B (en) Account interaction method and device
CN105426416A (en) Transmission method and device of uniform resource locator, and sharing method and device of uniform resource locator
CN113411404A (en) File downloading method, device, server and storage medium
CN107329916A (en) A kind of USB device control method, device and computing device
CN112765364A (en) Group chat session ordering method and device, storage medium and electronic equipment
CN104468330A (en) Data processing method and device of distributed information queue
CN109636460B (en) Service processing method, device, equipment and storage medium
KR20170022138A (en) Apparatus, method and computer program for providing contents sharing service
CN111190727A (en) Asynchronous memory destructuring method and device, computer equipment and storage medium
CN104408178A (en) Device and method for WEB control loading
CN104778389A (en) Numerical value transferring method, terminal, server and system
CN111163123A (en) Service request processing method and device
CN115952398A (en) Data uploading statistical calculation method and system based on Internet of things and storage medium
CN113254989B (en) Fusion method and device of target data and server

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: 20200515