A decentralized global current limiting method and system

Through the decentralized global current limiting method, using the collaborative work of business service instances and clients, combined with encryption algorithms and summary algorithms, the resource waste and high load problems of the traditional current limiting architecture are solved, and efficient and safe current limiting rules are realized. Management and high concurrency support.

CN115208674BActive Publication Date: 2024-09-17DIGITAL CHINA FINANCIAL SOFTWARE LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202210840309.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-18
Publication Date
2024-09-17
Estimated Expiration
2042-07-18

AI Technical Summary

Technical Problem

The traditional global current-limiting architecture requires additional current-limiting services, resulting in a waste of IT resources and high load, affecting system stability. Especially when there are many business services, the current-limiting service becomes a system bottleneck.

Method used

Adopt a decentralized global traffic limiting method and configure global traffic limiting rules and traffic limiting private keys through business service instances. After the client obtains the authentication token, it generates traffic information blocks based on the current limiting rules and ensures it through encryption algorithms and digest algorithms. To ensure the authenticity and security of information, avoid a separate global traffic restriction service, and the client adjusts the access frequency to avoid traffic restrictions.

Benefits of technology

It improves system usage efficiency, prevents current limiting rules from being maliciously tampered with, reduces dependence on single-point systems, supports high concurrency, and improves the real-time and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115208674B
    Figure CN115208674B
Patent Text Reader

Abstract

The present invention provides a decentralized global current limiting method and system, the method comprising: obtaining a business service instance; the business service instance configures a global current limiting rule and a current limiting private key, and starts the business service instance; the customer carries the user credentials to access the authentication service instance and obtains the authentication token; the customer carries the authentication token to access the business service instance, and the business service instance forwards the request to the authentication service, and the authentication service determines whether the authentication token is valid. If it is invalid, the business access fails. If the authentication token is valid, it determines whether the customer meets the set current limiting rules. If it does not meet the current limiting rules, the access is directly passed; if it meets the current limiting rules, the business service instance generates a flow information block according to the current limiting rules; after the business service obtains the flow information block, it confirms whether it has been tampered with. The global current limiting rule no longer requires a separate global current limiting service, which improves the efficiency of system use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of current limiting, and in particular to a decentralized global current limiting method and system. Background Art

[0002] The traditional global current limiting architecture uses an additional current limiting service separately. The current limiting service is based on the token bucket algorithm. Each time a user accesses a business service, the business service goes to the current limiting service to obtain a token. If the token can be obtained, the user is allowed to access the business service. If the token cannot be obtained, it means that the number of visits to the corresponding business service has reached the maximum limit and the user access is blocked.

[0003] This approach has two disadvantages. First, it requires the startup of an additional flow-limiting service, resulting in a waste of IT resources. Second, when there are many business services that need flow-limiting, the load of the flow-limiting service will be very high, causing the flow-limiting service itself to become a system bottleneck, affecting the stability of the entire system. Summary of the invention

[0004] In view of the above problems, the present invention is proposed to provide a decentralized global current limiting method and system that overcomes the above problems or at least partially solves the above problems.

[0005] According to one aspect of the present invention, a decentralized global current limiting method is provided, and the current limiting method includes:

[0006] Get business service instance;

[0007] The business service instance is configured with global current limiting rules and current limiting private keys, and the business service instance is started;

[0008] The client accesses the authentication service instance with user credentials and obtains an authentication token;

[0009] The customer carries the authentication token to access the business service instance. The business service instance forwards the access request to the authentication service. The authentication service determines whether the authentication token is valid. If not, the business access fails. If the authentication token is valid, it determines whether the customer is within the set flow limiting rules. If not, the access is directly allowed.

[0010] If the flow limiting rule is met, the business service instance generates a flow information block according to the flow limiting rule and sends it to the client;

[0011] After receiving the traffic information block, the client adjusts the access frequency according to the current remaining number of accesses to ensure that the access does not trigger the current limiting threshold, resulting in access failure;

[0012] The flow information block specifically includes: flow limiting original information, the flow limiting original information includes flow limiting rule ID, client ID, business service name, flow limiting time window, window start time and remaining number of times;

[0013] The current limiting rule ID includes the current limiting rule identifier corresponding to the client, and the ID of each current limiting rule is unique;

[0014] The client ID includes a unique identifier of the client, and the instance accessed by the client is uniquely confirmed according to the unique identifier;

[0015] The business service name records the service name under which the current limiting rule takes effect;

[0016] The current limiting time window is the current limiting time range;

[0017] The window start time is the time when this current limiting takes effect;

[0018] The remaining number of times is the remaining number of accesses by the client under the corresponding current limiting rule;

[0019] After the business service instance obtains the traffic information block of the client, it confirms whether it has been tampered with;

[0020] Obtaining the first original summary, including SHA256 (current limiting original information), represents generating a summary of the current limiting original information;

[0021] Get the second original summary: RSA_Dec (current limiting public key, current limiting information encrypted hash value), which means that the current limiting information encrypted hash value is decrypted by RSA, and the decrypted value is the original information summary generated on the business server;

[0022] If the first original digest is not equal to the second original digest, the traffic information block is considered to be tampered with and the access is invalid; if they are equal, the traffic information block is considered to be authentic and valid;

[0023] The business service updates the flow information block according to the original flow limiting information and the current time, and sends the updated flow information block to the client;

[0024] Get the encrypted hash value of the current limiting information, including:

[0025] The encrypted hash value of the current limiting information = RSA_Enc (current limiting private key, original hash value of the current limiting information), where RSA represents an asymmetric encryption algorithm;

[0026] The original hash value generation rule of the current limiting information is:

[0027] The original hash value of the current limiting information = SHA256 (original current limiting information), where SHA256 represents the SHA256 digest algorithm;

[0028] The current limiting public key cooperates with the current limiting private key to complete the encryption and decryption of RSA asymmetric encryption.

[0029] Optionally, the configuration method specifically includes: through a configuration file and a configuration center.

[0030] Optionally, the client accesses the authentication service instance with user credentials, and obtaining the authentication token specifically includes:

[0031] The authentication service determines whether the user credentials are valid. If not, access fails. If the credentials are valid, an authentication token is issued to the client.

[0032] Optionally, the flow limiting method also includes: if it is the same traffic information block information, the traffic information block information is sent to the same business service instance, and the business service instance determines whether the traffic information block information has been used. If it has been used, the duplicate traffic information block information will be overwritten, and the latest traffic information saved by the server will be used as the basis to avoid secondary consumption of the traffic information block.

[0033] Optionally, the current limiting method further includes:

[0034] If traffic from a malicious client is detected and traffic information blocks are reused, the business service instance will detect it in real time. If the traffic is found to be malicious access, the client's access will be immediately returned as failed and the customer's access to the business service will be temporarily blacklisted.

[0035] The present invention also provides a decentralized global current limiting system, which applies the decentralized global current limiting method described above, and the current limiting system includes:

[0036] Client module, business service module, load balancing module, time synchronization module and authentication service module;

[0037] The client module is used to send an access request to the business service. When the maximum flow limit times are not reached, the service is accessed normally. When the maximum flow limit times are exceeded, the request returns an exception.

[0038] The business service module is used to maintain the flow information block and timely update the flow limiting information block according to the user access situation to ensure the normal flow limiting function of the service;

[0039] The load balancing module is used to poll the client access service to each business service instance module to avoid the service being concentrated in one service instance;

[0040] The time synchronization module is used to ensure that the time of each business service instance is consistent. The consistent time is used to ensure that the generation and destruction of traffic tokens of each business service instance are synchronized after decentralization;

[0041] The authentication service module is used to ensure that each client access is authenticated, preventing illegal requests from reaching the business service.

[0042] The present invention provides a decentralized global current limiting method and system, the method comprising: obtaining a business service instance; the business service instance configures a global current limiting rule and a current limiting private key, and starts the business service instance; the customer carries the user credentials to access the authentication service instance and obtains the authentication token; the customer carries the authentication token to access the business service instance, and the business service instance forwards the request to the authentication service, and the authentication service determines whether the authentication token is valid. If it is invalid, the business access fails. If the authentication token is valid, it determines whether the customer is in the set current limiting rule. If it does not meet the current limiting rule, the access is directly passed; if it meets the current limiting rule, the business service instance generates a flow information block according to the current limiting rule; after the client receives the current limiting information, it adjusts the access frequency according to the current remaining number of accesses to ensure that the access does not trigger the current limiting threshold, resulting in access failure; after the business service obtains the flow information block, it confirms whether it has been tampered with. The global current limiting rule no longer requires a separate global current limiting service, which improves the system usage efficiency. By introducing encryption algorithms and digest algorithms, the current limiting rules are prevented from being maliciously tampered with.

[0043] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0045] Figure 1 A flowchart of a decentralized global current limiting method provided by an embodiment of the present invention;

[0046] Figure 2 A block diagram of the composition of a decentralized global current limiting system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0048] The terms "comprises" and "having" and any variations thereof in the description embodiments, claims and drawings of the present invention are intended to cover non-exclusive inclusions, for example, including a series of steps or units.

[0049] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0050] A decentralized global current limiting method includes:

[0051] All business service instances are configured with global current limiting rules and current limiting private keys, and all business service instances are started. The configuration method is through the configuration file or the configuration center.

[0052] The client accesses the authentication service instance with the user credentials and obtains the authentication token. The authentication service determines whether the credentials are valid. If not, the access fails. If the credentials are valid, the authentication token is issued to the client.

[0053] The customer carries the authentication token to access the business service instance. The business service instance forwards the request to the authentication service. The authentication service determines whether the authentication token is valid. If not, the business access fails. If the authentication token is valid, it determines whether the customer meets the set flow control rules. If not, the access is directly allowed.

[0054] If the client meets the flow control rules, the business service instance generates a flow information block according to the rules. The block contains the following information:

[0055] The original information of the current limit includes the current limit rule ID, client ID, business service name, current limit time window, window start time and remaining times, where:

[0056] The current limiting rule ID contains the current limiting rule identifier corresponding to the client. The ID of each current limiting rule is unique.

[0057] The client ID contains the unique identifier of the client, through which the client access instance can be uniquely confirmed.

[0058] Business service name records the service name under which the current limiting rule takes effect.

[0059] The current limiting time window represents the current limiting time range. For example, if there are 300 visits in one minute, the current limiting time window is 1 minute.

[0060] The window start time represents the time when the current limit takes effect, for example, 15:26:30.

[0061] The remaining times indicates how many access times the client has left under the current limit rule. When the returned number is 0, all accesses fail, but the block information will be carried all the time.

[0062] The encrypted hash value of the current limiting information can be obtained as follows:

[0063] The encrypted hash value of the current limiting information = RSA_Enc (current limiting private key, original hash value of the current limiting information), where RSA represents an asymmetric encryption algorithm, and the current limiting private key is the current limiting information configured by the business service. The rules for generating the original hash value of the current limiting information are as follows:

[0064] The original hash value of the current limiting information = SHA256 (original current limiting information), where SHA256 represents the SHA256 digest algorithm.

[0065] The current-limiting public key, together with the current-limiting private key, can complete the encryption and decryption of RSA asymmetric encryption.

[0066] The original current limiting information is used to synchronize the current limiting information between the client and the server. The current limiting information is encrypted with a hash value and a public key to ensure that the current limiting information cannot be tampered with, thereby ensuring the authenticity and effectiveness of the current limiting information and preventing malicious users from tampering with the current limiting information and thus invalidating the current limiting rules.

[0067] After receiving the current limiting information, the client can adjust the access frequency according to the current remaining number of accesses to ensure that the access does not trigger the current limiting threshold and cause access failure.

[0068] Traffic information block update method: After the business service obtains the customer's traffic information block, it first confirms whether the block information has been tampered with. The confirmation method is as follows:

[0069] The first original summary: SHA256 (current limiting original information). It represents the generation of a summary of the current limiting original information.

[0070] The second original summary: RSA_Dec (current limiting public key, current limiting information encrypted hash value). It represents RSA decryption of the current limiting information encrypted hash value, and the decrypted value is the original information summary generated on the business server.

[0071] If the first original digest is not equal to the second original digest, the traffic information block is considered to be tampered with and the access is invalid. If they are equal, the traffic information block is considered to be authentic and valid. The business service updates the traffic information block based on the original flow limiting information and the current time. The updated traffic information is then sent to the client by generating new traffic information.

[0072] The algorithm for preventing the secondary consumption of traffic information blocks, the above rules cannot prevent malicious users from repeatedly submitting the same traffic information blocks, which can be solved by configuring the load balancer rules. If it is the same traffic information block information, the information will be sent to the same business service instance, and the business service instance will determine whether the traffic information block information has been used. If it has been used, the duplicate traffic information block information will be overwritten, and the latest traffic information saved by the server will prevail. This will prevent the secondary consumption of traffic information blocks.

[0073] Malicious traffic penalty method: If malicious client traffic is found and traffic information blocks are reused, the business service instance will detect it in real time. If the traffic is found to be malicious access, the client's access will be immediately returned as failed, and the client's access to the business service will be temporarily blacklisted. The definition of malicious traffic and the time for prohibiting access can be customized by the user.

[0074] like Figure 2 As shown, a decentralized global current limiting system includes a client module, a service module, a load balancing module, a time synchronization module and an authentication service module.

[0075] The client module is responsible for sending access requests to the business service. When the maximum flow limit is not reached, the service is accessed normally. When the maximum flow limit is exceeded, the request returns an exception.

[0076] The business service module is responsible for maintaining the flow limiting information block and updating the flow limiting information in a timely manner according to user access conditions to ensure the normal flow limiting function of the service.

[0077] The load balancing module is responsible for polling the client access service to each business service instance module to avoid concentrated service access on one service instance.

[0078] The time synchronization module is responsible for the consistency of time for each business service instance. The consistent time is used to ensure that after decentralization, the generation and destruction of traffic tokens for each business service instance are synchronized.

[0079] The authentication service module is used to ensure that each client access is authenticated to prevent illegal requests from reaching business services.

[0080] Beneficial effects: Decentralized global current limiting: Global current limiting rules no longer require a separate global current limiting service, which improves system efficiency.

[0081] Anti-tampering of current limiting rules: By introducing encryption algorithms and digest algorithms, the current limiting rules can be prevented from being maliciously tampered with.

[0082] High real-time performance: Through time synchronization, each business instance can synchronize the generation of service instance tokens, avoiding centralized token generation and improving system real-time performance.

[0083] High concurrency support: All aspects of the system take into account the performance bottlenecks that may occur in actual applications, and the system's current limiting rules are designed to be decentralized. The effectiveness and judgment of the current limiting rules are carried out in each business instance of the entire system. This ensures the high concurrency of the system and reduces the dependence on single-point systems.

[0084] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A decentralized global current limiting method, characterized in that: The current limiting method comprises: Get business service instance; The business service instance is configured with global current limiting rules and current limiting private keys, and the business service instance is started; The client accesses the authentication service instance with user credentials and obtains an authentication token; The customer carries the authentication token to access the business service instance. The business service instance forwards the access request to the authentication service. The authentication service determines whether the authentication token is valid. If not, the business access fails. If the authentication token is valid, it determines whether the customer is within the set flow limiting rules. If not, the access is directly allowed. If the flow limiting rule is met, the business service instance generates a flow information block according to the flow limiting rule and sends it to the client; After receiving the traffic information block, the client adjusts the access frequency according to the current remaining number of accesses to ensure that the access does not trigger the current limiting threshold, resulting in access failure; The flow information block specifically includes: flow limiting original information, the flow limiting original information includes flow limiting rule ID, client ID, business service name, flow limiting time window, window start time and remaining number of times; The current limiting rule ID includes the current limiting rule identifier corresponding to the client, and the ID of each current limiting rule is unique; The client ID includes a unique identifier of the client, and the instance accessed by the client is uniquely confirmed according to the unique identifier; The business service name records the service name under which the current limiting rule takes effect; The current limiting time window is the current limiting time range; The window start time is the time when this current limiting takes effect; The remaining number of times is the remaining number of accesses by the client under the corresponding current limiting rule; After the business service instance obtains the traffic information block of the client, it confirms whether it has been tampered with; Obtaining the first original summary, including SHA256 (current limiting original information), represents generating a summary of the current limiting original information; Get the second original summary: RSA_Dec (current limiting public key, current limiting information encrypted hash value), which means that the current limiting information encrypted hash value is decrypted by RSA, and the decrypted value is the original information summary generated on the business server; If the first original digest is not equal to the second original digest, the traffic information block is considered to be tampered with and the access is invalid; if they are equal, the traffic information block is considered to be authentic and valid; The business service updates the flow information block according to the original flow limiting information and the current time, and sends the updated flow information block to the client; Get the encrypted hash value of the current limiting information, including: The encrypted hash value of the current limiting information = RSA_Enc (current limiting private key, original hash value of the current limiting information), where RSA represents an asymmetric encryption algorithm; The original hash value generation rule of the current limiting information is: The original hash value of the current limiting information = SHA256 (original current limiting information), where SHA256 represents the SHA256 digest algorithm; The current limiting public key cooperates with the current limiting private key to complete the encryption and decryption of RSA asymmetric encryption.

2. A decentralized global current limiting method according to claim 1, characterized in that: The configuration method specifically includes: through a configuration file and a configuration center.

3. A decentralized global current limiting method according to claim 1, characterized in that: The client accesses the authentication service instance with user credentials, and obtains the authentication token specifically including: The authentication service determines whether the user credentials are valid. If not, access fails. If the credentials are valid, an authentication token is issued to the client.

4. A decentralized global current limiting method according to claim 1, characterized in that: The flow limiting method also includes: if it is the same flow information block information, the flow information block information is sent to the same business service instance, and the business service instance determines whether the flow information block information has been used. If it has been used, the duplicate flow information block information will be overwritten, and the latest flow information saved by the server will be used as the basis to avoid secondary consumption of the flow information block.

5. A decentralized global current limiting method according to claim 1, characterized in that: The current limiting method further includes: If traffic from a malicious client is detected and traffic information blocks are reused, the business service instance will detect it in real time. If the traffic is found to be malicious access, the client's access will be immediately returned as failed and the customer's access to the business service will be temporarily blacklisted.

6. A decentralized global current limiting system, applying the decentralized global current limiting method described in any one of claims 1 to 5 above, characterized in that: The current limiting system comprises: Client module, business service module, load balancing module, time synchronization module and authentication service module; The client module is used to send an access request to the business service. When the maximum flow limit times are not reached, the service is accessed normally. When the maximum flow limit times are exceeded, the request returns an exception. The business service module is used to maintain the flow information block and update the flow information block in time according to the user access situation to ensure the normal flow limiting function of the service; The load balancing module is used to poll the client access service to each business service instance module to avoid the service being concentrated in one service instance; The time synchronization module is used to ensure that the time of each business service instance is consistent. The consistent time is used to ensure that the generation and destruction of traffic tokens of each business service instance are synchronized after decentralization; The authentication service module is used to ensure that each client access is authenticated, preventing illegal requests from reaching the business service.

Citation Information

Patent Citations

  • Trusted electronic certificate platform system based on block chain and authentication method thereof

    CN111368324A

  • Gateway authentication and identity authentication platform and method thereof

    CN111865920A

  • Authentication method and device based on unified gateway, equipment and storage medium

    CN112039909A

  • Method for generating and using encrypted tamper-proof file

    CN113468607A

  • Method and system for determining accounting salary on open Internet, computing device and storage medium

    CN114092202A