Access traffic limiting method and system, electronic equipment and storage medium

By dynamically obtaining user access requests in the interactive system and judging the fuse records in the preset database, degrading the fuse if the current limiting condition is met, solving the overload problem caused by abnormal access by the system and improving system stability and reliability.

CN120050237APending Publication Date: 2025-05-27GUANGZHOU FAISCO INFORMATON TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510015269.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

There is an abnormal access to the active interface in the interactive system, which leads to overload or abnormal system and has low stability.

Method used

An access current limiting method is proposed, which dynamically obtains user access requests and determines whether there is a corresponding fuse record in the preset database. If it does not exist, the fuse current limit judgment is made based on the user's access request. If the preset current limit condition is met, a fuse record is set in the preset database and downgrade the fuse.

Benefits of technology

Access circuit breaker is realized, which alleviates the problem of abnormal consumption and occupation of computer resources and improves system stability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050237A_ABST
    Figure CN120050237A_ABST
Patent Text Reader

Abstract

The invention discloses an access flow limiting method and system, electronic equipment and a storage medium. The method comprises the following steps: dynamically obtaining a user access request; when it is determined that the user access request is obtained, whether a corresponding fusing record exists in a preset database or not is judged through the user access request; wherein the fusing record is used for performing degradation fusing on the user access request; when it is determined that the fusing record does not exist in the preset database, performing fusing traffic limiting judgment according to the user access request to judge whether the user access request meets a preset traffic limiting condition or not; and when it is determined that the user access request meets a preset flow limiting condition, setting the corresponding fusing record in the preset database, and performing degradation fusing on the user access request. According to the embodiment of the invention, access fusing can be realized, the problem that computer resources are abnormally consumed and occupied is relieved, and the system stability and reliability are effectively improved. The method can be widely applied to the technical field of Internet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technologies, and in particular, to a method, a system, an electronic device, and a storage medium for access rate limiting. Background Art

[0002] In an interactive system, such as a Software as a Service (SaaS) system, each customer using the system has an account identifier (acount id, aid), and multiple different activities (activity identifier is game id) can be created under each account. Each participating player in an activity participates in the activity through a corresponding player identity identifier (such as openid). In the related art, there is a situation of abnormal access to the activity interface in the interactive system. For example, frequently accessing the activity interface under a certain account through a code script can easily cause the system to become overloaded or abnormal, and the system stability is relatively low.

[0003] In summary, the technical problems existing in the related art need to be improved. Summary of the Invention

[0004] The main purpose of the embodiments of this application is to propose a method, a system, an electronic device, and a storage medium for access rate limiting, which can achieve access fusing, alleviate the problem of abnormal consumption and occupation of computer resources, and effectively improve the system stability and reliability.

[0005] To achieve the above object, on the one hand, an embodiment of this application proposes an access rate limiting method, and the method includes the following steps:

[0006] Dynamically obtain a user access request;

[0007] When it is determined that the user access request is obtained, determine whether there is a corresponding fusing record in a preset database through the user access request; wherein, the fusing record is used to perform downgrade fusing on the user access request;

[0008] When it is determined that there is no such fusing record in the preset database, perform fusing rate limiting judgment according to the user access request to determine whether the user access request meets a preset rate limiting condition;

[0009] When it is determined that the user access request meets the preset rate limiting condition, set the corresponding fusing record in the preset database, and perform downgrade fusing on the user access request.

[0010] In some embodiments, after performing the step of when it is determined that the user access request is obtained, determine whether there is a corresponding fusing record in a preset database through the user access request, the method further includes:

[0011] When it is determined that the fusing record exists in the preset database, the user access request is degraded and fused.

[0012] In some embodiments, the fusing and rate limiting judgment is performed according to the user access request to determine whether the user access request meets the preset rate limiting condition, including:

[0013] The fusing and rate limiting judgment is performed on the user access request through a preset judgment node to determine whether the user access request triggers fusing; wherein, the preset judgment node includes a plurality of chained judgment nodes;

[0014] When it is determined that the judgment results of a plurality of the chained judgment nodes are all not triggering fusing, it is determined that the user access request does not meet the preset rate limiting condition, or when it is determined that the judgment result of any one of the chained judgment nodes is triggering fusing, it is determined that the user access request meets the preset rate limiting condition.

[0015] In some embodiments, the fusing and rate limiting judgment is performed on the user access request through a preset judgment node to determine whether the user access request triggers fusing, including:

[0016] When it is determined that the first main switch of the first flow control judgment node is turned on, it is judged whether to execute the first flow control judgment node on the target account;

[0017] When it is determined to execute the first flow control judgment node on the target account, it is judged whether the preset request object meets the first rate limiting threshold condition according to the fusing and rate limiting parameters in the preset configuration file; wherein, the preset request object includes the request Internet protocol address corresponding to the user access request and the participating user identity identifier, and the fusing and rate limiting parameters include the queries per second rate;

[0018] When it is determined that the preset request object meets the first rate limiting threshold condition, it is determined that the preset request object triggers the rate limiting and fusing of the first flow control judgment node, or when it is determined that the preset request object does not meet the first rate limiting threshold condition, it is determined that the preset request object does not trigger the rate limiting and fusing of the first flow control judgment node.

[0019] In some embodiments, the fusing and rate limiting judgment is performed on the user access request through a preset judgment node to determine whether the user access request triggers fusing, further including:

[0020] When it is determined that the second main switch of the second flow control judgment node is turned on under the target uniform resource identifier, it is judged whether there is a configuration for the target uniform resource identifier in the preset configuration file;

[0021] When it is determined that there is a configuration for the target uniform resource identifier in the preset configuration file, determine whether the account flow control switch corresponding to the target account is turned on;

[0022] When it is determined that the account flow control switch is turned on, determine whether the preset request object meets the second current limiting threshold condition according to the fuse current limiting parameter;

[0023] When it is determined that the preset request object meets the second current limiting threshold condition, determine that the preset request object triggers the current limiting fuse of the second flow control judgment node, or when it is determined that the preset request object does not meet the second current limiting threshold condition, determine that the preset request object does not trigger the current limiting fuse of the second flow control judgment node.

[0024] In some embodiments, setting the corresponding fuse record in the preset database and performing downgrade fuse on the user access request includes:

[0025] Generate the fuse record in the form of key-value pairs and store it in the Redis database; wherein, the survival time of the fuse record corresponds to the fuse time;

[0026] Perform downgrade fuse on the user access request and return a fuse prompt message.

[0027] In some embodiments, before performing the step of when it is determined that the first flow control judgment node is executed on the target account, and determining whether the preset request object meets the first current limiting threshold condition according to the fuse current limiting parameter in the preset configuration file, the method further includes:

[0028] Configure the preset configuration file; wherein, the preset configuration file includes token bucket parameters, fuse time, flow control switch parameters, and query rate threshold parameters;

[0029] Hot update the preset configuration file to the preset web cluster.

[0030] To achieve the above object, another aspect of the embodiments of the present application proposes an access current limiting system, the system includes:

[0031] A first module, configured to dynamically obtain a user access request;

[0032] A second module, configured to, when it is determined that the user access request is obtained, determine whether there is a corresponding fuse record in the preset database through the user access request; wherein, the fuse record is used to perform downgrade fuse on the user access request;

[0033] A third module, configured to perform fuse current limiting judgment according to the user access request when it is determined that the fuse record does not exist in the preset database, so as to determine whether the user access request meets the preset current limiting condition;

[0034] A fourth module, configured to set the corresponding fuse record in the preset database and perform downgrade fusing on the user access request when it is determined that the user access request meets the preset current limiting condition.

[0035] To achieve the above object, another aspect of the embodiments of the present application provides an electronic device, where the electronic device includes:

[0036] At least one processor;

[0037] At least one memory, configured to store at least one program;

[0038] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

[0039] To achieve the above object, another aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above method is implemented.

[0040] The embodiments of the present application at least include the following beneficial effects: The present application provides an access current limiting method, system, electronic device and storage medium. This solution dynamically obtains user access requests. When it is determined that a user access request is obtained, it is judged whether there is a corresponding fuse record in the preset database through the user access request. Among them, in the embodiments of the present invention, a fuse record is set in the preset database to perform fuse downgrading on the corresponding user access request. Correspondingly, when it is determined that there is no corresponding fuse record in the preset database, in the embodiments of the present invention, fuse current limiting judgment is performed according to the user access request to determine whether the user access request meets the preset current limiting condition. Then, when it is determined that the user access request meets the preset current limiting condition, in the embodiments of the present invention, a corresponding fuse record is set in the preset database and the user access request is subjected to downgrade fusing, thereby realizing access fusing and alleviating the problem that computer resources are abnormally consumed and occupied. It is easy to understand that in the embodiments of the present invention, it is determined whether to perform fuse downgrading on the obtained user access request by judging whether there is a corresponding fuse record in the preset database. When it is determined that there is no fuse record in the preset database, it is judged whether the user access request meets the preset current limiting condition, so as to perform downgrade fusing when the user access request meets the preset current limiting condition, thereby realizing access fusing and alleviating the problem that computer resources are abnormally consumed and occupied, and effectively improving the stability and reliability of the system. Description of the Drawings

[0041] Figure 1 It is a schematic diagram of the steps of the access rate limiting method provided by an embodiment of the present invention;

[0042] Figure 2 It is a schematic diagram of the overall process of the access rate limiting method provided by an embodiment of the present invention;

[0043] Figure 3 It is a schematic diagram of the overall process of fuse rate limiting judgment provided by an embodiment of the present invention;

[0044] Figure 4 It is a schematic diagram of the process of judgment by the first flow control judgment node provided by an embodiment of the present invention;

[0045] Figure 5 It is a schematic diagram of the process of judgment by the second flow control judgment node provided by an embodiment of the present invention;

[0046] Figure 6 It is a schematic diagram of the structure of the access rate limiting system provided by an embodiment of the present invention;

[0047] Figure 7 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0048] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application detailed in the appended claims.

[0049] It can be understood that the terms "first", "second", etc. used in the present application may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if", "when" as used herein may be interpreted as "when...", "while...", or "in response to determining".

[0050] As used in this application, terms such as "at least one", "a plurality of", "each", "any one", etc. "At least one" includes one, two or more; "a plurality of" includes two or more; "each" refers to each of the corresponding plurality; and "any one" refers to any one of the plurality.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0052] Before elaborating on the embodiments of this application in detail, some nouns and terms involved in the embodiments of this application are first explained, and the nouns and terms involved in the embodiments of this application are applicable to the following explanations.

[0053] Software as a Service (SaaS) system: A software delivery model based on cloud computing that provides software as a service over the Internet for users to use, eliminating the need for users to install software on local computers or servers.

[0054] In an interactive system, such as a Software as a Service (SaaS) system, each customer has an account identifier (acount id, aid), and multiple different activities (activity identifier: game id) can be created under each account. Each player participating in an activity uses a corresponding player identity identifier (such as openid) to participate in the activity. In the related art, there are cases of abnormal access to activity interfaces in the interactive system. For example, frequently accessing the activity interface under a certain account through a code script can easily cause the system to become overloaded or abnormal, resulting in low system stability.

[0055] In view of this, embodiments of this application provide a method, system, electronic device, and storage medium for access rate limiting. This solution dynamically obtains user access requests. When it is determined that a user access request is obtained, it is determined whether there is a corresponding fuse record in a preset database based on the user access request. Among them, in the embodiments of the present invention, a fuse record is set in the preset database to perform fuse degradation on the corresponding user access request. Correspondingly, when it is determined that there is no corresponding fuse record in the preset database, the embodiments of the present invention perform fuse rate limiting judgment based on the user access request to determine whether the user access request meets the preset rate limiting conditions. Then, when it is determined that the user access request meets the preset rate limiting conditions, the embodiments of the present invention set a corresponding fuse record in the preset database and perform degraded fusing on the user access request, thereby achieving access fusing, alleviating the problem of abnormal consumption and occupation of computer resources, and effectively improving system stability and reliability.

[0056] The access rate limiting method provided by the embodiments of the present application relates to the field of Internet technologies. The access rate limiting method provided by the embodiments of the present application can be applied to a terminal, a server, or software running on a terminal or a server. In some embodiments, the terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, etc., but is not limited thereto; the server side may be configured as an independent physical server, or may be configured as a server cluster or a distributed system composed of multiple physical servers, or may be configured as a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server may also be a node server in a blockchain network; the software may be an application implementing the access rate limiting method, etc., but is not limited to the above forms.

[0057] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet-type devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0058] It should be noted that in each specific embodiment of the present application, when it comes to performing relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiments of the present application need to obtain the user's sensitive personal information, the user's separate permission or separate consent will be obtained through methods such as pop-up windows or redirecting to a confirmation page. After clearly obtaining the user's separate permission or separate consent, the necessary user-related data for the normal operation of the embodiments of the present application will be obtained.

[0059] Figure 1 is an optional flowchart of the access rate limiting method provided by the embodiments of the present application. Figure 1The method in may include but is not limited to steps S110 to S140.

[0060] Step S110: Dynamically obtain a user access request.

[0061] Step S120: When it is determined that a user access request is obtained, determine whether there is a corresponding fusing record in a preset database through the user access request. Among them, the fusing record is used to perform degradation fusing on the user access request.

[0062] Step S130: When it is determined that there is no fusing record in the preset database, perform fusing and flow limiting judgment according to the user access request to determine whether the user access request meets the preset flow limiting conditions.

[0063] Step S140: When it is determined that the user access request meets the preset flow limiting conditions, set a corresponding fusing record in the preset database and perform degradation fusing on the user access request.

[0064] During the operation of this specific embodiment, the embodiment of the present invention first dynamically obtains a user access request to determine whether there is a fuse record in the preset database based on the obtained user access request. Specifically, in the embodiment of the present invention, the user access request refers to a network service request initiated by a target object, such as a request to access an activity under a certain account. Correspondingly, in the embodiment of the present invention, the fuse record is stored in the preset database and records the fuse information of the corresponding user access request, such as the corresponding participating user information, fuse duration, historical fuse data, etc. Among them, the embodiment of the present invention determines whether to reduce the fuse for the user access request by judging whether there is a fuse record in the preset database. Then, when it is determined that there is no fuse record in the preset database, the embodiment of the present invention makes a fuse current-limiting judgment according to the user access request to determine whether the user access request meets the preset current-limiting condition. Furthermore, when it is determined that the user access request meets the preset current-limiting condition, a corresponding fuse record is set in the preset database, and the user access request is fuse degraded. Specifically, in the embodiment of the present invention, the preset current-limiting condition refers to the condition for triggering fuse current-limiting, such as the number of times the user access request is initiated within a preset duration, the initiation frequency of the user access request, whether the participating user or the requested Internet protocol address corresponding to the user access request is on the current-limiting list, etc. Correspondingly, when it is determined that the user access request meets the preset current-limiting condition, that is, the current user access request is an abnormal access. At this time, the embodiment of the present invention generates a fuse record corresponding to the user access request in the preset database to directly perform degraded fusing when the user access request is received later. At the same time, after setting the fuse record in the preset database, the embodiment of the present invention also performs degraded fusing processing on the currently received user access request to limit the access request, so as to alleviate the problem that the access request is executed to the corresponding business logic, resulting in abnormal consumption of backend computer resources, and effectively improves the stability and reliability of the system.

[0065] Exemplarily, as Figure 2 shown, in the embodiment of the present invention, each customer using an interactive system has an account identifier (acount id, aid), and multiple different activities (activity identifier is gameid) can be created under each account. Each participating player of each activity participates in the activity through a corresponding player identity identifier (such as openid). Among them, since the call volume of the current-limiting statistical interface for openid is relatively large, the embodiment of the present invention uses the token / funnel algorithm here, which is more excellent than the sliding window algorithm in terms of time and space complexity. Correspondingly, when the player identity identifier (such as openid) reaches the trigger current-limiting bottleneck, that is, meets the preset current-limiting condition, the embodiment of the present invention sets a fuse record in the preset database and performs a degraded return, thereby alleviating the problem of computer resource consumption caused by abnormal access and improving the stability and reliability of the system.

[0066] In some embodiments of the present invention, after determining that the user access request is obtained and judging whether there is a corresponding fuse record in the preset database through the user access request, the access rate limiting method provided by the embodiments of the present invention further includes but is not limited to the following steps:

[0067] When it is determined that there is a fuse record in the preset database, the user access request is degraded and fused.

[0068] In this specific embodiment, when it is determined that there is a fuse record in the preset database, the present invention example degrades and fuses the user access request. Specifically, the embodiments of the present invention determine whether the participating user or request IP corresponding to the received user access request is in the fuse degradation period through the fuse record. For example, when the user access request meets the preset rate limiting condition, a corresponding fuse record is set in the preset database to perform fuse degradation on the user access request within a preset time period, that is, within the preset time period (fuse degradation period), when the user access request is received again, the embodiments of the present invention directly perform degradation and fusing on it, thereby restricting the access requests of the participating user or request IP corresponding to the user access request to the corresponding service or activity, improving the efficiency of access fusing, and further alleviating the problem of abnormal consumption of computer resources.

[0069] In some embodiments of the present invention, fuse rate limiting judgment is performed according to the user access request to judge whether the user access request meets the preset rate limiting condition, including but not limited to the following steps:

[0070] The fuse rate limiting judgment is performed on the user access request through a preset judgment node to judge whether the user access request triggers fusing. Among them, the preset judgment node includes a plurality of chained judgment nodes.

[0071] When it is determined that the judgment results of all the chained judgment nodes are not triggering fusing, it is determined that the user access request does not meet the preset rate limiting condition, or when it is determined that the judgment result of any one of the chained judgment nodes is triggering fusing, it is determined that the user access request meets the preset rate limiting condition.

[0072] In this specific embodiment, the embodiment of the present invention first performs fuse current limiting judgment on the user access request through a preset judgment node to determine whether the user access request triggers a fuse. Specifically, the preset judgment node in the embodiment of the present invention refers to a flow control judgment node, including a plurality of chained judgment nodes. Among them, these plurality of chained judgment nodes in the embodiment of the present invention respectively perform fuse current limiting analysis and judgment on the user access request from different dimensions. For example, flow control of the request IP and openid under the aid-game activity dimension, or flow control of the request IP and openid under the aid / aid-game dimension for a specified uniform resource identifier (URI). Correspondingly, the embodiment of the present invention sequentially performs fuse current limiting judgment on the user access request from different dimensions through different chained judgment nodes to determine whether the user access request triggers a fuse. Then, when it is determined that the judgment results of all the chained judgment nodes are not triggering a fuse, the embodiment of the present invention determines that the user access request does not meet the preset current limiting condition. Or, when it is determined that the judgment result of any one of the chained judgment nodes is triggering a fuse, the embodiment of the present invention determines that the user access request meets the preset current limiting condition. Specifically, as Figure 3 shown, after entering the fuse current limiting judgment, the embodiment of the present invention enters the fuse current limiting chained judgment logic. For example, the embodiment of the present invention sequentially performs fuse current limiting judgment on the user access request through the first judgment node and the second judgment node. When it is determined that a fuse is triggered, the embodiment of the present invention degrades the corresponding user access request and returns a specific prompt. On the contrary, when it is determined that a fuse is not triggered, it is judged whether the current judgment node is the last node. For example, when the first judgment node is currently executed and it is determined that a fuse is not triggered, the embodiment of the present invention obtains the next node, that is, the second judgment node, and executes the second judgment node to perform fuse current limiting judgment to determine whether the user access request triggers a fuse in this dimension. When all the judgment nodes pass, that is, the judgment results are all not triggering a fuse, the user access request is normally executed. And when a certain judgment node triggers a fuse, it is directly degraded and the fuse current limiting judgment process is exited.

[0073] In some embodiments of the present invention, performing fuse current limiting judgment on the user access request through a preset judgment node to determine whether the user access request triggers a fuse includes, but is not limited to, the following steps:

[0074] When it is determined that the first main switch of the first flow control judgment node is turned on, determine whether to execute the first flow control judgment node on the target account.

[0075] When it is determined to execute the first flow control judgment node for the target account, it is judged whether the preset request object meets the first flow limiting threshold condition according to the fuse flow limiting parameters in the preset configuration file. Among them, the preset request object includes the request Internet protocol address corresponding to the user access request and the participating user identity identifier, and the fuse flow limiting parameters include the queries per second rate.

[0076] When it is determined that the preset request object meets the first flow limiting threshold condition, it is determined that the preset request object triggers the flow limiting fuse of the first flow control judgment node, or when it is determined that the preset request object does not meet the first flow limiting threshold condition, it is determined that the preset request object does not trigger the flow limiting fuse of the first flow control judgment node.

[0077] In this specific embodiment, the preset judgment node includes the first flow control judgment node. Among them, the first flow control judgment node in the embodiment of the present invention refers to the flow control of the request Internet protocol address (ip) and the participating user identity identifier (such as openid) in the aid-game activity dimension. Correspondingly, when executing the first flow control judgment node, the embodiment of the present invention first judges whether the first main switch of the first flow control judgment node is in the on state. Specifically, the preset judgment node in the embodiment of the present invention includes several chained judgment nodes. Therefore, the embodiment of the present invention flexibly adjusts the fuse flow limiting analysis dimension of the user access request by the switch states of the main switches in each chained judgment node. Correspondingly, when it is determined that the first main switch of the first flow control judgment node is on, the embodiment of the present invention judges whether to execute the first flow control judgment node for the target account. Specifically, the target account in the embodiment of the present invention refers to the account of the service or activity initiator, such as the account id (aid). For example, refer to Figure 4, after entering the first flow control judgment node, the embodiment of the present invention first determines whether the main switch of the flow control, that is, the first main switch, is turned on. When it is determined that the first main switch is turned on, the embodiment of the present invention determines whether the switch (isCloseFuse4Aid) for the specific account Aid is to be turned off, wherein the switch is used to set the flow control rule to be turned off for the corresponding Aid. Further, when it is determined that the first flow control judgment node is executed on the target account, the embodiment of the present invention determines whether the preset request object meets the first flow limiting threshold condition according to the fuse limiting parameters in the preset configuration file. Specifically, the preset request object in the embodiment of the present invention includes the request Internet Protocol address (IP) corresponding to the user access request and the participating user identity. Among them, the participating user identity refers to the user identity that initiates the user access request, and the request Internet Protocol address (IP) refers to the Internet Protocol address information carried when the user access request is initiated. Correspondingly, the fuse limiting parameters in the embodiment of the present invention include the query rate per second, that is, the number of requests processed by the system per second. The embodiment of the present invention determines whether the number of requests initiated per second by the corresponding request Internet Protocol address (IP) or the participating user identity reaches the corresponding query rate threshold. For example, when the number of requests initiated per second by a certain user identity (such as 50QPS) is greater than the preset query rate threshold (such as 40QPS), it is determined that the preset request object meets the first current limiting threshold condition. Further, when it is determined that the preset request object meets the first current limiting threshold condition, it is determined that the preset request object triggers the current limiting fuse of the first flow control judgment node. Then, the embodiment of the present invention sets the fuse record in the preset database (such as Redis database) according to the fuse time set in the configuration file, and downgrades and returns the fuse prompt. Conversely, when it is determined that the preset request object does not meet the first current limiting threshold condition, the embodiment of the present invention determines that the preset request object does not trigger the current limiting fuse of the first flow control judgment node. At this time, the embodiment of the present invention ends the flow control judgment of the first flow control judgment node, and enters the next flow control judgment node until the last flow control judgment node is executed.

[0078] Exemplarily, in some embodiments of the present invention, the configuration content of the configuration file corresponding to the first flow control judgment node is as shown in the following code:

[0079]

[0080] In some embodiments of the present invention, a circuit breaker and current limiting judgment is performed on a user access request by a preset judgment node to determine whether the user access request triggers a circuit breaker, which also includes but is not limited to the following steps:

[0081] When it is determined that the second main switch of the second flow control determination node under the target uniform resource identifier is turned on, it is determined whether there is a configuration for the target uniform resource identifier in the preset configuration file.

[0082] When it is determined that there is a configuration for the target uniform resource identifier in the preset configuration file, it is judged whether the account flow control switch corresponding to the target account is turned on.

[0083] When it is determined that the account flow control switch is turned on, it is judged whether the preset request object meets the first current limiting threshold condition according to the fuse current limiting parameters.

[0084] When it is determined that the preset request object meets the first current limiting threshold condition, it is determined that the preset request object triggers the current limiting and fusing of the second flow control judgment node; or when it is determined that the preset request object does not meet the first current limiting threshold condition, it is determined that the preset request object does not trigger the current limiting and fusing of the second flow control judgment node.

[0085] In this specific embodiment, the preset judgment node further includes a second flow control judgment node. Among them, the second flow control judgment node in the embodiment of the present invention refers to the request Internet protocol address (ip) and the participating user identity identifier, such as openid, under the specified target uniform resource identifier (URI) in the aid / aid-game dimension. Specifically, as Figure 5 shown, when executing the second flow control judgment node, the embodiment of the present invention first judges whether the switch (the second main switch) of the second flow control judgment node is turned on under the corresponding uniform resource identifier (URI), that is, the target uniform resource identifier. Among them, the second main switch is used to judge whether to execute the second flow control judgment node. Correspondingly, when it is determined that the second main switch of the second flow control judgment node under the target uniform identifier is turned on, the embodiment of the present invention further judges whether there is a configuration for the target uniform resource identifier in the preset configuration file, that is, whether there is a flow control configuration for the target uniform identifier. Correspondingly, the embodiment of the present invention determines whether to perform fuse current limiting on the specified uniform resource identifier (that is, the target uniform identifier) by judging whether there is a configuration for the target uniform resource identifier in the preset configuration file.

[0086] Further, when it is determined that there is a configuration for the target uniform resource configuration identifier in the preset configuration file, the embodiment of the present invention judges whether the account flow control switch corresponding to the target account is turned on. Among them, the account flow control switch in the embodiment of the present invention refers to the switch for executing the second flow control judgment node for the specified account, that is, the flow control rule is determined to be enabled for which aids through the account flow control switch. For example, as Figure 5As shown, in the embodiment of the present invention, it is first determined whether to enable it for a specific account aid (isOpenFuse4Aid). Then, when it is determined that the account flow control switch is enabled, the embodiment of the present invention determines whether the preset request object meets the second current limiting threshold condition according to the fuse current limiting parameter. Among them, the fuse current limiting parameter in the embodiment of the present invention is preset in a preset configuration file and includes the queries per second rate. Correspondingly, when it is determined that the preset request object meets the second current limiting threshold condition, it is determined that the preset request object triggers the current limiting fuse of the second flow control judgment node. For example, when the access rate of the same request ip under the specified uniform resource identifier is greater than the preset access rate, it is determined that the preset request object triggers the current limiting fuse of the second flow control judgment node. Among them, the preset request object in the embodiment of the present invention includes the aid under the target uniform resource identifier or the request internet protocol address and the participating user identity identifier in the aid-game dimension. Correspondingly, when it is determined that the preset request object does not meet the second current limiting threshold condition, the embodiment of the present invention determines that the preset request object does not trigger the current limiting fuse of the second flow control judgment node and ends the second flow control judgment node.

[0087] Exemplarily, the content of the corresponding configuration file in the second flow control judgment node in the embodiment of the present invention is shown in the following code:

[0088] {

[0089]

[0090] In some embodiments of the present invention, a corresponding fuse record is set in a preset database, and the user access request is degraded and fused, including but not limited to the following steps:

[0091] Generate a fuse record in the form of key-value pairs and store it in the Redis database. Among them, the survival time of the fuse record corresponds to the fuse time.

[0092] Degrade and fuse the user access request and return a fuse prompt message.

[0093] In this specific embodiment, the embodiment of the present invention generates a fusing record in the form of key-value pairs and stores it in the Redis database. At the same time, the user access request is degraded and fused, and a fusing prompt message is returned. Specifically, the fusing record in the embodiment of the present invention is recorded in the Redis database in the form of key-value pairs (key-value). Among them, the key in the embodiment of the present invention is different according to different current-limiting configuration policies. For example, when using the method of "limiting the request IP and the player openid account under a single aid account", that is, the current-limiting method of the first current-limiting judgment node, the key is $(aid)-$(ip)-$(openid), indicating that the openid player who comes through the **ip request** under this aid account triggers fusing. Correspondingly, the survival time of this key-value data generated in the embodiment of the present invention in the Redis database is the fusing time, that is, the survival time of the fusing record corresponds to the fusing time. Among them, when this record expires in the Redis database, it means that the fusing time ends. In addition, the fusing expiration time in the embodiment of the present invention is custom-set in a preset configuration file. Then, the embodiment of the present invention restricts the user access request to alleviate the problem of the consumption of backend computer resources caused by the frequent initiation of access requests by the corresponding request Internet protocol address and the participating user identity identifier.

[0094] Exemplarily, in some embodiments of the present invention, the setting of the fusing record is judged according to the configuration of the configuration file and the corresponding Redis Lua script. For example, for the configuration of "under a single aid, when a single openid exceeds 50 QPS, fuse for 10 seconds", the embodiment of the present invention passes "rate": 50, "capacity": 50 to the Redis Lua script. When the player requests more than 50 times within 1 second, after calling the Redis Lua script, a result that needs to trigger fusing is returned. At this time, a fusing record is added to Redis, and the survival time of this record in the Redis database is "fuseTime": 10 seconds. Correspondingly, within the next 10 seconds, all requests of the openid player under this aid account within 10 seconds will be degraded.

[0095] In some embodiments of the present invention, before executing when it is determined to execute the first current-limiting judgment node on the target account and judging whether the preset request object meets the first current-limiting threshold condition according to the fusing current-limiting parameters in the preset configuration file, the access current-limiting method provided by the embodiment of the present invention further includes but is not limited to the following steps:

[0096] Configure a preset configuration file. Among them, the preset configuration file includes token bucket parameters, fusing time, current-limiting switch parameters, and query rate threshold parameters.

[0097] Hot update the preset configuration file to the preset web cluster.

[0098] In this specific embodiment, before performing the fuse current-limiting judgment of the preset judgment node, the present invention embodiment first configures the preset configuration file and hot updates the preset configuration file to the preset web cluster. Specifically, the preset configuration file in the present invention embodiment includes token bucket parameters, fuse time, flow control switch parameters, and query rate threshold parameters. Among them, the token bucket parameter in the present invention embodiment is the size of the instruction token bucket, that is, the maximum value of the number of tokens that the token bucket can store. Correspondingly, the fuse time in the present invention embodiment refers to the time length for fusing the corresponding request Internet protocol address and participating user identity identifier, corresponding to the survival time of the generated fuse record. In addition, the flow control switch parameter refers to the total switch of each chained judgment node (such as the first flow control judgment node, the second flow control judgment node, etc.) and the switch state parameter for the corresponding aid. At the same time, the query rate threshold parameter in the present invention embodiment refers to the access frequency threshold of the user access request, that is, the query rate for fusing. Correspondingly, the configuration of the preset judgment node in the present invention embodiment is flexibly configured in the form of a configuration file. Among them, the modification of the preset configuration file will be hot updated to all preset web clusters and will take effect automatically without restarting the tomcat service.

[0099] It should be noted that since the current-limiting judgment based on Redis needs to be performed almost every call, the call volume to the entire Redis is relatively large. Therefore, the present invention embodiment newly deploys a codis to achieve high availability. Correspondingly, the relevant flow control policies in the present invention embodiment are called in the filter of the tomcat container deployed by the Saas service. In addition, in order to ensure the atomic operation of Redis, the present invention embodiment implements the above algorithm based on the Lua script.

[0100] It is easy to understand that the present invention embodiment can intercept the requests of players who brush the interface coming from a specific ip, so as to perform degradation processing on the corresponding requests, avoid the requests from going to the specific business logic, and cause the problem of consumption of backend computer resources, effectively alleviating the problem of abnormal consumption and occupation of computer resources, and effectively improving the stability and reliability of the system. In addition, the present invention embodiment can flexibly configure flow control policies in different dimensions to achieve access current limiting in different dimensions. For example, the present invention embodiment can limit the request ip and player openid account under a single aid account, limit the request ip and player openid account for a specified activity under a single aid account, limit the request ip and player openid account for a specified URI under a single aid account, or limit the request ip and player openid account for a specified URI of a specified activity under a single aid account.

[0101] Please refer to Figure 6, an embodiment of the present application further provides an access rate limiting system that can implement the above access rate limiting method. The system includes:

[0102] A first module 210, configured to dynamically obtain user access requests.

[0103] A second module 220, configured to, when it is determined that a user access request is obtained, determine whether there is a corresponding fuse record in a preset database through the user access request. Among them, the fuse record is used to perform degradation fusing on the user access request.

[0104] A third module 230, configured to, when it is determined that there is no fuse record in the preset database, perform fuse rate limiting judgment according to the user access request to determine whether the user access request meets the preset rate limiting condition.

[0105] A fourth module 240, configured to, when it is determined that the user access request meets the preset rate limiting condition, set a corresponding fuse record in the preset database and perform degradation fusing on the user access request.

[0106] It can be understood that the content in the above method embodiments is applicable to the system embodiments of the present application. The functions specifically implemented by the system embodiments of the present application are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.

[0107] An embodiment of the present application further provides an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above access rate limiting method is implemented. The electronic device can be any intelligent terminal including a tablet computer, an in-vehicle computer, etc.

[0108] It can be understood that the content in the above method embodiments is applicable to the device embodiments of the present application. The functions specifically implemented by the device embodiments of the present application are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.

[0109] Please refer to Figure 7 , Figure 7 illustrates the hardware structure of an electronic device in another embodiment. The electronic device includes:

[0110] A processor 310, which can be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is configured to execute relevant programs to implement the technical solutions provided by the embodiments of the present application;

[0111] The memory 320 can be implemented in the form of a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 320 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 320 and are called by the processor 310 to execute the access rate limiting method of the embodiments of this application;

[0112] The input / output interface 330 is used to implement information input and output;

[0113] The communication interface 340 is used to implement communication interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or through wireless means (such as mobile network, WIFI, Bluetooth, etc.);

[0114] The bus 350 transmits information between various components of the device (such as the processor 310, the memory 320, the input / output interface 330, and the communication interface 340);

[0115] Among them, the processor 310, the memory 320, the input / output interface 330, and the communication interface 340 achieve communication connections with each other inside the device through the bus 350.

[0116] The embodiments of this application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned access rate limiting method is implemented.

[0117] It can be understood that the content in the above method embodiments is applicable to the embodiments of this storage medium. The functions specifically implemented by the embodiments of this storage medium are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.

[0118] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory optionally includes a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0119] The embodiments described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0120] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or combine certain steps, or different steps.

[0121] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations.

[0123] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0124] It should be understood that in this application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item) of the following" or its similar expressions refer to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0125] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the above-mentioned division of units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical or other forms.

[0126] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0127] In addition, in each embodiment of this application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0128] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes: various media that can store programs, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.

[0129] The preferred embodiments of the embodiments of this application have been described above with reference to the accompanying drawings, which does not limit the scope of rights of the embodiments of this application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of this application shall be within the scope of rights of the embodiments of this application.

Claims

1. A method for limiting access flow, characterized in that: The method comprises the following steps: Dynamically obtain user access requests; When it is determined that the user access request is obtained, judging whether there is a corresponding fuse record in a preset database through the user access request; wherein the fuse record is used to downgrade and fuse the user access request; When it is determined that the fuse record does not exist in the preset database, a fuse current limiting judgment is performed according to the user access request to determine whether the user access request meets the preset current limiting condition; When it is determined that the user access request meets the preset current limiting condition, the corresponding fuse record is set in the preset database, and the user access request is downgraded and fuse-broken.

2. The method according to claim 1, characterized in that After performing the step of determining that the user access request is obtained and determining whether a corresponding fuse record exists in a preset database through the user access request, the method further includes: When it is determined that the fuse record exists in the preset database, the user access request is downgraded and fuse-broken.

3. The method according to claim 1, characterized in that The performing a fuse and current limiting judgment according to the user access request to determine whether the user access request meets a preset current limiting condition includes: Performing a fuse and current limiting judgment on the user access request through a preset judgment node to determine whether the user access request triggers a fuse; wherein the preset judgment node includes a plurality of chain judgment nodes; When it is determined that the judgment results of several of the chain judgment nodes are not triggering the fuse, it is determined that the user access request does not meet the preset current limiting condition; or, when it is determined that the judgment result of any one of the chain judgment nodes is triggering the fuse, it is determined that the user access request meets the preset current limiting condition.

4. The method according to claim 3, characterized in that: The performing a fuse and current limiting judgment on the user access request by a preset judgment node to judge whether the user access request triggers a fuse, includes: When it is determined that the first main switch of the first flow control judgment node is turned on, determining whether to execute the first flow control judgment node on the target account; When it is determined that the first flow control judgment node is executed on the target account, it is determined whether the preset request object meets the first flow limiting threshold condition according to the fuse flow limiting parameters in the preset configuration file; wherein the preset request object includes the request Internet Protocol address and the participating user identity corresponding to the user access request, and the fuse flow limiting parameters include the query rate per second; When it is determined that the preset request object meets the first current limiting threshold condition, it is determined that the preset request object triggers the current limiting fuse of the first flow control judgment node, or, when it is determined that the preset request object does not meet the first current limiting threshold condition, it is determined that the preset request object does not trigger the current limiting fuse of the first flow control judgment node.

5. The method according to claim 4, characterized in that The performing a fuse and current limiting judgment on the user access request by a preset judgment node to judge whether the user access request triggers a fuse, further comprising: When it is determined that the second main switch of the second flow control judgment node under the target uniform resource identifier is turned on, it is determined whether there is a configuration for the target uniform resource identifier in the preset configuration file; When it is determined that the preset configuration file contains a configuration for the target uniform resource identifier, determining whether the account flow control switch corresponding to the target account is turned on; When it is determined that the account flow control switch is turned on, judging whether the preset request object meets the second flow limiting threshold condition according to the fuse flow limiting parameter; When it is determined that the preset request object meets the second current limiting threshold condition, it is determined that the preset request object triggers the current limiting fuse of the second flow control judgment node, or, when it is determined that the preset request object does not meet the second current limiting threshold condition, it is determined that the preset request object does not trigger the current limiting fuse of the second flow control judgment node.

6. The method according to claim 1, characterized in that The step of setting the corresponding fuse record in the preset database and performing downgrade fuse on the user access request includes: Generate the fuse record in a key-value pair manner and store it in a Redis database; wherein the survival time of the fuse record corresponds to the fuse time; The user access request is downgraded and fuse-broken, and fuse-broken prompt information is returned.

7. The method according to claim 4, characterized in that Before executing the step of determining to execute the first flow control judgment node on the target account and judging whether the preset request object meets the first flow limiting threshold condition according to the fuse flow limiting parameters in the preset configuration file, the method further includes: Configuring the preset configuration file; wherein the preset configuration file includes token bucket parameters, fuse time, flow control switch parameters, and query rate threshold parameters; The preset configuration file is hot updated to the preset web cluster.

8. An access current limiting system, characterized in that: The system comprises: The first module is used to dynamically obtain user access requests; The second module is used to determine whether there is a corresponding fuse record in a preset database through the user access request when it is determined that the user access request is obtained; wherein the fuse record is used to downgrade and fuse the user access request; The third module is used to, when it is determined that the fuse record does not exist in the preset database, perform a fuse current limiting judgment according to the user access request to determine whether the user access request meets the preset current limiting condition; The fourth module is used to set the corresponding fuse record in the preset database and downgrade the user access request when it is determined that the user access request meets the preset current limiting condition.

9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.