CN114567507A - Current limiting method, system, device and storage medium - Google Patents

Current limiting method, system, device and storage medium Download PDF

Info

Publication number
CN114567507A
CN114567507A CN202210241287.1A CN202210241287A CN114567507A CN 114567507 A CN114567507 A CN 114567507A CN 202210241287 A CN202210241287 A CN 202210241287A CN 114567507 A CN114567507 A CN 114567507A
Authority
CN
China
Prior art keywords
current limiting
user request
current
user
limiting
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
CN202210241287.1A
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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210241287.1A priority Critical patent/CN114567507A/en
Publication of CN114567507A publication Critical patent/CN114567507A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/20Traffic policing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/29Flow control; Congestion control using a combination of thresholds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/02Network architectures or network communication protocols for network security for separating internal from external traffic, e.g. firewalls
    • H04L63/0227Filtering policies
    • H04L63/0236Filtering by address, protocol, port number or service, e.g. IP-address or URL
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]

Abstract

The invention provides a current limiting method, a system, equipment and a storage medium, wherein the method comprises the following steps: acquiring a user request; detecting whether the user request meets the current limiting condition or not according to the user request information and the current limiting configuration information; if so, searching a target current limiting method in various current limiting methods defined by the top interface according to the project attribute information; and utilizing the target current limiting method to limit the current of the user request. The invention judges whether the user request meets the current limiting condition according to the user request information contained in the user request, if so, the target current limiting method is searched according to the project attribute information carried in the user request, and different current limiting strategies of different development projects are integrated in the top layer interface in advance, so that the corresponding target current limiting method can be selected according to different development projects, the use of different developers can be met, the research and development process of the project is accelerated, and the research and development efficiency is improved.

Description

Current limiting method, system, device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a current limiting method, system, device, and storage medium.
Background
With the rapid development of internet technology, concurrent access with large flow rate has become a great challenge for internet applications, for example, in the scenes of commodity promotion, shopping promotion and the like, a large amount of concurrent access is often present.
Because the service processing capacity of the internet application is limited, when a large flow of concurrent applications are processed, the server may crash or crash due to an excessive load, so that the user request needs to be limited to avoid exceeding the load of the server. Currently existing current flow limiting servers are flow limiting based on flow limiting information in a configuration file.
Generally, different current limiting scenarios may require different current limiting modes, and each current limiting implementation mode depends on different bottom layers and components, and each current limiting implementation mode has advantages and disadvantages. Different scenes and different technical frameworks are adopted, and the realized current limiting effect is different. In the current limiting method in the prior art, one current limiting strategy is generally adopted fixedly, but the current limiting strategy cannot be adjusted dynamically according to different current limiting scenes, so that the applicability is not strong.
Disclosure of Invention
The invention provides a current limiting method, a system, equipment and a storage medium, and mainly aims to dynamically adjust a current limiting strategy according to different scenes and effectively improve the applicability of the current limiting method.
In a first aspect, an embodiment of the present invention provides a current limiting method, including:
acquiring a user request, wherein the user request comprises user request information and item attribute information;
detecting whether the user request meets the current limiting condition or not according to the user request information and the current limiting configuration information;
if yes, searching a target current limiting method in various current limiting methods defined by the top interface according to the project attribute information;
and limiting the current of the user request by using the target current limiting method.
Preferably, the finding a target current limiting method among various current limiting methods defined by a top-level interface according to the item attribute information further includes:
packaging a top interface into a parent class, and defining a current limiting interface and a method for realizing degradation configuration;
searching in a preset current limiting list according to each preset module in each preset project in all development projects to obtain a current limiting method corresponding to each preset module, wherein the current limiting method comprises a current limiting strategy and a current limiting version;
and packaging each current limiting method into a subclass inheriting the parent class, and realizing the current limiting interface.
Preferably, the detecting whether the user request meets the current limiting condition according to the user request information and the current limiting configuration information further includes:
pulling current-limiting configuration information corresponding to the current-limiting server from a preset interface of the configuration server;
and updating the locally stored current limiting configuration information according to the current limiting configuration information to acquire the current limiting configuration information.
Preferably, the pulling, from a preset interface of the slave configuration server, the current limiting configuration information corresponding to the current limiting server includes:
sending a configuration pulling request to a preset interface of a configuration server, so that the configuration server returns the changed current limiting configuration information when detecting the current limiting configuration change operation corresponding to the current limiting server based on the configuration pulling request;
and receiving current limiting configuration information returned by a preset interface of the configuration server.
Preferably, the user request information includes a user IP address and a traffic occupied by the user request in unit time, the current limiting configuration information includes a user IP address blacklist, a user IP address whitelist and a current limiting threshold, and the detecting whether the user request satisfies the current limiting condition according to the user request information and the current limiting configuration information includes:
detecting whether the user IP address is a blacklist IP address or not according to the user IP address and the user IP address blacklist;
if the user IP address is not a blacklist IP address, comparing the user request occupied flow in unit time with the current limiting threshold, if the user request occupied flow is smaller than the current limiting threshold, judging that the user request meets the current limiting condition, and if the user request occupied flow is not smaller than the current limiting threshold, judging that the user request does not meet the current limiting threshold;
and if the user IP address is a white list IP address, judging that the user request does not meet the current limiting condition.
Preferably, the method further comprises the following steps:
and if not, performing degradation configuration on the user request.
Preferably, the method further comprises the following steps:
the current limiting method is packaged as a package.
In a second aspect, an embodiment of the present invention provides a current limiting system, including:
the request module is used for acquiring a user request, wherein the user request comprises user request information and item attribute information;
the detection module is used for detecting whether the user request meets the current limiting condition or not according to the user request information and the current limiting configuration information;
the searching module is used for searching a target current limiting method in various current limiting methods defined by the top interface according to the item attribute information if the item attribute information is met;
and the current limiting module is used for limiting the current of the user request by using the target current limiting method.
In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the current limiting method when executing the computer program.
In a fourth aspect, an embodiment of the present invention provides a computer storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of the current limiting method.
According to the current limiting method, the current limiting system, the current limiting equipment and the storage medium, whether the user request meets the current limiting condition is judged according to the user request information contained in the user request, if yes, the user request needs to be limited, then the corresponding target current limiting method is found according to the project attribute information carried in the user request, and different current limiting strategies of different development projects are integrated in a top-layer interface in advance, so that the corresponding target current limiting method can be selected according to the different development projects, the use of different developers can be met, the research and development process of the projects is accelerated, the research and development efficiency is improved, and meanwhile, the applicability of the current limiting method is improved.
Drawings
Fig. 1 is an application scenario diagram of a current limiting method according to an embodiment of the present invention;
fig. 2 is a flowchart of a current limiting method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a system architecture in which a current limiting method is implemented according to an embodiment of the present invention;
FIG. 4 is a block diagram of a throttling strategy implementation provided in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a current limiting system according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer device provided in an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is an application scenario diagram of a current limiting method according to an embodiment of the present invention, as shown in fig. 1, a client sends a user request to a server, and after receiving the user request, the server executes the current limiting method to implement return visit to a user.
It should be noted that the server may be implemented by an independent server or a server cluster composed of a plurality of servers. The client may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like. The client and the server may be connected through bluetooth, USB (Universal Serial Bus), or other communication connection manners, which is not limited in this embodiment of the present invention.
Fig. 2 is a flowchart of a current limiting method according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
s210, acquiring a user request, wherein the user request comprises user request information and item attribute information;
the execution main body of the embodiment of the invention is a server side, and specifically, the client side can generate a corresponding user request based on the trigger operation and send the user request to the current limiting server, so that the current limiting server can receive the user request and detect whether to limit the current of the user request.
It should be noted that, in the embodiment of the present invention, the user request includes user request information and item attribute information, where the user request information is used to describe basic information of the current user request, such as information about a flow rate occupied by the user request, a user ID, a preset number of requests in a unit time, and the specific included parameters are determined according to an actual situation, and the embodiment of the present invention is not specifically limited herein; in addition, the user request further includes project attribute information, the current limiting method provided in the embodiment of the present invention is directed at an object that is a developer, the developer needs to use the current limiting method in a process of developing a project, current limiting scenarios faced in different project development processes are different, and current limiting strategies adopted in different current limiting scenarios are also likely to be different, so that the project attribute information includes information that can distinguish different projects, such as project names, project addresses, and the like, specific situations can be determined according to actual needs, and the embodiment of the present invention is not specifically limited herein.
S220, detecting whether the user request meets the current limiting condition or not according to the user request information and the current limiting configuration information;
the current limiting condition is determined according to current limiting configuration information in a configuration server, and the configuration server is additionally arranged and used for operation and maintenance personnel to dynamically configure equipment of the current limiting information. The configuration server can be composed of a visual unified configuration management platform, so that operation and maintenance personnel can more conveniently and rapidly carry out unified configuration on the current limiting information of each current limiting server, and centralized unified management is realized. The current limiting configuration information may be current limiting information obtained from a configuration server at the current time, and the current configuration information corresponds to parameters included in the user request information one to one.
For example, the user request information includes a user IP address and a user URL website, where the user URL website may be a network path for a user to access a background server through a browser, that is, a website to be accessed by the user; accordingly, the current limiting configuration information may include, but is not limited to, a black and white list of IP addresses and a URL limiting threshold and an IP limiting threshold corresponding to a preset URL limiting website. The current limiting conditions are: if the user IP address belongs to the IP address white list, subsequent current-limiting detection is not needed, and the service logic corresponding to the user request is directly processed; if the IP flow of the user is larger than the IP flow limiting threshold, processing the user request, and if the IP flow of the user is not larger than the IP flow limiting threshold, not processing the user request; if the URL flow of the user is larger than the URL flow limiting threshold value, the user request is processed, and if the URL flow of the user is larger than the URL flow limiting threshold value, the user request does not need to be processed.
For another example, the user request information may include, but is not limited to, information such as a traffic occupied by the user request in the user request, a user ID, and a preset number of requests per unit time, and accordingly, the current limiting configuration information includes a preset traffic threshold and a black-and-white list of the user ID, and the current limiting condition is:
the traffic occupied by the user request refers to the traffic occupied by a request once, the user ID is for special conditions, for example, leaders or experts can see whether the user request belongs to a white list or a black list by identifying the user ID when in use and comparing the user ID with a black and white list of the user ID, if the user ID is the white list, subsequent current limiting detection is not needed, the service logic corresponding to the user request is directly processed, and if the user ID is the black list, subsequent current limiting detection is not needed, the service logic corresponding to the user request is directly limited or is directly refused to be processed, and specific processing steps can be determined according to actual conditions. The preset request times in unit time and the flow occupied by the user request are combined, the flow occupied by the user request in unit time can be seen by comparing the flow occupied by all the requests in unit time with a preset flow threshold, so that whether the flow occupied by the user request meets the current flow limiting condition or not can be subsequently judged, and if the flow occupied by the user request meets the current flow limiting condition, the user request needs to be limited.
In the embodiment of the invention, the operation such as setting the black and white list can quickly respond to the user, thereby improving the user experience, reducing the system request pressure and improving the stability and reliability of the system.
S230, if yes, searching a target current limiting method in various current limiting methods defined by the top interface according to the project attribute information;
if the current limiting condition is met, it is indicated that the user request needs to be limited, and according to the item attribute information contained in the user request, the most appropriate target current limiting method is found out from various current limiting methods defined in the top interface.
In the prior art, a current limiting module is often fused in a service system, a service logic and a current limiting logic are crossed together, so that the invasion to the service system is too strong, great trouble is brought to later-stage code maintenance, and decoupling and expansion of the system are not facilitated.
In addition, whether the user request meets the current limiting condition is judged, and then a target current limiting method corresponding to the project attribute information is found in the top-layer interface according to the project attribute information contained in the user request.
And S240, utilizing the target current limiting method to limit the current of the user request.
And after the target current limiting method is found, limiting the current of the user request by using the target current limiting method, and refusing the access operation of the user request so as to avoid exceeding the load of the background server. Additionally, if it is detected that the user request does not satisfy the current limiting condition, it indicates that the normal access requested by the user may be allowed.
The embodiment of the invention provides a current limiting method, which comprises the steps of judging whether a user request meets the current limiting condition according to user request information contained in the user request, if so, indicating that the user request needs to be limited, searching a corresponding target current limiting method according to project attribute information carried in the user request, and integrating different current limiting strategies of different development projects into a top-layer interface in advance, so that the corresponding target current limiting method can be selected according to different development projects, the use of different developers can be met, the research and development process of the projects is accelerated, the research and development efficiency is improved, and meanwhile, the applicability of the current limiting method is also improved.
In addition, the current limiting module in the prior art is often fused in a service system, the service logic and the current limiting logic are crossed, the invasion to the service system is too strong, great trouble is brought to later code maintenance, and decoupling and expansion of the system are not facilitated.
And moreover, by judging whether the user request meets the current limiting condition or not and finding the target current limiting method corresponding to the project attribute information in the top-layer interface according to the project attribute information contained in the user request, when the developer needs to use the corresponding current limiting method, the developer can directly call the current limiting method, the developer can use the current limiting method conveniently, the research and development process of the project is accelerated, and the research and development efficiency is improved.
On the basis of the foregoing embodiment, preferably, the finding a target current limiting method among various current limiting methods defined by a top-level interface according to the item attribute information further includes:
packaging a top interface into a parent class, and defining a current limiting interface and a method for realizing degradation configuration;
searching in a preset current limiting list according to each preset module in each preset project in all development projects to obtain a current limiting method corresponding to each preset module, wherein the current limiting method comprises a current limiting strategy and a current limiting version;
and packaging each current limiting method into a subclass inheriting the parent class, and realizing the current limiting interface.
Fig. 4 is a flow limiting policy implementation framework diagram provided in the embodiment of the present invention, and as shown in fig. 4, in the embodiment of the present invention, a top-level interface is encapsulated into a parent Class, a ratelimit in fig. 4 is a Class corresponding to the top-level interface, only interfaces and flow limiting methods of this Class are defined in the top-level interface, but no specific flow limiting implementation method is given, that is, only a function corresponding to a flow limiting method is defined in the top-level interface, input parameters and output in the function are given, but no specific execution process is given, so that a method for specifically implementing flow limiting in a subsequent sub-Class is conveniently defined, a following Class represents a sub-Class that inherits the top-level interface, a specific flow limiting method for implementing the flow limiting method in the parent Class is defined in each sub-Class, and flow limiting methods implemented in different sub-classes are different, so as to address flow limiting schemes under different scenarios.
Specifically, the current limiting methods corresponding to each project are different, and all possible current limiting methods in the designed project need to be found out first, and the current limiting method is hung below the top-layer interface.
In the embodiment of the invention, all the projects in the development project are classified and disassembled to obtain each preset module, the preset modules are searched in the preset current limiting list, the current limiting strategy and the current limiting version which are most suitable for each preset module are listed in the preset current limiting list, each preset module represents different or same current limiting scenes, and the different current limiting scenes correspond to different current limiting strategies and current limiting versions.
In addition, if a new development project or a new current limiting method appears, the new current limiting method is directly designed to inherit the subclass of the top-level interface and is hung under the top-level interface.
On the basis of the foregoing embodiment, preferably, the detecting whether the user request meets the current limiting condition according to the user request information and the current limiting configuration information further includes:
pulling current-limiting configuration information corresponding to the current-limiting server from a preset interface of the configuration server;
and updating the locally stored current limiting configuration information according to the current limiting configuration information to acquire the current limiting configuration information.
The preset interface may be an interface preset by the configuration server and used for providing the current limiting configuration information specifically. Specifically, the current limiting server may pull the current limiting configuration information corresponding to the current limiting server from a preset interface of the configuration server at regular time or in real time, so as to actively obtain the current limiting configuration information. If the current limiting configuration information is pulled for the first time, the current limiting server can directly store the pulled current limiting configuration information into a local memory, so that the current limiting server can quickly obtain the current limiting configuration information. If the current limiting configuration information is not pulled for the first time, namely the current limiting configuration information is stored locally, the locally stored current limiting configuration information can be updated in real time based on the pulled current limiting configuration information, so that the current limiting server can quickly obtain the latest current limiting configuration information.
It should be noted that the current limiting server in this embodiment may be a server that performs function extension on an original Nginx server by using a Lua script. For example, the Lua script may be used to implement a pulling operation of the current limiting configuration information by the Nginx server and a control operation of current limiting based on the obtained current limiting configuration information, so that the function-extended Nginx server may perform the current limiting operation in the above steps, thereby reducing the development cost and improving the development efficiency.
On the basis of the foregoing embodiment, preferably, the pulling, from a preset interface of the configuration server, the current limiting configuration information corresponding to the current limiting server includes:
sending a configuration pulling request to a preset interface of a configuration server, so that the configuration server returns the changed current limiting configuration information when detecting the current limiting configuration change operation corresponding to the current limiting server based on the configuration pulling request;
and receiving current limiting configuration information returned by a preset interface of the configuration server.
Specifically, the current-limiting server may send the configuration pull request to a preset interface of the configuration server at regular time. After receiving the configuration pulling request, the configuration server detects whether current limiting configuration change operation corresponding to the current limiting server exists or not in real time, and returns the changed current limiting configuration information serving as response data to the current limiting server until the current limiting configuration change operation is detected, so that the current limiting configuration information can be returned when the current limiting configuration information is changed, the fact that the current limiting server pulls the changed current limiting configuration information is guaranteed, the problem of resource waste caused by pulling the same current limiting configuration information is solved, and system performance is improved.
On the basis of the foregoing embodiment, preferably, the user request information includes a user IP address and a flow occupied by the user request in unit time, the current flow limiting configuration information includes a user IP address blacklist, a user IP address whitelist and a flow limiting threshold, and the detecting whether the user request satisfies the current flow limiting condition according to the user request information and the current flow limiting configuration information includes:
detecting whether the user IP address is a blacklist IP address or not according to the user IP address and the user IP address blacklist;
if the user IP address is not a blacklist IP address, comparing the user request occupied flow in unit time with the current limiting threshold, if the user request occupied flow is smaller than the current limiting threshold, judging that the user request meets the current limiting condition, and if the user request occupied flow is not smaller than the current limiting threshold, judging that the user request does not meet the current limiting threshold;
and if the user IP address is a white list IP address, judging that the user request does not meet the current limiting condition.
The traffic occupied by the user request refers to the traffic occupied by all the users in unit time, the user ID is for special conditions, for example, leaders or experts can recognize the user ID when in use, and by comparing the user ID with a black and white list of the user ID, it can be seen whether the user request belongs to a white list or a black list, if the user request is the white list, subsequent current limiting detection is not needed, the service logic corresponding to the user request is directly processed, and if the user request is the black list, subsequent current limiting detection is also not needed, the service logic corresponding to the user request is directly limited or processing of the service logic corresponding to the user request is directly refused, and the specific processing steps can be determined according to actual conditions. The preset request times in unit time and the flow occupied by the user request are combined, the flow occupied by the user request in unit time can be seen by comparing the flow occupied by all the requests in unit time with a preset flow threshold, so that whether the flow occupied by the user request meets the current flow limiting condition or not can be subsequently judged, and if the flow occupied by the user request meets the current flow limiting condition, the user request needs to be limited.
In the embodiment of the invention, the operation such as setting the black and white list can quickly respond to the user, thereby improving the user experience, reducing the system request pressure and improving the stability and reliability of the system.
On the basis of the foregoing embodiment, preferably, if not, the user request is configured to be downgraded.
Specifically, in the embodiment of the present invention, a degradation configuration method is further defined and implemented in the top-level interface, and the degradation configuration method is used to perform degradation configuration on a user request that needs to be limited, and when the concurrency pressure of the server is relatively small, the user request can be degraded by using the degradation configuration method in the top-level interface.
In the implementation, the current limiting method and demotion are realized by annotation, the annotation is metadata which can be added into java source code, and methods, classes, parameters and packages can be decorated by the annotation. Annotations may be considered as a special type of tag that can be used on methods, classes, parameters, and packages, and that can be detected by a program for special processing when compiled or run.
Current limit annotation:
Figure BDA0003541988720000111
and (4) degraded annotation:
Figure BDA0003541988720000112
on the basis of the above embodiment, it is preferable to further include:
the current limiting method is packaged as a package.
Specifically, the current limiting method provided in the embodiment of the present invention is packaged as a plug-in, and when a developer uses a current limiting method service, only an actual module in the development project needs to be introduced to call a corresponding interface method. When the project is started, the Springboot automatically starts the corresponding current limiting service according to the class introduced in the project. From the introduction and the invocation, the research and development personnel can easily use the corresponding service without other operations.
Each current limiting strategy implements a corresponding current limiting scheme. And uniformly configuring the top-level interface configuration class into Spring beans. Uniformly putting an item root directory: resources- > META-INF- > spring.
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.paic.ratelimiter.config.RateLimiterAutoconfigratio
The configuration class is loaded by the SPI technology of spring and finally packaged into a jar package for introduction and use by research personnel.
The jar packages are classes written by others, the classes are packaged, the jar packages can be introduced into your project, and then the classes, the attributes and the methods in the jar packages can be directly used.
Fig. 5 is a schematic structural diagram of a current limiting system according to an embodiment of the present invention, and as shown in fig. 5, the current limiting system includes: a request module 510, a detection module 520, a lookup module 530, and a current limit module 540, wherein:
the request module 510 is configured to obtain a user request, where the user request includes user request information and item attribute information;
the detecting module 520 is configured to detect whether the user request meets the current limiting condition according to the user request information and the current limiting configuration information;
the searching module 530 is configured to search a target current limiting method among various current limiting methods defined by the top interface according to the item attribute information if the item attribute information is met;
the current limiting module 540 is configured to limit the current of the user request by using the target current limiting method.
The present embodiment is a system embodiment corresponding to the method, the specific implementation process of the system embodiment is the same as the method embodiment, please refer to the method embodiment for details, and the system embodiment is not described herein again.
On the basis of the above embodiment, it is preferable to further include:
the packaging module is used for packaging the top layer interface into a parent class, defining a current limiting interface and realizing a method for degrading configuration;
the system comprises a list module, a flow limiting module and a flow limiting module, wherein the list module is used for searching in a preset flow limiting list according to each preset module in each preset project in all development projects to obtain a flow limiting method corresponding to each preset module, and the flow limiting method comprises a flow limiting strategy and a flow limiting version;
and the inheritance module is used for packaging each current limiting method into a subclass inheriting the parent class and realizing the current limiting interface.
On the basis of the above embodiment, it is preferable to further include:
the configuration server is used for sending a configuration pull request to a preset interface of the configuration server so as to return the changed current limiting configuration information when detecting the current limiting configuration change operation corresponding to the current limiting server based on the configuration pull request;
and the receiving module is used for receiving the current limiting configuration information returned by the preset interface of the configuration server.
On the basis of the foregoing embodiment, preferably, the detection module includes a white list unit, a threshold unit, and a black list unit, wherein:
the white list unit is used for detecting whether the user IP address is a blacklist IP address or not according to the user IP address and the user IP address blacklist;
the threshold unit is used for comparing the user request occupied flow in unit time with the current limiting threshold if the user IP address is not a blacklist IP address, judging that the user request meets the current limiting condition if the user request occupied flow is smaller than the current limiting threshold, and judging that the user request does not meet the current limiting threshold if the user request occupied flow is not smaller than the current limiting threshold;
and the blacklist unit is used for judging that the user request does not meet the current limiting condition if the user IP address is a white list IP address.
On the basis of the foregoing embodiment, it is preferable that the system further includes a downgrade configuration module, where:
and the degradation configuration module is used for performing degradation configuration on the user request if the user request does not meet the requirement.
On the basis of the above embodiment, it is preferable to further include: the current limiting method is packaged as a package.
The various modules in the current limiting system described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Fig. 6 is a schematic structural diagram of a computer device provided in an embodiment of the present invention, where the computer device may be a server, and an internal structural diagram of the computer device may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a computer storage medium and an internal memory. The computer storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the running of computer programs in the computer storage media. The database of the computer device is used for storing data generated or acquired during execution of the current limiting method, such as user request information, project attribute information, and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method of limiting current.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the current limiting method in the above embodiments are implemented. Alternatively, the processor, when executing the computer program, implements the functions of the various modules/units in this embodiment of the current limiting system.
In an embodiment, a computer storage medium is provided, and a computer program is stored on the computer storage medium, and when being executed by a processor, the computer program implements the steps of the current limiting method in the above embodiments. Alternatively, the computer program realizes the functions of the modules/units in this embodiment of the current limiting system described above when executed by the processor.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It should be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is only used for illustration, and in practical applications, the above function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the apparatus may be divided into different functional units or modules to perform all or part of the above described functions.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A method of limiting current, comprising:
acquiring a user request, wherein the user request comprises user request information and item attribute information;
detecting whether the user request meets the current limiting condition or not according to the user request information and the current limiting configuration information;
if yes, searching a target current limiting method in various current limiting methods defined by the top interface according to the project attribute information;
and utilizing the target current limiting method to limit the current of the user request.
2. The method for limiting current according to claim 1, wherein the finding a target current limiting method among various current limiting methods defined by a top-level interface according to the item attribute information further comprises:
packaging a top interface into a parent class, and defining a current limiting interface and a method for realizing degradation configuration;
searching in a preset current limiting list according to each preset module in each preset project in all development projects to obtain a current limiting method corresponding to each preset module, wherein the current limiting method comprises a current limiting strategy and a current limiting version;
and packaging each current limiting method into a subclass inheriting the parent class, and realizing the current limiting interface.
3. The method of current limiting according to claim 1, wherein the detecting whether the user request satisfies the current limiting condition according to the user request information and current limiting configuration information further comprises:
pulling current-limiting configuration information corresponding to the current-limiting server from a preset interface of the configuration server;
and updating the locally stored current limiting configuration information according to the current limiting configuration information to acquire the current limiting configuration information.
4. The method according to claim 3, wherein the pulling the current limiting configuration information corresponding to the current limiting server from the preset interface of the configuration server includes:
sending a configuration pulling request to a preset interface of a configuration server, so that the configuration server returns the changed current limiting configuration information when detecting the current limiting configuration change operation corresponding to the current limiting server based on the configuration pulling request;
and receiving current limiting configuration information returned by a preset interface of the configuration server.
5. The method of claim 1, wherein the user request information includes a user IP address and a flow occupied by the user request per unit time, the current flow limiting configuration information includes a user IP address blacklist, a user IP address whitelist and a flow limiting threshold, and the detecting whether the user request satisfies the current flow limiting condition according to the user request information and the current flow limiting configuration information includes:
detecting whether the user IP address is a blacklist IP address or not according to the user IP address and the blacklist of the user IP address;
if the user IP address is not a blacklist IP address, comparing the user request occupied flow in unit time with the current limiting threshold, if the user request occupied flow is smaller than the current limiting threshold, judging that the user request meets the current limiting condition, and if the user request occupied flow is not smaller than the current limiting threshold, judging that the user request does not meet the current limiting threshold;
and if the user IP address is a white list IP address, judging that the user request does not meet the current limiting condition.
6. The method of limiting current according to any one of claims 1 to 5, further comprising:
and if not, performing degradation configuration on the user request.
7. The current limiting method according to any one of claims 1 to 5, further comprising:
the current limiting method is packaged as a package.
8. A current limiting system, comprising:
the request module is used for acquiring a user request, wherein the user request comprises user request information and item attribute information;
a detection module, configured to detect whether the user request satisfies the current limit condition according to the user request information and current limit configuration information;
the searching module is used for searching a target current limiting method in various current limiting methods defined by the top interface according to the item attribute information if the item attribute information is met;
and the current limiting module is used for limiting the current of the user request by using the target current limiting method.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the current limiting method according to any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the current limiting method according to any one of claims 1 to 7.
CN202210241287.1A 2022-03-11 2022-03-11 Current limiting method, system, device and storage medium Pending CN114567507A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210241287.1A CN114567507A (en) 2022-03-11 2022-03-11 Current limiting method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210241287.1A CN114567507A (en) 2022-03-11 2022-03-11 Current limiting method, system, device and storage medium

Publications (1)

Publication Number Publication Date
CN114567507A true CN114567507A (en) 2022-05-31

Family

ID=81717397

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210241287.1A Pending CN114567507A (en) 2022-03-11 2022-03-11 Current limiting method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN114567507A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8601000B1 (en) * 2011-06-27 2013-12-03 Amazon Technologies, Inc. System and method for conditionally updating an item with attribute granularity
CN109885399A (en) * 2019-01-17 2019-06-14 平安普惠企业管理有限公司 Data processing method, electronic device, computer equipment and storage medium
CN111163123A (en) * 2019-11-25 2020-05-15 北京同邦卓益科技有限公司 Service request processing method and device
CN113765980A (en) * 2020-11-20 2021-12-07 北京沃东天骏信息技术有限公司 Current limiting method, device, system, server and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8601000B1 (en) * 2011-06-27 2013-12-03 Amazon Technologies, Inc. System and method for conditionally updating an item with attribute granularity
CN109885399A (en) * 2019-01-17 2019-06-14 平安普惠企业管理有限公司 Data processing method, electronic device, computer equipment and storage medium
CN111163123A (en) * 2019-11-25 2020-05-15 北京同邦卓益科技有限公司 Service request processing method and device
CN113765980A (en) * 2020-11-20 2021-12-07 北京沃东天骏信息技术有限公司 Current limiting method, device, system, server and storage medium

Similar Documents

Publication Publication Date Title
US20190324772A1 (en) Method and device for processing smart contracts
CN109739573B (en) Processing method and device for realizing API (application program interface) call and system for realizing API
CN108959455B (en) Single-page Web application implementation method and device, computer equipment and storage medium
CN107562513B (en) Intelligent contract life cycle management method based on JAVA
CN110413288B (en) Application deployment method, device, server and storage medium
JP4841787B2 (en) Method, system, and storage medium for restricting access to program file in shared library file
CN109614167B (en) Method and system for managing plug-ins
CN110968331B (en) Method and device for running application program
US20210397457A1 (en) Isolating applications at the edge
CN111309303B (en) Code generation method and device, computer equipment and storage medium
CN110688174A (en) Container starting method, storage medium and electronic device
CN111399860B (en) Light application deployment method, light application deployment device, computer equipment and storage medium
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
CN114567507A (en) Current limiting method, system, device and storage medium
CN111090442A (en) Application updating method and device and storage medium
CN107783837B (en) Method and device for performing storage expansion and electronic equipment
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
CN106445595B (en) Method and device for constructing Application object of plug-in
CN109388459A (en) Picture loading method, device, computer equipment and storage medium
CN115237631A (en) Easily-extensible data sharing system and method based on data sharing plug-in
US11017032B1 (en) Document recovery utilizing serialized data
CN108008983B (en) Multi-interface data processing method based on single process
CN117032834B (en) Value stream plug-in operation method, device, equipment and storage medium
CN113722363B (en) Cache public assembly and implementation, installation and operation methods thereof
CN116069515A (en) Request processing method and device, electronic equipment and 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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20220531

WD01 Invention patent application deemed withdrawn after publication