CN110162344B - Isolation current limiting method and device, computer equipment and readable storage medium - Google Patents

Isolation current limiting method and device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN110162344B
CN110162344B CN201910301150.9A CN201910301150A CN110162344B CN 110162344 B CN110162344 B CN 110162344B CN 201910301150 A CN201910301150 A CN 201910301150A CN 110162344 B CN110162344 B CN 110162344B
Authority
CN
China
Prior art keywords
annotation
isolation
current limiting
configuration items
initial parameter
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.)
Active
Application number
CN201910301150.9A
Other languages
Chinese (zh)
Other versions
CN110162344A (en
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.)
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN201910301150.9A priority Critical patent/CN110162344B/en
Publication of CN110162344A publication Critical patent/CN110162344A/en
Application granted granted Critical
Publication of CN110162344B publication Critical patent/CN110162344B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Abstract

The invention discloses an isolation current-limiting method body, which comprises the following steps: searching a method body added with a preset isolation current limiting annotation in a business system framework; obtaining parameter values of key configuration items from the isolation current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group; according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, an @ HystrixCommand annotation of a Hystrix component is constructed; and carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation. The invention reduces the technical threshold of Hystrix, can modify the configured parameter value and improves the use experience.

Description

Isolation current limiting method and device, computer equipment and readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to an isolation current limiting method and device, computer equipment and a readable storage medium.
Background
In a distributed environment, a business system usually has many dependencies (for example, various third-party interface calls), and under high concurrent access, the dependencies may have many uncontrollable problems, for example: slow network connections, busy resources, temporary unavailability, etc.; when the congestion is relied on, the whole service system is greatly influenced; the Hystrix component is an open source library package related to delay and failure fault tolerance, and can provide functions of isolation, current limiting and fusing of dependence, so that certain protection is performed on services in a high concurrency environment, and the risk of dragging down a service system is reduced. However, when the Hystrix component is used, a developer needs to perform parameter setting of a series of configuration items, which requires the developer to have certain knowledge about the Hystrix component; in addition, when the parameter value setting of the configuration item is completed, the set parameter value cannot be modified, which has a certain limitation.
Disclosure of Invention
The invention aims to provide an isolation current limiting method, an isolation current limiting device, computer equipment and a readable storage medium, which reduce the technical threshold of Hystrix, modify configured parameter values and improve the use experience.
The invention solves the technical problems through the following technical scheme:
according to one aspect of the present invention, there is provided a method of isolating current limit, comprising the steps of:
searching a method body added with a preset isolation current-limiting annotation in a business system framework;
obtaining parameter values of key configuration items from the isolated current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group;
according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, an @ HystrixCommand annotation of a Hystrix component is constructed;
and carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
Further, the isolation current limiting annotation is an annotation added to a method body required to have an isolation current limiting function; the key configuration items are configuration items included in the isolated current limit annotation.
Further, the background management platform stores initial parameter sets respectively corresponding to the service system frameworks; each initial parameter group comprises initial parameter values of each configuration item required by the Hystrix component;
the searching for the initial parameter set corresponding to the service system framework from the preset background management platform specifically includes:
and searching an initial parameter value corresponding to the service system framework from the background management platform according to the configuration file of the service system framework.
Further, the constructing an @ Hystrix command annotation of the Hystrix component according to the parameter values of the key configuration items in the isolated current-limiting annotation and the initial parameter values of the other configuration items acquired from the background management platform specifically includes:
acquiring a preset @ HystrixCommand annotation template; wherein the annotation template only comprises various configuration items required by the Hystrix component;
correspondingly adding parameter values of key configuration items in the isolated current limiting annotation into the annotation template;
and correspondingly adding the initial parameter values of other configuration items acquired from the background management platform into the annotation template.
Further, the method for performing isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation specifically comprises the following steps:
determining an isolation current limiting mode corresponding to the isolation current limiting annotation according to the type of the configuration item in the isolation current limiting annotation; wherein, the isolation current limiting mode includes: a semaphore isolation mode, a thread pool isolation mode and a fusing mode;
and carrying out isolation current limiting treatment on the method body according to the determined isolation current limiting mode.
Further, the method further comprises:
and receiving an initial parameter modification instruction, and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
In order to achieve the above object, the present invention further provides an isolated current limiting device, which specifically includes:
the searching module is used for searching the method body added with the preset isolation current-limiting annotation in the service system framework;
an obtaining module, configured to obtain parameter values of a key configuration item from the isolated current-limiting annotation, search an initial parameter group corresponding to the service system framework from a preset background management platform, and obtain initial parameter values of other configuration items except the key configuration item from the searched initial parameter group;
the construction module is used for constructing the @ HystrixCommand annotation of the Hystrix component according to the parameter values of the key configuration items in the isolated current-limiting annotation and the initial parameter values of the other configuration items acquired from the background management platform;
and the processing module is used for carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
Further, the apparatus further comprises:
and the modification module is used for receiving an initial parameter modification instruction and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
In order to achieve the above object, the present invention further provides a computer device, which specifically includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the program.
In order to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above method.
According to the method, the device, the computer equipment and the readable storage medium for isolating and limiting the current, provided by the invention, as only parameter values of key configuration items need to be added in the self-defined isolating and limiting current annotation, the service can be conveniently and quickly accessed to the isolating and limiting function, and the technical threshold of using a Hystrix component is reduced; in the invention, complex configuration items in the original Hystrix component are packaged, the new isolated current-limiting annotation is customized, and only parameter values of key configuration items need to be set in the isolated current-limiting annotation, and parameter values of other configuration items do not need to be set, so that the workload of developers is reduced, and the Hystrix component is easy to use by the developers. In addition, in the prior art, the technical problem that the parameter values of the set configuration items cannot be modified exists, and in the invention, the parameter values of the configuration items can be modified in a targeted manner through a preset background management platform.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart illustrating an alternative method for isolating current limitation according to an embodiment;
FIG. 2 is a schematic diagram of an alternative program module of the isolated current limiting apparatus according to the second embodiment;
fig. 3 is a schematic diagram of an alternative hardware architecture of the computer device according to the third embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention. 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.
Example one
The method for isolating and limiting current provided by the invention is described below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of an alternative method for isolating current limitation according to the present invention, and as shown in fig. 1, the method may include the following steps:
step S101: and searching a method body added with a preset isolation current limit annotation in a business system framework.
The service system framework is a system framework capable of realizing services with a plurality of functions, the service system framework comprises method bodies corresponding to all the functions, and the corresponding functions can be realized by executing each method body; in this embodiment, a method body to which a preset isolated current limit annotation is added is searched in a business system framework including a plurality of method bodies.
The isolated current limit annotation is an annotation added to a method body required to have an isolated current limit function, and the isolated current limit annotation is encapsulation of the @ HystrixCommand annotation of the Hystrix component. Because there are multiple methods corresponding to each function in a service system framework, and when the service system is in high concurrency access, the problem that the methods cannot be executed easily occurs, which greatly affects the whole service system, the methods in the service system framework need to be isolated and limited in current, thereby protecting the service system in high concurrency environment to a certain extent and reducing the risk of the service system being dragged down. Therefore, when a developer constructs a business system framework, a preset isolation current-limiting annotation is introduced to each method body, so that the effect of isolating and limiting current of each method body is realized through the preset isolation current-limiting annotation.
The Hystrix component provides functions of fusing, isolating, current limiting and the like, and can ensure that a service system is still available when one or more method bodies simultaneously have problems; in the prior art, if a Hystrix component is to be used, an @ Hystrix command annotation needs to be added to a method body with an isolated current limiting function, however, in the @ Hystrix command annotation, a developer needs to perform parameter setting on all configuration items required by the Hystrix component in code, for example: timeout time, fusing threshold, maximum allowed thread count; therefore, developers are required to understand the meaning and use of each configuration item in the Hystrix component, and are required to spend a lot of time to understand the running mechanism of the Hystrix component and the scene to which the configuration item is applied; in the embodiment, the simplified isolated current limit annotation is used to replace the complex @ hystrix command annotation, in the isolated current limit annotation, the developer only needs to perform parameter setting on the configuration item of particular interest, and the parameter values of other configuration items use default values.
The annotation is an extended template of a method body, and the method body can realize corresponding functions according to rules in the annotation. In this embodiment, if a certain method body needs to use the Hystrix component, only developers need to call a self-defined isolation current-limiting annotation in the method body, and set parameter values of key configuration items in the isolation current-limiting annotation.
It should be further noted that, in the present embodiment, only customized isolated current limit annotations can be added to the method body of type public.
Step S102: and obtaining parameter values of key configuration items from the isolated current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group.
Wherein the key configuration item is a configuration item contained in the isolated current limit annotation;
the background management platform stores initial parameter sets corresponding to all the service system frames respectively;
each initial parameter set includes initial parameter values for various configuration items required by the Hystrix component.
In the embodiment, in the isolation current-limiting annotation, a developer only needs to set parameter values of key configuration items, and parameter values of other configuration items required by the Hystrix component are obtained from the background management platform; storing initial parameter sets of different types of service system frameworks in a background management platform, wherein each initial parameter set comprises initial parameter values of various configuration items required by a Hystrix component; because a certain difference exists between the service systems, the parameter values of the same configuration item of different service systems may have a difference, and therefore, a developer may set initial parameter values for each configuration item of each service system in the background management platform according to the service requirements and the historical experience values.
For example, if the annotation of the isolated current limit includes parameter values of maxRequest (maximum concurrency) and timeout (timeout), the initial parameter values of the other configuration items except maxRequest (maximum concurrency) and timeout (timeout) need to be obtained from the corresponding initial parameter set in the backend management platform.
Specifically, the searching for the initial parameter set corresponding to the service system framework from the preset background management platform specifically includes:
and searching an initial parameter value corresponding to the service system framework from the background management platform according to the configuration file of the service system framework.
Step S103: and constructing the @ HystrixCommand annotation of the Hystrix component according to the parameter values of the key configuration items in the isolated current-limiting annotation and the initial parameter values of other configuration items acquired from the background management platform.
Specifically, step S103 includes:
acquiring a preset @ HystrixCommand annotation template; wherein the annotation template only comprises various configuration items required by the Hystrix component;
correspondingly adding parameter values of key configuration items in the isolated current limiting annotation into the annotation template;
and correspondingly adding the initial parameter values of other configuration items acquired from the background management platform into the annotation template.
Since the code format of the @ Hystrix command annotation is fixed, and a developer is required to perform parameter setting on each configuration item during use, in this embodiment, the @ Hystrix command annotation can be automatically generated according to the code format of the @ Hystrix command annotation according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, so that the isolated current-limiting function of the Hystrix component is realized.
Step S104: and carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
Specifically, step S104 includes:
determining an isolation current limiting mode corresponding to the isolation current limiting annotation according to the type of the configuration item in the isolation current limiting annotation; wherein, the isolation current limiting mode includes: a semaphore isolation mode, a thread pool isolation mode and a fusing mode;
and carrying out isolation current limiting treatment on the method body according to the determined isolation current limiting mode.
Further, the determining, according to the type of the configuration item in the isolated current limit annotation, an isolated current limit manner corresponding to the isolated current limit annotation includes:
when the types of the key configuration items in the isolation current limit annotation are: when command name commandKey, group name commandGroup to which the command belongs and service degradation method fallback are used, the isolation current limiting mode corresponding to the isolation current limiting annotation is a semaphore isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when command name commandKey, command group name, service degradation method fallback and isolation strategy isolationStgy are used, the isolation current-limiting mode corresponding to the isolation current-limiting comment is a thread pool isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback, the request threshold requestThreshold and the failure threshold errorThreshold, the isolation current limiting mode corresponding to the isolation current limiting annotation is a fusing mode.
For example, when using the @ Phystrix note as the isolated current limit note; when the isolated current limiting mode corresponding to the @ Phystrix annotation is a semaphore isolated mode, examples of the @ Phystrix annotation are as follows:
@Phystrix(commandKey="getProfile",commandGroup="getProfile",fallBack="fail",maxRequest=50,timeout=2000)
publicProfileDOgetUserProfile(String userId){
//TODO
}
wherein, the value of commandKey is consistent with the body name of the method; the value of the commandGroup is consistent with the class name of the class to which the method body belongs; the value of the failback reflects the adopted service degradation mode, the parameter value is consistent with the original method body, configuration is usually needed, and the method body mainly comprises the contents of quick failure return or alarm and generally does not relate to business logic;
maxRequest is the maximum allowed concurrency, timeout is the timeout; in this example, maxRequest and timeout are key configuration items; the default value of maxRequest in the background management platform is 500, and the default value of timeout is 1000ms; but in this example, the developer sets the parameter value for maxRequest to 50 and the parameter value for timeout to 2000ms.
For another example, when the isolation and current limiting mode corresponding to the @ Phystrix annotation is the thread pool isolation mode, the @ Phystrix annotation is exemplified as follows:
Figure BDA0002028273340000091
when a thread pool isolation mode is adopted, a configuration item 'isolationStgy' needs to be added into the @ Phystrix annotation; if the configuration item "isolationStgy" is not present in the @ Phystrix annotation, then semaphore isolation is used.
timeout is timeout, and threadpool size is thread pool size; in this example, timeout and threadPoolSize are key configuration items.
In this embodiment, depending on hystrix-core, using spring AOP and using a self-defined isolated current-limiting annotation as a tangent point, in the method invocation process of adding the isolated current-limiting annotation, constructing an @ HystrixCommand object, and using parameter values of key configuration items in the isolated current-limiting annotation in the constructed @ HystrixCommand object, while using initial parameter values stored in a background management platform for parameter values of other configuration items. The scheme is that @ HystrixCommand annotation is constructed according to isolation current-limiting annotation; therefore, the Hystrix component can be called by adding the method body of the isolation current-limiting annotation, and the isolation current-limiting function is achieved.
Still further, the method further comprises:
and receiving an initial parameter modification instruction, and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
In the prior art, after the @ HystrixCommand annotation is constructed, the parameter value of the configuration item in the @ HystrixCommand annotation cannot be modified, and if the parameter value of the configuration item needs to be modified, the @ HystrixCommand annotation needs to be reconstructed; in this embodiment, the developer may modify the initial parameter value of the configuration item through the background management platform.
In this embodiment, a developer can execute processing logic corresponding to isolation current limiting only by adding a self-defined isolation current limiting annotation to a method body required to have an isolation current limiting function; when the isolated current-limiting annotation is quoted, if the developer does not set parameters for the key configuration items in the isolated current-limiting annotation, the initial parameter values of the configuration items in the background management platform are used; if the developer sets parameters for the key configuration items in the isolated current limit annotation, the parameter values in the isolated current limit annotation are used.
Example two
Based on the method for isolating and limiting current provided in the first embodiment, an apparatus for isolating and limiting current is provided in this embodiment, and in particular, fig. 2 illustrates an alternative block diagram of the apparatus for isolating and limiting current, where the apparatus for isolating and limiting current is divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors, so as to complete the present invention. The program module referred to in the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable for describing the execution process of the isolation current limiting device in the storage medium than the program itself.
As shown in fig. 2, the device for isolating and limiting current specifically includes the following components:
the searching module 201 is used for searching a method body added with a preset isolation current limiting annotation in a business system framework.
The isolated current limiting annotation is an annotation added to a method body required to have an isolated current limiting function, and the isolated current limiting annotation is encapsulation of an @ HystrixCommand annotation of a Hystrix component.
It should be further noted that, in the present embodiment, only customized isolated current limit annotations can be added to the method body of type public.
An obtaining module 202, configured to obtain parameter values of the key configuration items from the isolated current-limiting annotation, search an initial parameter group corresponding to the service system framework from a preset background management platform, and obtain initial parameter values of other configuration items except the key configuration items from the searched initial parameter group.
Wherein the key configuration item is a configuration item contained in the isolated current limit annotation;
the background management platform stores initial parameter sets respectively corresponding to the service system frameworks;
each initial parameter set includes initial parameter values for the various configuration items required by the Hystrix component.
Specifically, the obtaining module 202 is configured to:
and searching an initial parameter value corresponding to the service system framework from the background management platform according to the configuration file of the service system framework.
The constructing module 203 is configured to construct the @ Hystrix command annotation of the Hystrix component according to the parameter value of the key configuration item in the isolated current-limiting annotation and the initial parameter value of the other configuration item acquired from the background management platform.
Specifically, the building module 203 is configured to:
acquiring a preset @ HystrixCommand annotation template; wherein the annotation template only comprises various configuration items required by the Hystrix component; correspondingly adding parameter values of key configuration items in the isolated current limiting annotation into the annotation template; and correspondingly adding the initial parameter values of other configuration items acquired from the background management platform into the annotation template.
And the processing module 204 is used for performing isolation and current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
Specifically, the processing module 204 includes:
the determining unit is used for determining an isolation current limiting mode corresponding to the isolation current limiting annotation according to the type of the configuration item in the isolation current limiting annotation; wherein, keep apart the current-limiting mode and include: a semaphore isolation mode, a thread pool isolation mode and a fusing mode;
and the processing unit is used for carrying out isolation current limiting processing on the method body according to the determined isolation current limiting mode.
Further, the determining unit is specifically configured to:
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs and the service degradation method fallback are used, the isolation current limiting mode corresponding to the isolation current limiting annotation is a semaphore isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when command name commandKey, command group name, service degradation method fallback and isolation strategy isolationStgy are used, the isolation current-limiting mode corresponding to the isolation current-limiting comment is a thread pool isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback, the request threshold requestThreshold and the failure threshold errorThreshold, the isolation current limiting mode corresponding to the isolation current limiting annotation is a fusing mode.
Still further, the apparatus further comprises:
and the modification module is used for receiving an initial parameter modification instruction and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
In the prior art, after the @ HystrixCommand annotation is constructed, the parameter value of the configuration item in the @ HystrixCommand annotation cannot be modified, and if the parameter value of the configuration item needs to be modified, the @ HystrixCommand annotation needs to be reconstructed; in this embodiment, the developer may modify the initial parameter value of the configuration item through the background management platform.
EXAMPLE III
The embodiment also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a rack server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. As shown in fig. 3, the computer device 30 of the present embodiment includes at least but is not limited to: a memory 301, a processor 302 communicatively coupled to each other via a system bus. It is noted that fig. 3 only shows a computer device 30 with components 301-302, but it is to be understood that not all shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the memory 301 (i.e., the readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 301 may be an internal storage unit of the computer device 30, such as a hard disk or a memory of the computer device 30. In other embodiments, the memory 301 may also be an external storage device of the computer device 30, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 30. Of course, the memory 301 may also include both internal and external storage devices for the computer device 30. In this embodiment, the memory 301 is generally used to store an operating system installed in the computer device 30 and various application software, such as program codes of the device for isolating and limiting current according to the second embodiment. Further, the memory 301 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 302 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 302 generally serves to control the overall operation of the computer device 30.
Specifically, in this embodiment, the processor 302 is configured to execute a program of a method for isolating and limiting current stored in the processor 302, and when executed, the program of the method for isolating and limiting current implements the following steps:
searching a method body added with a preset isolation current-limiting annotation in a business system framework;
obtaining parameter values of key configuration items from the isolated current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group;
according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, an @ HystrixCommand annotation of a Hystrix component is constructed;
and carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
Example four
The present embodiments also provide a computer readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an App, etc., having stored thereon a computer program that when executed by a processor implements the method steps of:
searching a method body added with a preset isolation current limiting annotation in a business system framework;
obtaining parameter values of key configuration items from the isolated current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group;
according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, an @ HystrixCommand annotation of a Hystrix component is constructed;
and carrying out isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation.
The specific embodiment process of the above method steps can be referred to in the first embodiment, and the detailed description of this embodiment is not repeated here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one of 8230, and" comprising 8230does not exclude the presence of additional like elements in a process, method, article, or apparatus comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A method of isolating a current limit, the method comprising:
searching a method body added with a preset isolation current limiting annotation in a business system framework;
obtaining parameter values of key configuration items from the isolated current-limiting annotation, searching an initial parameter group corresponding to the service system framework from a preset background management platform, and obtaining initial parameter values of other configuration items except the key configuration items from the searched initial parameter group;
according to parameter values of key configuration items in the isolated current-limiting annotation and initial parameter values of other configuration items acquired from the background management platform, an @ HystrixCommand annotation of a Hystrix component is constructed;
according to the constructed @ HystrixCommand annotation, carrying out isolation and current limiting processing on the method body;
specifically, the method for performing isolated current limiting processing on the method body according to the constructed @ HystrixCommand annotation includes:
determining an isolation current limiting mode corresponding to the isolation current limiting annotation according to the type of the key configuration item in the isolation current limiting annotation; wherein, the isolation current limiting mode includes: a semaphore isolation mode, a thread pool isolation mode and a fusing mode;
according to the determined isolation current limiting mode, performing isolation current limiting processing on the method body;
when the type of the key configuration item in the isolation current limit annotation is: when the command name commandKey, the group name commandGroup to which the command belongs and the service degradation method fallback are used, the isolation current limiting mode corresponding to the isolation current limiting annotation is a semaphore isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback and the isolation strategy isolationStgy are used, the isolation and current limiting mode corresponding to the isolation and current limiting annotation is a thread pool isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback, the request threshold requestThreshold and the failure threshold errorThreshold, the isolation current limiting mode corresponding to the isolation current limiting annotation is a fusing mode.
2. The method of isolating current limit according to claim 1, wherein the isolated current limit annotation is an annotation added to a method body required to have an isolated current limit function; the key configuration item is a configuration item contained in the isolated current limit annotation.
3. The method for isolating and limiting current according to claim 2, wherein the background management platform stores initial parameter sets corresponding to the service system frameworks; each initial parameter group comprises initial parameter values of each configuration item required by the Hystrix component;
the searching for the initial parameter set corresponding to the service system framework from the preset background management platform specifically includes:
and searching an initial parameter value corresponding to the service system framework from the background management platform according to the configuration file of the service system framework.
4. The method for isolating and limiting current according to claim 3, wherein the constructing an @ HystrixCommand annotation of a Hystrix component according to the parameter values of the key configuration items in the isolated current limiting annotation and the initial parameter values of the other configuration items obtained from the background management platform specifically comprises:
acquiring a preset @ HystrixCommand annotation template; wherein the annotation template only comprises various configuration items required by the Hystrix component;
correspondingly adding parameter values of key configuration items in the isolated current limiting annotation into the annotation template;
and correspondingly adding the initial parameter values of other configuration items acquired from the background management platform into the annotation template.
5. The method of isolating current limit according to any one of claims 1 to 4, further comprising:
and receiving an initial parameter modification instruction, and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
6. An apparatus for isolating a current limit, the apparatus comprising:
the searching module is used for searching a method body added with a preset isolation current limiting annotation in a business system framework;
an obtaining module, configured to obtain parameter values of a key configuration item from the isolated current-limiting annotation, search an initial parameter group corresponding to the service system framework from a preset background management platform, and obtain initial parameter values of other configuration items except the key configuration item from the searched initial parameter group;
the construction module is used for constructing the @ HystrixCommand annotation of the Hystrix component according to the parameter values of the key configuration items in the isolated current-limiting annotation and the initial parameter values of other configuration items acquired from the background management platform;
the processing module is used for carrying out isolation current limiting processing on the method body according to the constructed @ HystrixCommand annotation;
specifically, the processing module includes:
the determining unit is used for determining an isolation current limiting mode corresponding to the isolation current limiting annotation according to the type of the key configuration item in the isolation current limiting annotation; wherein, the isolation current limiting mode includes: a semaphore isolation mode, a thread pool isolation mode and a fusing mode;
the processing unit is used for carrying out isolation current limiting processing on the method body according to the determined isolation current limiting mode;
further, the determining unit is specifically configured to:
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs and the service degradation method fallback are used, the isolation current limiting mode corresponding to the isolation current limiting annotation is a semaphore isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback and the isolation strategy isolationStgy are used, the isolation and current limiting mode corresponding to the isolation and current limiting annotation is a thread pool isolation mode;
when the types of the key configuration items in the isolation current limit annotation are: when the command name commandKey, the group name commandGroup to which the command belongs, the service degradation method fallback, the request threshold requestThreshold and the failure threshold errorThreshold, the isolation current limiting mode corresponding to the isolation current limiting annotation is a fusing mode.
7. The apparatus for isolating current limit according to claim 6, further comprising:
and the modification module is used for receiving an initial parameter modification instruction and modifying the initial parameter values of the corresponding configuration items in the corresponding service system framework in the background management platform according to the initial parameter modification instruction.
8. A computer device, the computer device comprising: memory, processor and computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 5 are implemented when the processor executes the program.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201910301150.9A 2019-04-15 2019-04-15 Isolation current limiting method and device, computer equipment and readable storage medium Active CN110162344B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910301150.9A CN110162344B (en) 2019-04-15 2019-04-15 Isolation current limiting method and device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910301150.9A CN110162344B (en) 2019-04-15 2019-04-15 Isolation current limiting method and device, computer equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110162344A CN110162344A (en) 2019-08-23
CN110162344B true CN110162344B (en) 2023-03-31

Family

ID=67639482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910301150.9A Active CN110162344B (en) 2019-04-15 2019-04-15 Isolation current limiting method and device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110162344B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727477B (en) * 2019-10-12 2023-03-24 未鲲(上海)科技服务有限公司 Component loading method and device, computer equipment and storage medium
CN111709050A (en) * 2020-05-21 2020-09-25 四川虹美智能科技有限公司 Method and device for initializing permission configuration parameters
CN113110887B (en) * 2021-03-31 2023-07-21 联想(北京)有限公司 Information processing method, device, electronic equipment and storage medium
CN114979137A (en) * 2022-04-28 2022-08-30 中国电力科学研究院有限公司 Method, system, equipment and medium for high-concurrency processing in power industry

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104951694A (en) * 2014-03-24 2015-09-30 华为技术有限公司 Isolation method and apparatus for management virtual machine
CN108009075A (en) * 2017-11-27 2018-05-08 南京联创信息科技有限公司 Dynamic fusing determination methods based on Hystrix frames
CN109587272A (en) * 2018-12-30 2019-04-05 深圳云天励飞技术有限公司 A kind of optimization method of micro services, device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301098B (en) * 2017-06-15 2020-09-08 搜易贷(北京)金融信息服务有限公司 Remote procedure calling device, method and system based on Thrift protocol
CN108446111A (en) * 2018-03-26 2018-08-24 国家电网公司客户服务中心 A kind of micro services construction method based on Spring cloud

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104951694A (en) * 2014-03-24 2015-09-30 华为技术有限公司 Isolation method and apparatus for management virtual machine
CN108009075A (en) * 2017-11-27 2018-05-08 南京联创信息科技有限公司 Dynamic fusing determination methods based on Hystrix frames
CN109587272A (en) * 2018-12-30 2019-04-05 深圳云天励飞技术有限公司 A kind of optimization method of micro services, device and electronic equipment

Also Published As

Publication number Publication date
CN110162344A (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN108958714B (en) Business component type development method and device, computer equipment and storage medium
CN107016480B (en) Task scheduling method, device and system
CN107341054B (en) Task execution method and device and computer readable storage medium
CN111414391A (en) Method and system for accessing multiple data sources
CN112463290A (en) Method, system, apparatus and storage medium for dynamically adjusting the number of computing containers
EP2839369B1 (en) Information processing device and method for protecting data in a call stack
CN110609755A (en) Message processing method, device, equipment and medium for cross-block chain node
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
CN110908644B (en) Configuration method and device of state node, computer equipment and storage medium
CN108614697B (en) Background Dex compiling control method and device
CN116450165A (en) Method, system, terminal and storage medium for quickly building environment and deploying program
CN111767126A (en) System and method for distributed batch processing
CN116302328A (en) Intelligent contract data processing method and system
CN112860412B (en) Service data processing method and device, electronic equipment and storage medium
CN111198689B (en) Code execution method, device and computer readable storage medium
CN110347471B (en) Hierarchical display component system, display component calling method and device
CN112130900B (en) User information management method, system, equipment and medium for BMC
CN110599112A (en) Method and device for developing and maintaining network page
CN114595047A (en) Batch task processing method and device
CN114327673A (en) Task starting method and device, electronic equipment and storage medium
CN113032118A (en) Asynchronous operation processing method for computer application program and corresponding system
US11017032B1 (en) Document recovery utilizing serialized data
CN111400058A (en) Method and device for calling message, computer equipment and storage medium
CN111459570B (en) PDF plug-in loading method, electronic equipment and computer storage medium

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
GR01 Patent grant
GR01 Patent grant