CN115801685A - Application service current limiting method, device, equipment and storage medium - Google Patents

Application service current limiting method, device, equipment and storage medium Download PDF

Info

Publication number
CN115801685A
CN115801685A CN202211650588.6A CN202211650588A CN115801685A CN 115801685 A CN115801685 A CN 115801685A CN 202211650588 A CN202211650588 A CN 202211650588A CN 115801685 A CN115801685 A CN 115801685A
Authority
CN
China
Prior art keywords
service
application service
current limiting
access
target
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
CN202211650588.6A
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211650588.6A priority Critical patent/CN115801685A/en
Publication of CN115801685A publication Critical patent/CN115801685A/en
Pending legal-status Critical Current

Links

Images

Abstract

The application provides a method, a device, equipment and a storage medium for limiting the current of application services, wherein the method comprises the following steps: responding to an application service current limiting request, and acquiring a target application service pointed by the application service current limiting request and each service sub-interface in the target application service; acquiring access counters corresponding to all service sub-interfaces in the target application service, and reading access count values of all the access counters; reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code; and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy. Different degradation strategies and current limiting thresholds are set for different service interfaces according to service complexity, and therefore flexibility of service current limiting is improved.

Description

Application service current limiting method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for limiting current for application services.
Background
At present, in the software development process, in order to avoid the situation that the application service is not available due to insufficient application service resources caused by too high access requests under the high concurrency condition after the application service is released online, a developer needs to perform current limiting on part of the application service, the current limiting mode is to configure a service access threshold value in a server to perform current limiting on the application service access, however, the current limiting mode is to perform the same threshold value current limiting on all interfaces in the application service, so that the maximum flow of the application service depends on the interface with the worst performance, and the application service performance is reduced and the configuration flexibility is poor.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a storage medium for limiting the current of application services, and aims to solve the technical problem that the current of application services is configured flexibly and relatively poor in the prior art.
In one aspect, an embodiment of the present application provides an application service throttling method, where the application service throttling method includes the following steps:
responding to an application service current limiting request, and acquiring a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters;
reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy.
In a possible implementation manner of the present application, the obtaining an access counter corresponding to each service subinterface in the target application service, and reading an access count value of the access counter includes:
accessing a project source code database to obtain a target project source code of the target application service;
traversing the tangent plane method class in the target project source code to obtain an access counter corresponding to each service subinterface in the target application service;
and reading the time window in each access counter to obtain the access count value of each access counter.
In a possible implementation manner of the present application, before the obtaining an access counter corresponding to each service subinterface in the target application service and reading an access count value of the access counter, the method further includes:
reading the current time and the counter time of the access counter aiming at the access counter corresponding to each service subinterface, and comparing the current time and the counter time;
if the time difference value between the current time and the counter time is smaller than the time window threshold value of the access counter, counting the access count value of the access counter;
and if the time difference value between the current system time and the counter time is greater than or equal to the time window threshold of the access counter, resetting the counter time of the access counter.
In a possible implementation manner of the present application, before the reading of the target item source code of the target application service and obtaining the current limit threshold corresponding to each service sub-interface in the target item source code, the method further includes:
acquiring the service type and the service complexity of each service sub-interface in the target application service;
inputting the service type and the service complexity of each service sub-interface into a preset current limiting model for current limiting calculation to obtain a current limiting threshold value of each service sub-interface;
and writing each service sub-interface and the current limiting threshold into the target project source code in an associated manner according to a preset annotation strategy.
In a possible implementation manner of the present application, the obtaining a degradation policy preset for each service subinterface, and performing service throttling on the service subinterface in the target application service according to the throttling threshold, the access count value, and the degradation policy includes:
responding to a service access request, and acquiring a service sub-interface corresponding to the service access request and a degradation strategy of the service sub-interface;
comparing the current limiting threshold value of the service sub-interface with the access count value of the service sub-interface;
if the access count value is smaller than the current limiting threshold value, updating the access count value and driving a service sub-interface of the target application service to execute the service access request;
and if the access count value is larger than the current limiting threshold value, performing service current limiting on a service subinterface of the target application service according to the degradation strategy.
In a possible implementation manner of the present application, if the access count value is greater than the current limit threshold, performing service current limit on a service subinterface of the target application service according to the degradation policy includes:
if the access count value is larger than the current limiting threshold value, obtaining a degradation thread and a degradation feedback parameter in the degradation strategy;
and calling the degradation thread to degrade a service subinterface of the target application service, and returning the degradation feedback parameter.
In a possible implementation manner of the present application, the obtaining a degradation policy preset for each service subinterface, and performing service throttling on the service subinterface in the target application service according to the throttling threshold, the access count value, and the degradation policy includes:
calculating interface load data of each service sub-interface in the target application service according to the access count value and the current limiting threshold value;
accessing a degradation strategy database, acquiring a degradation strategy corresponding to the interface load data, and extracting a load degradation strategy in the degradation strategy;
and performing service flow limitation on the service subinterfaces in the target application service according to the load degradation strategy.
In another aspect, the present application provides an application service current limiting apparatus, including:
the service acquisition module is configured to respond to an application service current limiting request, and acquire a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
the counting and reading module is configured to acquire access counters corresponding to service sub-interfaces in the target application service and read access count values of the access counters;
a threshold obtaining module, configured to read a target project source code of the target application service, and obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and the service flow limiting module is configured to acquire a degradation strategy preset by each service subinterface, and perform service flow limitation on the service subinterfaces in the target application service according to the flow limiting threshold, the access count value and the degradation strategy.
In another aspect, the present application further provides an application service current limiting device, where the application service current limiting device includes:
one or more processors;
a memory; and
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the steps of the application service throttling method.
In another aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is loaded by a processor to execute the steps in the application service throttling method.
In the application, a target application service pointed by an application service current limiting request and each service sub-interface in the target application service are obtained by responding to the application service current limiting request; acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters; reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code; and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy. Different degradation strategies and current limiting thresholds are set for different service interfaces according to the service complexity, so that the flexibility of service current limiting is improved, the normal operation of the interface with busy service is ensured, and the operation stability of the service application service is ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of a scenario in which a service throttling method is applied according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating an embodiment of a method for throttling application services in an embodiment of the present application;
fig. 3 is a schematic flowchart of an embodiment of performing service throttling on a service subinterface in an application service throttling method according to the embodiment of the present application;
fig. 4 is a schematic flowchart of another embodiment of throttling a service subinterface in an application service throttling method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an embodiment of an application service current limiting apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an embodiment of an application service current limiting device provided in an embodiment of the present application.
Detailed Description
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 a part of the embodiments of the present invention, and not all of the 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 invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be considered as limiting the present invention. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In this application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the invention. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and processes are not shown in detail to avoid obscuring the description of the invention with unnecessary detail. Thus, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
At present, in the software development process, in order to avoid the situation that the application service is not available due to insufficient application service resources caused by too high access requests under the high concurrency condition after the application service is released online, a developer needs to perform current limiting on part of the application service, the current limiting mode is to configure a service access threshold value in a server to perform current limiting on the application service access, however, the current limiting mode is to perform the same threshold value current limiting on all interfaces in the application service, so that the maximum flow of the application service depends on the interface with the worst performance, and the application service performance is reduced and the configuration flexibility is poor.
Based on this, the application provides an application service current limiting method, device, equipment and computer readable storage medium, so as to solve the technical problem in the prior art that the application service current limiting configuration is flexible and poor.
The application service current limiting method is applied to an application service current limiting device, the application service current limiting device is arranged in application service current limiting equipment, one or more processors, a memory and one or more application programs are arranged in the application service current limiting equipment, and the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the application service current limiting method; the application service current limiting device can be an intelligent terminal, such as a mobile phone, a tablet computer, a network device, an intelligent computer and the like; optionally, the application service current limiting device may also be a server or a service cluster formed by multiple servers.
As shown in fig. 1, fig. 1 is a schematic view of a scenario of an application service current limiting method according to an embodiment of the present application, where the scenario of application service current limiting in the embodiment of the present application includes an application service current limiting device 100 (an application service current limiting device is integrated in the application service current limiting device 100) and a target service terminal 200, and a computer-readable storage medium corresponding to the application service current limiting method is run in the application service current limiting device 100 to execute a step of the application service current limiting method. The target service terminal 200 is a service terminal performing service access with the application service throttling device 100.
It should be understood that the application service current limiting device in the scenario of the application service current limiting method shown in fig. 1, or the device included in the application service current limiting device, does not limit the embodiment of the present invention, that is, the number of the devices and the type of the application service current limiting device included in the scenario of the application service current limiting method, or the number of the devices and the type of the devices included in each device do not affect the overall implementation of the technical solution in the embodiment of the present invention, and may be calculated as equivalent replacements or derivatives of the technical solution claimed in the embodiment of the present invention.
The application service current limiting device 100 in the embodiment of the present invention is mainly used for: responding to an application service flow limiting request, and acquiring a target application service pointed by the application service flow limiting request and each service sub-interface in the target application service;
acquiring access counters corresponding to all service sub-interfaces in the target application service, and reading access count values of all the access counters;
reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy.
The application service current limiting device 100 in the embodiment of the present invention may be an independent application service current limiting device, such as an intelligent terminal like a mobile phone, a tablet computer, a network device, a server, and an intelligent computer, or an application service current limiting network or an application service current limiting cluster composed of a plurality of application service current limiting devices.
Embodiments of the present application provide a method, an apparatus, a device, and a computer-readable storage medium for limiting current of an application service, which are described in detail below.
Those skilled in the art can understand that the application environment shown in fig. 1 is only one of the application scenarios related to the present application scheme, and does not constitute a limitation on the application scenario of the present application scheme, and other application environments may further include more or less application service current limiting devices than those shown in fig. 1, or an application service current limiting network connection relationship, for example, only one application service current limiting device is shown in fig. 1, and it is understood that the scenario of the application service current limiting method may further include one or more application service current limiting devices, which is not limited herein; the application service current limiting device 100 may also include a memory for storing current limiting thresholds and other data.
It should be noted that the scenario diagram of the application service current limiting method shown in fig. 1 is only an example, and the scenario of the application service current limiting method described in the embodiment of the present invention is for more clearly illustrating the technical solution of the embodiment of the present invention, and does not limit the technical solution provided by the embodiment of the present invention.
Based on the above scenario of the application service current limiting method, various embodiments of the application service current limiting method disclosed in the present invention are provided.
As shown in fig. 2, fig. 2 is a schematic flowchart of an embodiment of an application service throttling method in the embodiment of the present application, where the application service throttling method includes the following steps 201 to 204:
201. responding to an application service flow limiting request, and acquiring a target application service pointed by the application service flow limiting request and each service sub-interface in the target application service;
the application service current limiting method in this embodiment is applied to application service current limiting devices, and the types and the number of the application service current limiting devices are not specifically limited, that is, the application service current limiting devices may be one or more intelligent terminals or servers, and in a specific embodiment, the application service current limiting devices are intelligent computers.
Specifically, the application service current limiting device is configured to perform service current limiting operation on each service subinterface in the target application service according to a preset degradation policy and a current limiting threshold value through an access counter corresponding to each service subinterface under the conditions of high concurrency and insufficient service resources.
Specifically, the application service current limiting device receives an application service current limiting request in an operation process, where the application service current limiting request is an operation instruction for driving the application service current limiting device to perform service current limiting on a specific service sub-interface in a target application service. Optionally, the triggering manner of the service flow limiting request is not specifically limited herein, that is, the service flow limiting request may be actively triggered by a user, for example, the user is an operation and maintenance person, and the application service flow limiting request is actively triggered by clicking a service flow limiting button of the application service flow limiting device. In addition, the application service flow limiting request may also be automatically triggered by the application service flow limiting device, for example, the application service flow limiting request is preset with a flow limiting threshold and a degradation policy corresponding to each service interface, and the application service flow limiting request is automatically triggered in a preset scenario.
Specifically, after receiving an application service current limiting request, the application service current limiting device parses the application service current limiting request, obtains an application service identifier carried in the application service current limiting request, inputs the application service identifier into a preset application service database, obtains an application service associated with the application service identifier in the application service database, and sets the application service associated with the application service identifier as a target application service.
And after the application service current limiting equipment acquires the target application service pointed by the application service current limiting request, the application service current limiting equipment also acquires each service sub-interface in the target application service.
202. Acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters;
after the application service current limiting device obtains each service subinterface in the target application service, the application service current limiting device also obtains an access counter corresponding to each service subinterface in the target application service, and reads an access count value in each access counter.
Specifically, when the application service flow limiting device generates each application service, an access counter is set in advance for each service subinterface in each application service, so that service flow limitation is performed on each service subinterface according to the access counter.
Specifically, the application service flow limiting device writes a tangent method of the access counter in the project source code of the application service, so that the access counter can take effect in the whole life cycle of the service subinterface. Optionally, the access counter is an integer variable type counter.
Specifically, after the application service current limiting device updates the project source code of each application service, the updated project source code of each application service is stored in the project source code database.
Specifically, after acquiring the target application service and each service sub-interface, the application service current limiting device accesses the source code database, and acquires the target project source code of the target application service through the gitclone command.
After the application service current limiting equipment acquires the target project source code of the target application service, the slicing method class in the target project source code is facilitated, and therefore the access counter corresponding to each service sub-interface in the target application service is acquired.
After the application service current limiting device obtains the access counter corresponding to the service subinterface, the application service current limiting device reads the time window of the access counter, and therefore the access count value of the access counter of the service subinterface is obtained. And the access count value is the access times of the service subinterface in a preset time window. Optionally, in a specific embodiment, the time window is 1 second.
Specifically, the application service current limiting device reads the counter time of the access counter for an access counter corresponding to each service sub-interface, and obtains the current time, where the current time is the system time of the application service current limiting device.
And after acquiring the current time and the counter time, the application service current limiting equipment compares the current time with the counter time and updates the access counter according to the comparison result.
Optionally, if the time difference between the current time and the counter time is smaller than the time window threshold of the access counter, the application service current limiting device counts the access count value of the access counter.
Optionally, if the time interpolation between the current time and the counter time is greater than or equal to the time window threshold of the access timer, the counter time of the access counter is recharged.
203. Reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
specifically, after acquiring the access count value of the access counter, the application service current limiting device also reads a target item source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface recorded in the target item source code.
Specifically, the application service flow limiting device creates a flow limiting model in advance, wherein the flow limiting model is configured as an AI model for calculating flow limiting thresholds of each service subinterface. The application service current limiting equipment acquires the service type and the service complexity of each service sub-interface in the target application service, and inputs the service type and the service complexity of each service sub-interface into the current limiting model for current limiting calculation, so that the current limiting threshold value of each service sub-interface is obtained. Wherein the service complexity is the historical service access volume of the service subinterface.
After the current limiting threshold value of each service sub-interface is obtained through calculation of a current limiting model by the application service current limiting equipment, each service sub-interface and the current limiting threshold value are written into a target item source code of the target application service in an associated mode according to a preset annotation strategy.
Specifically, after acquiring a target project source code of a target application service, the application service current limiting device queries a current limiting threshold corresponding to each service sub-interface in the target project source code, and performs service current limiting on each service sub-interface through the current limiting threshold.
204. And obtaining a degradation strategy preset by each service subinterface, and performing service flow limitation on the service subinterfaces in the target application service according to the flow limitation threshold, the access count value and the degradation strategy.
Specifically, after acquiring the current limit threshold of each service subinterface, the application service current limiting device also acquires a degradation policy preset for each service subinterface, and performs service current limiting on each service subinterface in the target application service according to the current limit threshold, the access count value, and the degradation policy.
Specifically, after the application service current limiting device obtains the target project source code, different degradation strategies are preset in the project source code corresponding to each service subinterface in a way of annotating a cut plane writing method, and after a service access request is received, if the access count value is greater than a current limiting threshold value, service current limiting is performed on the service subinterfaces through degradation threads and degradation feedback parameters in the degradation strategies.
And the application service current limiting equipment calls a degradation thread to degrade a service subinterface to be limited in the target application service and returns the degradation feedback parameter.
In this embodiment, an application service current limiting device obtains a target application service to which an application service current limiting request points and each service sub-interface in the target application service by responding to the application service current limiting request; acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters; reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code; and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy. Different degradation strategies and current limiting thresholds are set for different service interfaces according to the service complexity, so that the flexibility of service current limiting is improved, the normal operation of the interface with busy service is ensured, and the operation stability of the service application service is ensured.
As shown in fig. 3, fig. 3 is a schematic flowchart of an embodiment of performing service throttling on a service subinterface in an application service throttling method provided in the embodiment of the present application, and specifically includes steps 301 to 304:
301. responding to a service access request, and acquiring a service sub-interface corresponding to the service access request and a degradation strategy of the service sub-interface;
302. comparing the current limiting threshold value of the service sub-interface with the access count value of the service sub-interface;
303. if the access count value is smaller than the current limit threshold value, updating the access count value and driving a service sub-interface of the target application service to execute the service access request;
303. and if the access count value is larger than the current limiting threshold value, performing service current limiting on a service subinterface of the target application service according to the degradation strategy.
Based on the foregoing embodiment, in this embodiment, the application service throttling device receives a service access request, determines a service subinterface corresponding to the service request, obtains a degradation policy of the service subinterface, and performs service throttling on the service subinterface according to the degradation policy.
Specifically, the application service current limiting device performs flow detection on the service sub-interface, and compares a current limiting threshold of the service sub-interface with an access count value of the service sub-interface, thereby determining whether the service sub-interface needs to limit current.
Optionally, if the access count value is smaller than the current limit threshold, it is determined that the access traffic of the service sub-interface is in a normal interval, and the application service current limit device updates the access count value and drives the service sub-interface of the target application service to execute the service access request.
Optionally, if the access count value is greater than or equal to the current limit threshold, performing service current limit on the service subinterface corresponding to the service access request according to the degradation policy.
Specifically, the application service current limiting device obtains a degradation thread and a degradation feedback parameter in the degradation policy, calls the degradation thread to degrade a service subinterface of the target application service, and returns the degradation feedback parameter. Optionally, in a specific embodiment, the downgrading policy is a fallback downgrading policy.
In this embodiment, an application service current limiting device obtains a service subinterface corresponding to a service access request and a degradation policy of the service subinterface by responding to the service access request; comparing the current limiting threshold value of the service sub-interface with the access count value of the service sub-interface; if the access count value is smaller than the current limiting threshold value, updating the access count value and driving a service sub-interface of the target application service to execute the service access request; and if the access count value is larger than the current limiting threshold value, performing service current limiting on a service subinterface of the target application service according to the degradation strategy. Different degradation strategies are set according to different service complexity of different service sub-interfaces to perform service current limiting, and flexibility of service current limiting is improved.
As shown in fig. 4, fig. 4 is a schematic flowchart of another embodiment of limiting a flow of a service subinterface in an application service flow limiting method provided in the embodiment of the present application, specifically including steps 401 to 403:
401. calculating interface load data of each service sub-interface in the target application service according to the access count value and the current limiting threshold value;
402. accessing a degradation strategy database, acquiring a degradation strategy corresponding to the interface load data, and extracting a load degradation strategy in the degradation strategy;
403. and performing service flow limitation on the service subinterfaces in the target application service according to the load degradation strategy.
Based on the foregoing embodiment, in this embodiment, the application service current limiting device further limits the current of the service subinterface according to the access count value and the current limiting threshold of each service subinterface by the interface load data and according to the interface load data.
Specifically, the application service current limiting device calculates interface load data of each service subinterface in the target application service according to the access count value and the current limiting threshold of each service subinterface, and specifically, the application service current limiting device divides the access count value of the service subinterface by the current limiting threshold of the service subinterface, so as to obtain the interface load data of the service subinterface.
Specifically, after acquiring interface load data of a service sub-interface, the application service current limiting device determines a load interval in which the interface load data falls, acquires a degradation strategy of the service sub-interface, and acquires a load degradation strategy in the degradation strategy.
Specifically, after the application service current limiting device obtains the load degradation policy, access current limiting is performed on a service sub-interface in the target application service according to the load degradation policy. Namely, the application service current limiting device obtains the load degradation thread and the load interval in the load degradation strategy, calls the load degradation thread to degrade the service sub-interface, and returns the load reminding parameter associated with the load interval.
In this embodiment, the application service current limiting device calculates interface load data of each service sub-interface in the target application service according to the access count value and the current limiting threshold; accessing a degradation strategy database, acquiring a degradation strategy corresponding to the interface load data, and extracting a load degradation strategy in the degradation strategy; and performing service flow limitation on the service subinterfaces in the target application service according to the load degradation strategy. The flexible degradation of the service subinterface is realized according to the load condition of the service subinterface.
In order to better implement the method for limiting the application service in the embodiment of the present application, based on the method for limiting the application service, an application service current limiting device is further provided in the embodiment of the present application, as shown in fig. 5, fig. 5 is a schematic structural diagram of the application service current limiting device provided in the embodiment of the present application, and specifically, the application service current limiting device 500 includes:
a service obtaining module 501, configured to respond to an application service current limiting request, and obtain a target application service to which the application service current limiting request points and service subinterfaces in the target application service;
a count reading module 502 configured to obtain access counters corresponding to service subinterfaces in the target application service, and read access count values of the access counters;
a threshold obtaining module 503, configured to read a target item source code of the target application service, and obtain a current limiting threshold corresponding to each service sub-interface in the target item source code;
and the service current limiting module 504 is configured to obtain a degradation policy preset by each service subinterface, and perform service current limiting on the service subinterfaces in the target application service according to the current limiting threshold, the access count value, and the degradation policy.
In a possible implementation manner of the present application, the obtaining, by an application service current limiting device, an access counter corresponding to each service subinterface in the target application service, and reading an access count value of the access counter includes:
accessing a project source code database to obtain a target project source code of the target application service;
traversing the section method class in the target project source code to obtain an access counter corresponding to each service subinterface in the target application service;
and reading the time window in each access counter to obtain the access count value of each access counter.
In a possible implementation manner of the present application, before the application service current limiting apparatus obtains an access counter corresponding to each service sub-interface in the target application service and reads an access count value of the access counter, the method further includes:
reading the current time and the counter time of the access counter aiming at the access counter corresponding to each service subinterface, and comparing the current time and the counter time;
if the time difference value between the current time and the counter time is smaller than the time window threshold value of the access counter, counting the access count value of the access counter;
and if the time difference value between the current system time and the counter time is greater than or equal to the time window threshold of the access counter, resetting the counter time of the access counter.
In a possible implementation manner of the present application, before the application service current limiting apparatus reads a target item source code of the target application service and obtains a current limiting threshold corresponding to each service sub-interface in the target item source code, the method further includes:
acquiring the service type and the service complexity of each service sub-interface in the target application service;
inputting the service type and the service complexity of each service subinterface into a preset current limiting model for current limiting calculation to obtain a current limiting threshold value of each service subinterface;
and writing each service sub-interface and the current limiting threshold into the target project source code in an associated manner according to a preset annotation strategy.
In a possible implementation manner of the present application, an application service throttling apparatus obtains a degradation policy preset for each service subinterface, and performs service throttling on a service subinterface in the target application service according to the throttling threshold, the access count value, and the degradation policy, including:
responding to a service access request, and acquiring a service sub-interface corresponding to the service access request and a degradation strategy of the service sub-interface;
comparing the current limiting threshold value of the service sub-interface with the access count value of the service sub-interface;
if the access count value is smaller than the current limiting threshold value, updating the access count value and driving a service sub-interface of the target application service to execute the service access request;
and if the access count value is larger than the current limiting threshold value, performing service current limiting on a service subinterface of the target application service according to the degradation strategy.
In a possible implementation manner of the present application, if the access count value is greater than the current limit threshold, the limiting device performs service current limit on a service subinterface of the target application service according to the degradation policy, including:
if the access count value is larger than the current limiting threshold value, obtaining a degradation thread and a degradation feedback parameter in the degradation strategy;
and calling the degradation thread to degrade the service subinterface of the target application service, and returning the degradation feedback parameter.
In a possible implementation manner of the present application, an application service throttling apparatus obtains a degradation policy preset for each service subinterface, and performs service throttling on a service subinterface in the target application service according to the throttling threshold, the access count value, and the degradation policy, including:
calculating interface load data of each service sub-interface in the target application service according to the access count value and the current limiting threshold value;
accessing a degradation strategy database, acquiring a degradation strategy corresponding to the interface load data, and extracting a load degradation strategy in the degradation strategy;
and performing service flow limitation on the service subinterfaces in the target application service according to the load degradation strategy.
In this embodiment, an application service current limiting device obtains a target application service to which an application service current limiting request points and each service sub-interface in the target application service by responding to the application service current limiting request; acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters; reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code; and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy. Different degradation strategies and current limiting thresholds are set for different service interfaces according to the service complexity, so that the flexibility of service current limiting is improved, the normal operation of the interface with busy service is ensured, and the operation stability of the service application service is ensured.
An embodiment of the present invention further provides an application service current limiting device, as shown in fig. 6, fig. 6 is a schematic structural diagram of an embodiment of the application service current limiting device provided in the embodiment of the present application.
The application service current limiting device integrates any application service current limiting device provided by the embodiment of the invention, and comprises:
one or more processors;
a memory; and
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor for performing the steps of the application service throttling method described in any of the above embodiments of the application service throttling method.
Specifically, the method comprises the following steps: the application service current limiting device may include components such as a processor 601 of one or more processing cores, memory 602 of one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will appreciate that the application service flow limiting device configuration shown in fig. 6 does not constitute a limitation of the application service flow limiting device and may include more or fewer components than shown, or some components in combination, or a different arrangement of components. Wherein:
the processor 601 is a control center of the application service current limiting device, connects various parts of the whole application service current limiting device by using various interfaces and lines, and executes various functions of the application service current limiting device and processes data by running or executing software programs and/or modules stored in the memory 602 and calling data stored in the memory 602, thereby performing overall monitoring on the application service current limiting device. Optionally, processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 601.
The memory 602 may be used to store software programs and modules, and the processor 601 executes various functional applications and data processing by operating the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the application service throttling device, and the like. Further, the memory 602 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
The application service current limiting device further comprises a power supply 603 for supplying power to each component, and preferably, the power supply 603 may be logically connected to the processor 601 through a power management system, so that functions of managing charging, discharging, power consumption management and the like are realized through the power management system. The power supply 603 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The application service restriction apparatus may further include an input unit 604, and the input unit 604 may be used to receive input numeric or character information and generate a keyboard, mouse, joystick, optical or trackball signal input related to user setting and function control.
Although not shown, the application service current limiting device may further include a display unit and the like, which will not be described herein. Specifically, in this embodiment, the processor 601 in the application service throttling device loads an executable file corresponding to a process of one or more application programs into the memory 602 according to the following instructions, and the processor 601 runs the application programs stored in the memory 602, thereby implementing various functions as follows:
responding to an application service current limiting request, and acquiring a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters;
reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and obtaining a degradation strategy preset by each service subinterface, and performing service flow limitation on the service subinterfaces in the target application service according to the flow limitation threshold, the access count value and the degradation strategy.
To this end, an embodiment of the present invention provides a computer-readable storage medium, which may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like. The application service throttling method comprises a first step of limiting the current of the application service, a second step of limiting the current of the application service, and a third step of limiting the current of the application service. For example, the computer program may be loaded by a processor to perform the steps of:
responding to an application service current limiting request, and acquiring a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
acquiring access counters corresponding to service sub-interfaces in the target application service, and reading access count values of the access counters;
reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and obtaining the target application service to obtain a degradation strategy preset by each service subinterface, and performing service current limitation on the service provided by the service subinterface in the target application service according to the current limitation threshold, the access count value and the degradation strategy.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed descriptions of other embodiments, and are not described herein again.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing method embodiment, which is not described herein again.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
The application service current limiting method provided by the embodiment of the present application is described in detail above, and the principle and the implementation of the present invention are explained in this document by applying specific embodiments, and the description of the above embodiment is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. An application service throttling method, characterized in that the application service throttling method comprises:
responding to an application service current limiting request, and acquiring a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
acquiring access counters corresponding to all service sub-interfaces in the target application service, and reading access count values of all the access counters;
reading a target project source code of the target application service to obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and obtaining a degradation strategy preset by each service subinterface, and performing service current limitation on the service subinterfaces in the target application service according to the current limiting threshold, the access count value and the degradation strategy.
2. The method for limiting current of application services according to claim 1, wherein the obtaining an access counter corresponding to each service subinterface in the target application service, and reading an access count value of the access counter includes:
accessing a project source code database to obtain a target project source code of the target application service;
traversing the section method class in the target project source code to obtain an access counter corresponding to each service subinterface in the target application service;
and reading the time window in each access counter to obtain the access count value of each access counter.
3. The method for limiting current of application services according to claim 1, wherein before obtaining the access counter corresponding to each service subinterface in the target application service and reading the access count value of the access counter, the method further comprises:
reading the current time and the counter time of the access counter aiming at the access counter corresponding to each service subinterface, and comparing the current time with the counter time;
if the time difference value between the current time and the counter time is smaller than the time window threshold value of the access counter, counting the access count value of the access counter;
and if the time difference value between the current time and the counter time is greater than or equal to the time window threshold of the access counter, resetting the counter time of the access counter.
4. The method for limiting current of application services according to claim 1, wherein before reading the target item source code of the target application service and obtaining the current limiting threshold corresponding to each service sub-interface in the target item source code, the method further comprises:
acquiring the service type and the service complexity of each service subinterface in the target application service;
inputting the service type and the service complexity of each service sub-interface into a preset current limiting model for current limiting calculation to obtain a current limiting threshold value of each service sub-interface;
and writing each service sub-interface and the current limiting threshold into the target project source code in an associated manner according to a preset annotation strategy.
5. The method for restricting application services according to claim 1, wherein the obtaining a predetermined degradation policy for each service subinterface and performing service restriction on the service subinterface in the target application service according to the flow restriction threshold, the access count value, and the degradation policy includes:
responding to a service access request, and acquiring a service sub-interface corresponding to the service access request and a degradation strategy of the service sub-interface;
comparing the current limiting threshold value of the service sub-interface with the access count value of the service sub-interface;
if the access count value is smaller than the current limiting threshold value, updating the access count value and driving a service sub-interface of the target application service to execute the service access request;
and if the access count value is larger than the current limiting threshold value, performing service current limiting on a service subinterface of the target application service according to the degradation strategy.
6. The method of claim 5, wherein the performing service throttling on the service subinterface of the target application service according to the degradation policy if the access count value is greater than the throttling threshold comprises:
if the access count value is larger than the current limiting threshold value, obtaining a degradation thread and a degradation feedback parameter in the degradation strategy;
and calling the degradation thread to degrade the service subinterface of the target application service, and returning the degradation feedback parameter.
7. The method for limiting application service flow according to claim 1, wherein the obtaining a degradation policy preset for each service subinterface and performing service flow limitation on the service subinterface in the target application service according to the flow limitation threshold, the access count value, and the degradation policy includes:
calculating interface load data of each service sub-interface in the target application service according to the access count value and the current limiting threshold value;
accessing a degradation strategy database, acquiring a degradation strategy corresponding to the interface load data, and extracting a load degradation strategy in the degradation strategy;
and performing service flow limitation on the service subinterfaces in the target application service according to the load degradation strategy.
8. An application service current limiting apparatus, comprising:
the service acquisition module is configured to respond to an application service current limiting request, and acquire a target application service pointed by the application service current limiting request and each service sub-interface in the target application service;
the counting and reading module is configured to acquire access counters corresponding to service sub-interfaces in the target application service and read access count values of the access counters;
a threshold obtaining module, configured to read a target project source code of the target application service, and obtain a current limiting threshold corresponding to each service sub-interface in the target project source code;
and the service flow limiting module is configured to acquire a degradation strategy preset by each service subinterface, and perform service flow limitation on the service subinterfaces in the target application service according to the flow limiting threshold, the access count value and the degradation strategy.
9. An application service throttling device, the application service throttling device comprising:
one or more processors;
a memory; and
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the steps of the application service throttling method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program which is loadable by a processor to perform the steps of the application service throttling method of any of claims 1 to 7.
CN202211650588.6A 2022-12-21 2022-12-21 Application service current limiting method, device, equipment and storage medium Pending CN115801685A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211650588.6A CN115801685A (en) 2022-12-21 2022-12-21 Application service current limiting method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211650588.6A CN115801685A (en) 2022-12-21 2022-12-21 Application service current limiting method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115801685A true CN115801685A (en) 2023-03-14

Family

ID=85426226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211650588.6A Pending CN115801685A (en) 2022-12-21 2022-12-21 Application service current limiting method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115801685A (en)

Similar Documents

Publication Publication Date Title
US11182213B2 (en) Application program management method and device
CN111030936B (en) Current-limiting control method and device for network access and computer-readable storage medium
US8516499B2 (en) Assistance in performing action responsive to detected event
US20120144392A1 (en) Resource Manager for Managing Hardware Resources
CN106940671B (en) Method, device and system for monitoring running of task threads in cluster
US9274847B2 (en) Resource management platform
CN112231108A (en) Task processing method and device, computer readable storage medium and server
CN109766248A (en) System failure signal acquiring method, device, server and readable storage medium storing program for executing
CN111767270A (en) Data migration method, device, server and storage medium
CN114389971B (en) Intelligent monitoring fine adjustment method, device, equipment and storage medium
US11797370B2 (en) Optimized diagnostics plan for an information handling system
CN117527721A (en) Content distribution network bandwidth control method, device, equipment and storage medium
CN111917573B (en) Monitoring method, monitoring system and computing equipment
CN109510730A (en) Distributed system and its monitoring method, device, electronic equipment and storage medium
CN111736975A (en) Request control method and device, computer equipment and computer readable storage medium
CN115801685A (en) Application service current limiting method, device, equipment and storage medium
CN115643163A (en) Fault equipment positioning method, device, equipment and storage medium
CN111723064A (en) Log collection method and device, server and storage medium
CN114218041A (en) Dynamic process monitoring method, device, equipment and storage medium
CN110401582B (en) Detection method and device for storage health distress of cloud computing system and storage medium
CN113656378A (en) Server management method, device and medium
CN112835906A (en) Block chain-based data management method, device, system, equipment and medium
CN114328083B (en) WDT monitoring method, device and medium
CN117033084B (en) Virtual machine backup method and device, electronic equipment and storage medium
CN112330453A (en) Intelligent contract calling method, device, equipment and storage medium based on block chain

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