Business data processing request throttling method, device, equipment and medium

By introducing a database device to calculate the number of tokens in the token bucket and generate rate limiting results in the business data processing system, the problem of exceeding the system's processing capacity when service node devices make concurrent calls is solved, thereby improving the security and processing capacity of the business data processing system.

CN116566915BActive Publication Date: 2026-06-02INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-05-30
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

When multiple service node devices concurrently call the business data processing interface, it may exceed the concurrent data processing capacity of the business data processing system, leading to system damage.

Method used

Before each business data processing request is sent, the service node device obtains the interface identifier and rate limiting data, and sends them to the database device. The database device obtains the number of successful sendings, the number of remaining tokens, and the time when the interface has been called based on the interface identifier, calculates the current number of tokens in the token bucket, generates a rate limiting result, and sends it to the service node device. The service node device performs rate limiting processing based on the rate limiting result.

Benefits of technology

Unified rate limiting management of all service node devices was achieved, ensuring the concurrent data processing capability of the business data processing system and improving the system's security and processing capacity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116566915B_ABST
    Figure CN116566915B_ABST
Patent Text Reader

Abstract

The application provides a service data processing request flow limiting method, device, equipment and medium. In the method, the service node equipment sends the obtained interface identifier and flow limiting data to the database equipment before sending the service data processing request each time. The database equipment obtains the sending success number, the remaining token number and the called interface moment according to the interface identifier, and further calculates the current token number in the token bucket. When the consumed number of the calling interface token is greater than the current token number, a flow limiting result indicating that flow limiting is needed is generated and sent to the service node equipment. The service node equipment performs flow limiting processing on the service data processing request. According to the present scheme, the database equipment determines whether flow limiting is needed according to whether there are enough tokens in the token bucket. The token bucket capacity number is related to the processing concurrent data number of the service data processing system, which guarantees the processing concurrent data capability of the service data processing system and effectively improves the security of the service data processing system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology or other related fields, and in particular to a method, apparatus, device and medium for limiting the rate of business data processing requests. Background Technology

[0002] With the development of the digital age, business data processing systems provide business data processing interfaces for business interface calling systems, and the frequency of calling business data processing interfaces is getting higher and higher.

[0003] In existing technologies, a business interface calling system can correspond to multiple service node devices. Each service node device can call the business data processing interface, which means sending a business data processing request to the business data processing system. In order to ensure the concurrent data processing capability of the business data processing system, a rate limit is set for each service node device. When the number of concurrent calls to the business data processing interface by a service node device is greater than or equal to the rate limit, rate limiting will be implemented.

[0004] However, when multiple service node devices concurrently call the business data processing interface, the number of calls may still exceed the concurrent data processing capacity of the business data processing system, leading to damage to the business data processing system. Summary of the Invention

[0005] This application provides a method, apparatus, device, and medium for limiting the flow of business data processing requests, which addresses the problem in the prior art where, when multiple service node devices concurrently call the business data processing interface, the number of calls may still exceed the concurrent data processing capacity of the business data processing system, leading to damage to the business data processing system.

[0006] In a first aspect, embodiments of this application provide a method for rate limiting of business data processing requests, applied to a service node device corresponding to a business interface calling system, the method comprising:

[0007] Before each business data processing request is sent, rate limiting data corresponding to the first interface identifier of the business data processing interface in the business data processing request is obtained from the Java Virtual Machine of the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0008] Send the first interface identifier and the rate limiting data to the database device;

[0009] Receive the rate limiting result sent by the database device, the rate limiting result being used to indicate whether rate limiting is required or not;

[0010] If the rate limiting result indicates that rate limiting is required, rate limiting is applied to the business data processing request.

[0011] In one specific embodiment, the method further includes:

[0012] If the rate limiting result indicates that rate limiting is not required, then the business data processing request is sent to the operating device of the business data processing system.

[0013] In one specific embodiment, the method further includes:

[0014] After the service node device is powered on, at preset intervals, the rate limiting data in the database corresponding to the business interface calling system is loaded into the Java Virtual Machine of the service node device.

[0015] In response to the staff's operation to modify the rate limiting data, obtain the target rate limiting data and the second interface identifier input by the staff;

[0016] Based on the second interface identifier, the rate limiting data corresponding to the second interface identifier in the database is modified to the target rate limiting data.

[0017] In one specific embodiment, the method further includes:

[0018] In response to the staff's operation of viewing the rate limiting variables, the third interface identifier input by the staff is obtained. The rate limiting variables include the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called.

[0019] Based on the third interface identifier, obtain the rate limiting data corresponding to the third interface identifier from the Java Virtual Machine of the service node device;

[0020] Based on the third interface identifier, obtain from the database device the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, corresponding to the third interface identifier;

[0021] Display the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called.

[0022] Secondly, embodiments of this application provide a method for rate limiting of business data processing requests, applied to a database device, the method comprising:

[0023] The system receives a first interface identifier and rate limiting data sent by the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0024] Based on the first interface identifier, obtain the number of successful transmissions;

[0025] If the number of successful transmissions is less than the maximum access count, then based on the first interface identifier, obtain the remaining number of tokens and the time when the interface has been called;

[0026] The current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity.

[0027] If the number of tokens consumed by the API call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated.

[0028] The generated rate limiting results are sent to the service node device.

[0029] In one specific implementation, obtaining the number of successful transmissions based on the first interface identifier includes:

[0030] Based on the first interface identifier, if it is determined that the number of successful transmissions exists in the database of the database device, the number of successful transmissions is retrieved from the database;

[0031] If it is determined that the number of successful transmissions does not exist in the database of the database device, the number of successful transmissions is set to 0.

[0032] In one specific implementation, obtaining the remaining token count and the time of the invoked interface based on the first interface identifier includes:

[0033] Based on the first interface identifier, if it is determined that the remaining number of tokens exists in the database of the database device, the remaining number of tokens is obtained from the database;

[0034] If it is determined that the remaining number of tokens does not exist in the database of the database device, the remaining number of tokens is set as the token bucket capacity.

[0035] Based on the first interface identifier, if it is determined that the time of the invoked interface exists in the database of the database device, the time of the invoked interface is obtained from the database;

[0036] If it is determined that the called interface time does not exist in the database of the database device, the called interface time is set to 0.

[0037] In one specific implementation, before sending the generated rate limiting result to the service node device, the method further includes:

[0038] If the number of tokens consumed by the API call is less than or equal to the current number of tokens, a rate limiting result indicating that rate limiting is not required is generated.

[0039] In one specific implementation, after obtaining the number of successful transmissions, the method further includes:

[0040] If the number of successful transmissions is greater than or equal to the maximum access volume, a rate limiting result indicating that rate limiting is required is generated.

[0041] In one specific implementation, before sending the generated rate limiting result to the service node device, the method further includes:

[0042] Calculate the token filling time based on the token bucket capacity and the token filling rate;

[0043] Based on whether the rate limiting result indicates that rate limiting is required, the current number of tokens, the number of tokens consumed by the API call, and the token filling time, update the remaining number of tokens and the remaining expiration time corresponding to the remaining number of tokens in the database;

[0044] Based on the current time and the token filling duration, update the database with the time of the invoked interface and the remaining expiration duration corresponding to the time of the invoked interface;

[0045] Based on whether the remaining expiration time corresponding to the number of successful transmissions is less than 0, update the number of successful transmissions and the remaining expiration time corresponding to the number of successful transmissions in the database.

[0046] Thirdly, embodiments of this application provide a business data processing request rate limiting device, comprising:

[0047] The acquisition module is used to acquire the rate limiting data corresponding to the first interface identifier of the business data processing interface in the business data processing request from the Java Virtual Machine of the service node device before each business data processing request is sent. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0048] The sending module is used to send the first interface identifier and the rate limiting data to the database device;

[0049] A receiving module is used to receive the rate limiting result sent by the database device, wherein the rate limiting result is used to indicate whether rate limiting is required or not.

[0050] The processing module is used to perform rate limiting processing on the business data processing request if the rate limiting result indicates that rate limiting is required.

[0051] Fourthly, embodiments of this application provide a business data processing request rate limiting device, comprising:

[0052] The receiving module is used to receive the first interface identifier and rate limiting data sent by the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0053] The acquisition module is used for:

[0054] Based on the first interface identifier, obtain the number of successful transmissions;

[0055] If the number of successful transmissions is less than the maximum access count, then based on the first interface identifier, obtain the remaining number of tokens and the time when the interface has been called;

[0056] Processing module, used for:

[0057] The current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity.

[0058] If the number of tokens consumed by the API call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated.

[0059] The sending module is used to send the generated rate limiting results to the service node device.

[0060] Fifthly, embodiments of this application provide an electronic device, including:

[0061] Processor, memory, communication interface, display;

[0062] The memory is used to store the executable instructions of the processor;

[0063] The processor is configured to execute the business data processing request rate limiting method according to any one of the first aspects by executing the executable instructions.

[0064] Sixthly, embodiments of this application provide an electronic device, including:

[0065] Processor, memory, communication interface;

[0066] The memory is used to store the executable instructions of the processor;

[0067] The processor is configured to execute the business data processing request rate limiting method according to any of the second aspects by executing the executable instructions.

[0068] In a seventh aspect, embodiments of this application provide a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the business data processing request rate limiting method described in either the first or second aspect.

[0069] Eighthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, is used to implement the business data processing request rate limiting method described in either the first or second aspect.

[0070] The business data processing request rate limiting method, apparatus, device, and medium provided in this application embodiment involve a service node device sending a first interface identifier and rate limiting data to a database device before each business data processing request is sent. The database device obtains the number of successful transmissions, the remaining number of tokens, and the time of the interface call based on the first interface identifier, and then calculates the current number of tokens in the token bucket. When the number of tokens consumed by the interface call in the rate limiting data exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated and sent to the service node device. The service node device then performs rate limiting on the business data processing request. This solution allows the service node device to perform rate limiting based on the rate limiting result sent by the database device. Whether rate limiting is needed is determined by the database device. Compared to the prior art where the service node device itself determines whether rate limiting is needed, the database device can determine whether rate limiting is needed based on the token bucket capacity related to the amount of concurrent data processed by the business data processing system, and whether there are enough tokens in the token bucket. This ensures the concurrent data processing capability of the business data processing system and effectively improves the security of the business data processing system. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0072] Figure 1 A flowchart illustrating an embodiment of the business data processing request rate limiting method provided in this application;

[0073] Figure 2 A flowchart illustrating Embodiment 5 of the business data processing request rate limiting method provided in this application;

[0074] Figure 3 A flowchart illustrating Embodiment Six of the business data processing request rate limiting method provided in this application;

[0075] Figure 4 A schematic diagram of the structure of the business data processing request rate limiting device according to Embodiment 1 provided in this application;

[0076] Figure 5 A schematic diagram of the second embodiment of the business data processing request rate limiting device provided in this application;

[0077] Figure 6 A schematic diagram of the structure of an electronic device provided in this application Figure 1 ;

[0078] Figure 7 A schematic diagram of the structure of an electronic device provided in this application Figure 2 . Detailed Implementation

[0079] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments made by those skilled in the art under the guidance of these embodiments are within the scope of protection of this application.

[0080] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0081] With the development of the digital age, business data processing systems provide business data processing interfaces for business interface calling systems, and the frequency of calling business data processing interfaces is getting higher and higher.

[0082] In existing technologies, a business interface calling system can correspond to multiple service node devices. Each service node device can call the business data processing interface, which means sending a business data processing request to the business data processing system. In order to ensure the concurrent data processing capability of the business data processing system, a rate limit is set for each service node device. When the number of concurrent calls to the business data processing interface by a service node device is greater than or equal to the rate limit, rate limiting will be implemented.

[0083] However, when multiple service node devices concurrently call the business data processing interface, the number of calls, that is, the number of business data processing requests that need to be processed concurrently, may still exceed the concurrent data processing capacity of the business data processing system, leading to damage to the business data processing system.

[0084] To address the problems in existing technologies, the inventors, during their research on rate limiting methods for business data processing requests, discovered that the main issue lies in the fact that each service node device is independent, and whether or not to implement rate limiting is determined solely by the service node itself, without considering the situation of other service nodes. Therefore, before each business data processing request is sent, the service node device can send the obtained interface identifier and rate limiting data to the database device. The database device uses the interface identifier to obtain the number of successful submissions, the remaining number of tokens, and the time of the interface call, and then calculates the current number of tokens in the token bucket. When the number of tokens consumed by the interface call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated and sent to the service node device. The service node device then performs rate limiting on the business data processing requests. The database device determines whether rate limiting is needed based on whether there are enough tokens in the token bucket. Since the token bucket capacity is related to the concurrent data processing capacity of the business data processing system, unified rate limiting management is achieved for all service nodes, ensuring the concurrent data processing capacity of the business data processing system and effectively improving its security. Based on the above inventive concept, the business data processing request rate limiting scheme in this application was designed.

[0085] It should be noted that, in this application, the service node device corresponding to the business interface call system can be a server, computer, terminal device, or other device capable of deploying and running the business interface call system; the database device can be a server, computer, terminal device, or other device capable of deploying and running a database; and the running device of the business data processing system can be a server, computer, terminal device, or other device capable of deploying and running the business data processing system. The service node device and the database device corresponding to the business interface call system can be the same device or different devices. This application does not limit the service node device, database device, or running device of the business data processing system corresponding to the business interface call system; these can be determined according to actual circumstances.

[0086] The following example illustrates the application scenarios of the rate limiting method for business data processing requests provided in the application.

[0087] For example, in this application scenario, the business interface call system uses three service node devices: service node device A, service node device B, and service node device C. The business data processing system processes 200 concurrent data items, has a token bucket capacity of 400, consumes 2 tokens for calling the interface, and has a token filling rate of 1 per second.

[0088] Service node device A concurrently sends 180 business data processing requests. Service node device B needs to concurrently send the 21st business data processing request. Before sending the 21st business data processing request, service node device B sends the first interface identifier and rate limiting data to the database device.

[0089] The database device obtains the number of successful transmissions based on the first interface identifier; then determines that the number of successful transmissions is less than the maximum access limit, and obtains the remaining number of tokens and the time when the interface has been called based on the first interface identifier.

[0090] The interval between the current time and the time the interface was called is calculated and set to 1 second. Based on the remaining tokens being 0, the interval, the token filling rate, and the token bucket capacity, the current number of tokens in the token bucket is determined to be 1. Therefore, if the number of tokens consumed by the interface call exceeds the current number of tokens, a rate-limiting result indicating the need for rate limiting is generated and sent to the service node device. The service node device then performs rate limiting on the business data processing requests.

[0091] It should be noted that the above scenario is only an example of an application scenario provided by the embodiments of this application. The embodiments of this application do not limit the actual form of the various devices included in the scenario, nor do they limit the interaction method between devices. In the specific application of the solution, it can be set according to actual needs.

[0092] The technical solution of this application will now be described in detail through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0093] Figure 1 This is a flowchart illustrating an embodiment of the business data processing request rate limiting method provided in this application. Before sending a business data processing request to the service node device, this embodiment sends a first interface identifier and rate limiting data to the database device. The database device determines whether rate limiting is required based on the first interface identifier and the rate limiting data, and sends the rate limiting result to the service node device. The process of the service node device rate-limiting the business data processing request when the rate limiting result indicates that rate limiting is required is explained. The method in this embodiment can be implemented through software, hardware, or a combination of both. Figure 1As shown, the method for rate limiting business data processing requests specifically includes the following steps:

[0094] S101: Before sending each business data processing request, the service node device obtains the rate limiting data corresponding to the first interface identifier from the Java Virtual Machine of the service node device according to the first interface identifier of the business data processing interface in the business data processing request.

[0095] Users can invoke the corresponding service node devices of the system through the business interface to handle business. Different businesses require invoking different business data processing interfaces, which correspond to different business data processing requests. The service node devices then respond to the user's operation, generating a business data processing request. The business data processing request includes the first interface identifier of the business data processing interface, and then needs to be sent to the running device of the business data processing system to complete the business processing.

[0096] In this step, before sending each business data processing request, the service node device needs to determine whether to rate-limit the requests to prevent the number of requests from exceeding the concurrent data processing capacity of the business data processing system. This requires retrieving the rate-limiting data corresponding to the first interface identifier from the service node device's Java Virtual Machine. The rate-limiting data includes the maximum access limit, token bucket capacity, token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the concurrent data processing capacity of the business data processing system.

[0097] It should be noted that the rate-limiting data is set by staff in the database corresponding to the business interface calling system based on the concurrent data processing capacity of the business data processing system. This data is used to determine whether rate limiting is necessary. After the service node device powers on, at preset intervals, the rate-limiting data from the database corresponding to the business interface calling system is loaded into the Java Virtual Machine of the service node device. The rate-limiting data corresponds to the interface identifier. The maximum access limit can be 300, 400, 500, etc., the token filling rate can be 20, 50, 100, etc., the number of tokens consumed for calling the interface can be 5, 10, 50, etc., the preset interval can be 0.5 seconds, 1 second, 2 seconds, etc., and the token bucket capacity is related to the concurrent data processing capacity of the business data processing system. For example, the token bucket capacity ≤ the concurrent data processing capacity. The number of tokens consumed when calling the API. The token bucket capacity can be 400, 600, 1000, etc. This application embodiment does not limit the maximum access volume, token filling rate, number of tokens consumed when calling the API, preset duration, or token bucket capacity, and these can be set according to actual conditions.

[0098] It should be noted that the methods for triggering the generation of business data processing requests can include: users calling the corresponding service node device of the system through the business interface to handle business, and the service node device then responding to the user's operation by generating a business data processing request; or the service node device triggering the request periodically; or a third-party device issuing a command to trigger the request. This application embodiment does not limit the method for triggering the generation of business data processing requests and can be set according to actual circumstances.

[0099] S102: The service node device sends the first interface identifier and rate limiting data to the database device.

[0100] In this step, after the service node device obtains the rate limiting data, in order to ensure that business data processing requests are sent concurrently on different service node devices and that the business data processing system can also handle concurrent data, the database device needs to decide whether rate limiting is required. This requires the service node device to send the first interface identifier and rate limiting data to the database device.

[0101] It should be noted that, for the implementation method of the service node device sending the first interface identifier and rate limiting data to the database device, the database device can form a function to obtain the rate limiting result, and provide the function name to the service node device. For example, the name is isAllowed. The service node device uses this function to send the first interface identifier and rate limiting data to the database device.

[0102] S103: After receiving the first interface identifier and rate limiting data sent by the service node device, the database device obtains the number of successful transmissions based on the first interface identifier.

[0103] In this step, the service node device sends the first interface identifier and rate limiting data to the database device. The database device can then receive the first interface identifier and rate limiting data sent by the service node device. To ensure that the business data processing system does not process too many business data processing requests within a certain period of time, and to further guarantee the concurrent data processing capacity of the business data processing system, it is necessary to first obtain the number of successful transmissions based on the first interface identifier. The rate limiting data includes the maximum access volume, token bucket capacity, token filling rate, and the number of tokens consumed for calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0104] Specifically, if the database device receives the first interface identifier for the first time, or if the data corresponding to the first interface identifier has expired, the database in the database device will not store the number of successful transmissions. If the first interface identifier is not received for the first time, and the data corresponding to the first interface identifier has not expired, the database in the database device will store the number of successful transmissions. Therefore, based on the first interface identifier, if it is determined that the database in the database device contains the number of successful transmissions, the number of successful transmissions is retrieved from the database; if it is determined that the database in the database device does not contain the number of successful transmissions, the number of successful transmissions is set to 0.

[0105] It's important to note that the database in the database device can be either a cached database or a non-cached database. A cached database could be Redis, while a non-cached database could be SQL, MySQL, etc. For both cached and non-cached databases, the data needs to have a remaining expiration time set. Once set, the remaining expiration time will decrease synchronously over time, and for each piece of data, it will be deleted when the remaining expiration time reaches 0. For example, when the database is Redis, the data storage format is key-value pairs. The key for storing the number of successful transmissions is "interface identifier: has_count", and the value is the number of successful transmissions. For example, if the first interface identifier is 20230518, to find the number of successful transmissions corresponding to the first interface identifier, you can first search for the key "20230518: has_count", and the corresponding number of successful transmissions is the same as the number of successful transmissions corresponding to the first interface identifier.

[0106] S104: If the number of successful transmissions is less than the maximum access limit, the database device will obtain the remaining number of tokens and the time of the interface call based on the first interface identifier.

[0107] In this step, if the database device determines that the number of successful transmissions is less than the maximum access limit, it means that the business data processing system will not process too many business data processing requests within a certain period of time. It is necessary to further determine whether the current business data processing requests need to be rate-limited. This requires obtaining the remaining number of tokens and the time when the interface has been called based on the first interface identifier, so that the token bucket method can be used to determine whether rate-limiting is required.

[0108] Specifically, if the database device receives the first interface identifier for the first time, or if the data corresponding to the first interface identifier has expired, the database in the database device will not store the remaining number of tokens sent or the times when the interface was called. If the first interface identifier is not received for the first time, and the data corresponding to the first interface identifier has not expired, the database in the database device will store the remaining number of tokens and the number of times the interface was called. Therefore, based on the first interface identifier, if it is determined that there are remaining tokens in the database of the database device, the remaining tokens are retrieved from the database; if it is determined that there are no remaining tokens in the database of the database device, the remaining tokens are set as the token bucket capacity.

[0109] Based on the first interface identifier, if it is determined that the called interface time exists in the database of the database device, the called interface time is retrieved from the database; if it is determined that the called interface time does not exist in the database of the database device, the called interface time is set to 0.

[0110] For example, when the database is Redis, the key for storing the remaining tokens is "interface identifier: last_tokens", and the value is the remaining tokens. The key for storing the time of the last API call is "interface identifier: last_timestamp", and the value is the time of the last API call.

[0111] S105: The database device determines the current number of tokens in the token bucket based on the current time, the number of remaining tokens, the token filling rate, and the token bucket capacity.

[0112] In this step, after the database device obtains the remaining token count and the time of the last API call, it can calculate the duration between the current time and the last API call time as the padding duration, and then calculate the padding duration according to the formula a = last_tokens + (diff_time). The theoretical token count is calculated using the rate function, where 'a' represents the theoretical token count, 'last_tokens' represents the remaining tokens, 'diff_time' represents the filling time, and 'rate' represents the token filling rate. Then, the theoretical token count is compared to the token bucket capacity. If the theoretical token count is less than or equal to the token bucket capacity, the theoretical token count is used as the current token count in the token bucket; if the theoretical token count is greater than the token bucket capacity, the token bucket capacity is used as the current token count in the token bucket.

[0113] S106: If the number of tokens consumed by calling the interface is greater than the current number of tokens, the database device will generate a rate limiting result indicating that rate limiting is required.

[0114] S107: The database device sends the generated rate limiting results to the service node device.

[0115] In the above steps, after the database device obtains the current number of tokens in the token bucket, it determines whether the number of tokens consumed by calling the interface is greater than the current number of tokens. If the number of tokens consumed by calling the interface is greater than the current number of tokens, it means that the concurrent data processing capacity of the business data processing system has reached its limit and rate limiting is required. The database device then generates a rate limiting result indicating that rate limiting is required, and then sends the generated rate limiting result to the service node device.

[0116] Since each time a service node device sends a business data processing request, it consumes the number of tokens in the token bucket, and it continuously adds tokens to the token bucket according to the token filling rate, the number of tokens in the token bucket represents the size of the business data processing system's concurrent data processing capacity. Therefore, when the number of tokens consumed when calling the interface exceeds the current number of tokens, it can be determined that the business data processing system's concurrent data processing capacity has reached its limit.

[0117] S108: After receiving the rate limiting result sent by the database device, if the rate limiting result indicates that rate limiting is required, the service node device shall perform rate limiting processing on the business data processing request.

[0118] In this step, after the database device sends the rate limiting result to the service node device, the service node device can receive the rate limiting result sent by the database device. The rate limiting result is used to indicate whether rate limiting is required or not. For example, a rate limiting result of true indicates that rate limiting is required, and a rate limiting result of false indicates that rate limiting is not required.

[0119] If the rate limiting result indicates that rate limiting is required, the service node device will apply rate limiting to the business data processing request. The service node device can also output a rate limiting notification message so that the user is aware that the current business data processing request has been rate-limited and can try again later.

[0120] It should be noted that the methods for rate limiting business data processing requests can include discarding the requests; storing the requests and resending them after a certain interval, with a determination made before resending whether rate limiting is necessary; or sending the requests to the running equipment of a backup business data processing system. This application does not limit the method of rate limiting for business data processing requests; it can be set according to actual circumstances.

[0121] The business data processing request rate limiting method provided in this embodiment involves the service node device sending a first interface identifier and rate limiting data to a database device before each business data processing request is sent. The database device uses the first interface identifier to obtain the number of successful transmissions, the remaining number of tokens, and the time of the interface call; it then determines the current number of tokens in the token bucket. When the number of tokens consumed by the interface call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated and sent to the service node device. The service node device then performs rate limiting on the business data processing request. Compared to existing technologies where the service node device limits rate based on its own set rate limiting quantity, this solution uses the database device to determine whether rate limiting is needed based on whether there are enough tokens in the token bucket. Since the token bucket capacity is related to the number of concurrent data processed by the business data processing system, this ensures the concurrent data processing capability of the business data processing system and effectively improves the security of the business data processing system.

[0122] Based on the above embodiments, the following describes the situation where the database device generates a rate limiting result indicating that rate limiting is not required, and the service node device sends a business data processing request.

[0123] After calculating the current number of tokens, if the database device determines that the number of tokens consumed in calling the interface is less than or equal to the current number of tokens, it means that the concurrent data processing capacity of the business data processing system has not reached its limit and can still process business data processing requests. In this case, it generates a rate limiting result indicating that rate limiting is not required. The rate limiting result is then sent to the service node device.

[0124] After receiving the rate limiting result, if the result indicates that rate limiting is not required, the service node device sends a business data processing request to the running device of the business data processing system. The running device of the business data processing system can then process the business data according to the business data processing request and complete the user's business processing.

[0125] The business data processing request rate limiting method provided in this embodiment generates a rate limiting result indicating that rate limiting is not required when the number of call interface tokens consumed is less than or equal to the current number of tokens. This result is then sent to the service node device. The service node device sends the business data processing request to the running device of the business data processing system, which can then process the business data. This effectively ensures that even when the concurrent data processing capacity of the business data processing system is not at its limit, it can still handle business data processing requests sent by different service node devices, thus guaranteeing the concurrent data processing capacity of the business data processing system. Furthermore, existing technologies set a rate limiting limit for each service node device, i.e., set an upper limit on the number of concurrent business data processing requests. This solution does not limit the number of concurrent business data processing requests when the concurrent data processing capacity of the business data processing system is not at its limit, thereby increasing the upper limit on the number of concurrent business data processing requests sent by service node devices.

[0126] Based on the above embodiments, the following explains the situation where rate limiting is still required when the number of successful transmissions is greater than or equal to the maximum access limit.

[0127] After the database device obtains the number of successful transmissions, to ensure that the business data processing system does not process too many business data processing requests within a certain period and to further guarantee the concurrent data processing capacity of the business data processing system, it needs to determine whether the number of successful transmissions is less than the maximum access limit. If the number of successful transmissions is greater than or equal to the maximum access limit, it means that the business data processing system is processing too many business data processing requests within the remaining expiration time corresponding to the number of successful transmissions. To reduce the burden on the business data processing system, a rate-limiting result indicating that rate limiting is required is generated. This rate-limiting result is then sent to the service node device, which performs rate-limiting processing on the business data processing requests.

[0128] Since the number of successful transmissions is stored in the database with a corresponding remaining expiration time, the number of successful transmissions will be deleted when the remaining expiration time decreases to 0 over time. Furthermore, during the next process of receiving the interface identifier to determine whether to limit the flow, the number of successful transmissions will be reset to 0, and the remaining expiration time corresponding to the number of successful transmissions will also be reset. Therefore, within the remaining expiration time corresponding to the number of successful transmissions, the business data processing system will not handle too many business data processing requests, reducing the burden on the business data processing system and improving its lifespan.

[0129] The business data processing request rate limiting method provided in this embodiment limits the business data processing requests when the number of successful transmissions is greater than or equal to the maximum access volume. This ensures that the business data processing system does not process too many business data processing requests within a certain period of time, thereby reducing the burden on the business data processing system and improving its lifespan.

[0130] The following explains how to update the remaining token count, the time of the API call, the number of successful sends, and the corresponding remaining expiration time.

[0131] If the number of successful sends is less than the maximum access volume, and before sending the generated rate limiting result to the service node device, the database device first calculates the token filling time based on the token bucket capacity and the token filling rate. That is, the token bucket capacity is divided by the number of tokens to be filled to obtain the token filling time.

[0132] Then, based on whether the rate limiting result indicates that rate limiting is required, the current number of tokens, the number of tokens consumed by calling the interface, and the token filling time, the remaining number of tokens and the remaining expiration time corresponding to the remaining number of tokens are updated in the database.

[0133] If the rate limiting result indicates that rate limiting is required, the difference between the current number of tokens and the number of tokens consumed by the API call will be used as the updated number of remaining tokens, and twice the token filling time will be used as the updated remaining expiration time corresponding to the updated number of remaining tokens.

[0134] If the rate limiting result indicates that rate limiting is not required, the current number of tokens will be used as the updated number of remaining tokens, and twice the token filling time will be used as the updated remaining expiration time corresponding to the updated number of remaining tokens.

[0135] It also updates the database with the time of the invoked interface and the remaining expiration time corresponding to the time of the invoked interface, based on the current time and the token filling duration.

[0136] The current time is taken as the updated time of the invoked interface, and twice the token filling time is taken as the updated remaining expiration time corresponding to the updated time of the invoked interface.

[0137] Update the number of successful sends and the corresponding remaining expiration time in the database based on whether the remaining expiration time corresponding to the number of successful sends is less than 0.

[0138] If the remaining expiration time corresponding to the number of successful sends is less than 0, it means that the number of successful sends in the database has expired and has been deleted. Therefore, the current number of successful sends is incremented by one to obtain the updated number of successful sends, and the token filling time is used as the updated remaining expiration time corresponding to the updated number of successful sends.

[0139] If the remaining expiration time corresponding to the number of successful sends is greater than or equal to 0, it means that the number of successful sends in the database has not expired. Increment the current number of successful sends by one to get the updated number of successful sends, but do not update the remaining expiration time corresponding to the number of successful sends.

[0140] It should be noted that the remaining expiration time for the remaining tokens, the time of the API call, and the number of successful sends decreases synchronously over time, and will be deleted when it decreases to 0.

[0141] It should be noted that if the database is Redis, updates are performed using the `setex` command.

[0142] The business data processing request rate limiting method provided in this embodiment ensures the accuracy of the rate limiting results by updating the remaining token count, the time of the interface call, the number of successful send, and the corresponding remaining expiration time before sending the rate limiting results to the service node device.

[0143] Figure 2 This is a flowchart illustrating Embodiment 5 of the business data processing request rate limiting method provided in this application. Based on the above embodiments, this application describes the modification of the rate limiting data. For example... Figure 2 As shown, the method for rate limiting business data processing requests specifically includes the following steps:

[0144] S201: In response to the staff's operation to modify the rate limiting data, obtain the target rate limiting data and the second interface identifier entered by the staff.

[0145] Due to adjustments in the number of concurrent data processed by the business data processing system, or database failures in the business interface call system, staff need to modify the rate limiting data. Staff log into the business interface call system on the service node device, which displays the interface for modifying rate limiting data. On this interface, the user selects or manually enters the target rate limiting data and the second interface identifier.

[0146] In this step, after the staff inputs the target rate limiting data and the second interface identifier, the service node device can obtain the target rate limiting data and the second interface identifier input by the staff.

[0147] S202: Based on the second interface identifier, modify the rate limiting data corresponding to the second interface identifier in the database to the target rate limiting data.

[0148] In this step, after the service node device obtains the target rate limiting data and the second interface identifier, it searches for the corresponding rate limiting data in the database corresponding to the business interface call system based on the second interface identifier, and then modifies it to the target rate limiting data.

[0149] Since the service node device loads the rate limiting data from the database corresponding to the business interface call system into the Java Virtual Machine of the service node device at preset intervals after power-on, the service node device can obtain the latest rate limiting data without downtime.

[0150] It should be noted that the preset duration can be 0.5 seconds, 1 second, 2 seconds, etc. This application embodiment does not limit the preset duration and can be set according to the actual situation.

[0151] The business data processing request rate limiting method provided in this embodiment modifies the rate limiting data in the database in response to user modification operations while the service node device is running. It then periodically loads the latest rate limiting data into the Java Virtual Machine of the service node device, thus updating the rate limiting data on the service node device. Compared to existing technologies that require the service node device to be shut down to modify rate limiting data, this solution eliminates the need for service node device shutdown, enabling dynamic modification and effectively improving the operating efficiency of the service node device.

[0152] Figure 3 This is a flowchart illustrating a sixth embodiment of the business data processing request rate limiting method provided in this application. Based on the above embodiments, this application describes the situation where rate limiting variables are displayed through the service node device. For example... Figure 3 As shown, the method for rate limiting business data processing requests specifically includes the following steps:

[0153] S301: In response to the staff's operation of viewing the flow limit variable, obtain the third interface identifier input by the staff.

[0154] Staff want to view rate limiting variables to determine the operation status of the business interface call system and database device. Staff log in to the business interface call system on the service node device, and the service node device displays the interface for viewing rate limiting variables. Then, the user selects or manually enters the third interface identifier on this interface.

[0155] In this step, after the staff inputs the third interface identifier, the service node device can obtain the third interface identifier input by the staff. Rate limiting variables include rate limiting data, number of successful transmissions, remaining tokens, and the time the interface has been called.

[0156] S302: Based on the third interface identifier, obtain the rate limiting data corresponding to the third interface identifier from the Java Virtual Machine of the service node device.

[0157] In this step, after the service node device obtains the third interface identifier, it retrieves the rate limiting data corresponding to the third interface identifier from the Java Virtual Machine of the service node device, since the rate limiting data is stored in the Java Virtual Machine.

[0158] S303: Based on the third interface identifier, retrieve from the database device the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, corresponding to the third interface identifier.

[0159] In this step, after obtaining the third interface identifier, the service node device retrieves the corresponding number of successful transmissions, remaining tokens, and the time of the interface call from the database device. Since the number of successful transmissions, remaining tokens, and the time of the interface call are stored in the database device's database, a rate limiting variable retrieval request needs to be sent to the database device. This request includes the third interface identifier. Based on the third interface identifier, the database device sends the corresponding number of successful transmissions, remaining tokens, and the time of the interface call to the service node device.

[0160] It should be noted that the execution order of steps S302 and S303 can be as follows: step S302 can be executed first, followed by step S303; step S303 can be executed first, followed by step S302; or steps S302 and S303 can be executed simultaneously. This embodiment does not limit the execution order of steps S302 and S303, and can be set according to actual circumstances.

[0161] S304: Displays rate limiting data, number of successful transmissions, number of remaining tokens, and the time when the interface has been called.

[0162] In this step, after the service node device obtains the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, it can display the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, so that staff can view them.

[0163] It should be noted that the display of rate limiting data, number of successful transmissions, number of remaining tokens, and the time of API calls can be in the form of bar charts, line charts, pie charts, etc. This application embodiment does not limit the display format and can be set according to the actual situation.

[0164] The business data processing request rate limiting method provided in this embodiment displays rate limiting data, number of successful transmissions, number of remaining tokens, and the time of interface calls in a clear and intuitive manner. Compared with the prior art, which cannot view and display rate limiting variables, this application can display rate limiting variables, making rate limiting variables more intuitive. Staff can also have an intuitive understanding of the operation of the business interface calling system and database device, and can also promptly discover problems that occur during operation.

[0165] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0166] Figure 4 This is a schematic diagram of the structure of a first embodiment of the business data processing request rate limiting device provided in this application; this device can be integrated into the service node device in the above method embodiments, or it can be implemented through the service node device in the above method embodiments. Figure 4 As shown, the service data processing request rate limiting device 40 includes:

[0167] The acquisition module 41 is used to acquire, before each business data processing request is sent, the rate limiting data corresponding to the first interface identifier of the business data processing interface in the business data processing request from the Java Virtual Machine of the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0168] Sending module 42 is used to send the first interface identifier and the rate limiting data to the database device;

[0169] The receiving module 43 is used to receive the rate limiting result sent by the database device, the rate limiting result being used to indicate whether rate limiting is required or not.

[0170] Processing module 44 is used to perform rate limiting processing on the business data processing request if the rate limiting result indicates that rate limiting is required.

[0171] Furthermore, the sending module 42 is also configured to send the business data processing request to the operating device of the business data processing system if the rate limiting result indicates that rate limiting is not required.

[0172] Furthermore, the processing module 44 is also used to load the rate limiting data in the database corresponding to the business interface calling system into the Java Virtual Machine of the service node device at preset intervals after the service node device is powered on;

[0173] Furthermore, the acquisition module 41 is also used to acquire the target flow restriction data and the second interface identifier input by the staff in response to the staff's operation of modifying the flow restriction data;

[0174] Furthermore, the processing module 44 is also used to modify the rate limiting data corresponding to the second interface identifier in the database to the target rate limiting data according to the second interface identifier.

[0175] Furthermore, the acquisition module 41 is also used for:

[0176] In response to the staff's operation of viewing the rate limiting variables, the third interface identifier input by the staff is obtained. The rate limiting variables include the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called.

[0177] Based on the third interface identifier, obtain the rate limiting data corresponding to the third interface identifier from the Java Virtual Machine of the service node device;

[0178] Based on the third interface identifier, obtain from the database device the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, corresponding to the third interface identifier;

[0179] The display module 45 displays the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called.

[0180] The business data processing request rate limiting device provided in this embodiment is used to execute the technical solution of the service node device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0181] Figure 5 This is a schematic diagram of the second embodiment of the business data processing request rate limiting device provided in this application; this device can be integrated into the database device in the above method embodiments, or it can be implemented through the database device in the above method embodiments. Figure 5 As shown, the service data processing request rate limiting device 50 includes:

[0182] The receiving module 51 is used to receive the first interface identifier and rate limiting data sent by the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system.

[0183] Module 52 is used for:

[0184] Based on the first interface identifier, obtain the number of successful transmissions;

[0185] If the number of successful transmissions is less than the maximum access count, then based on the first interface identifier, obtain the remaining number of tokens and the time when the interface has been called;

[0186] Processing module 53 is used for:

[0187] The current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity.

[0188] If the number of tokens consumed by the API call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated.

[0189] The sending module 54 is used to send the generated rate limiting result to the service node device.

[0190] Furthermore, the acquisition module 52 is specifically used for:

[0191] Based on the first interface identifier, if it is determined that the number of successful transmissions exists in the database of the database device, the number of successful transmissions is retrieved from the database;

[0192] If it is determined that the number of successful transmissions does not exist in the database of the database device, the number of successful transmissions is set to 0.

[0193] Furthermore, the acquisition module 52 is specifically used for:

[0194] Based on the first interface identifier, if it is determined that the remaining number of tokens exists in the database of the database device, the remaining number of tokens is obtained from the database;

[0195] If it is determined that the remaining number of tokens does not exist in the database of the database device, the remaining number of tokens is set as the token bucket capacity.

[0196] Based on the first interface identifier, if it is determined that the time of the invoked interface exists in the database of the database device, the time of the invoked interface is obtained from the database;

[0197] If it is determined that the called interface time does not exist in the database of the database device, the called interface time is set to 0.

[0198] Furthermore, the processing module 53 is also configured to generate a rate limiting result indicating that rate limiting is not required if the number of tokens consumed by the calling interface is less than or equal to the current number of tokens.

[0199] Furthermore, the processing module 53 is also configured to generate a rate limiting result indicating that rate limiting is required if the number of successful transmissions is greater than or equal to the maximum access volume.

[0200] Furthermore, the processing module 53 is also used for:

[0201] Calculate the token filling time based on the token bucket capacity and the token filling rate;

[0202] Based on whether the rate limiting result indicates that rate limiting is required, the current number of tokens, the number of tokens consumed by the API call, and the token filling time, update the remaining number of tokens and the remaining expiration time corresponding to the remaining number of tokens in the database;

[0203] Based on the current time and the token filling duration, update the database with the time of the invoked interface and the remaining expiration duration corresponding to the time of the invoked interface;

[0204] Based on whether the remaining expiration time corresponding to the number of successful transmissions is less than 0, update the number of successful transmissions and the remaining expiration time corresponding to the number of successful transmissions in the database.

[0205] The business data processing request rate limiting device provided in this embodiment is used to execute the technical solution of the database device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0206] Figure 6 A schematic diagram of the structure of an electronic device provided in this application Figure 1 .like Figure 6 As shown, the electronic device 60 includes:

[0207] Processor 61, memory 62, communication interface 63, and display 64;

[0208] The memory 62 is used to store the executable instructions of the processor 61;

[0209] The processor 61 is configured to execute the technical solution of the service node device in any of the foregoing method embodiments by executing the executable instructions.

[0210] Optionally, the memory 62 can be either standalone or integrated with the processor 61.

[0211] Optionally, when the memory 62 is a device independent of the processor 61, the electronic device 60 may further include:

[0212] Bus 65, memory 62 and communication interface 63 are connected to processor 61 through bus 65 and complete communication with each other. Communication interface 63 is used to communicate with other devices.

[0213] Optionally, the communication interface 63 can be implemented using a transceiver. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write databases, and read-only databases). The memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk drive.

[0214] Bus 65 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0215] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0216] The electronic device is used to execute the technical solution of the service node device in any of the aforementioned method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0217] Figure 7 A schematic diagram of the structure of an electronic device provided in this application Figure 2 .like Figure 7 As shown, the electronic device 70 includes:

[0218] Processor 71, memory 72, and communication interface 73;

[0219] The memory 72 is used to store the executable instructions of the processor 71;

[0220] The processor 71 is configured to execute the technical solution of the database device in any of the foregoing method embodiments by executing the executable instructions.

[0221] Optionally, the memory 72 can be either standalone or integrated with the processor 71.

[0222] Optionally, when the memory 72 is a device independent of the processor 71, the electronic device 70 may further include:

[0223] Bus 74, memory 72 and communication interface 73 are connected to processor 71 through bus 74 and complete communication with each other. Communication interface 73 is used to communicate with other devices.

[0224] Optionally, the communication interface 73 can be implemented using a transceiver. The communication interface is used to enable communication between the database access device and other devices (e.g., clients, read-write databases, and read-only databases). The memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk drive.

[0225] Bus 74 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0226] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0227] The electronic device is used to execute the technical solution of the database device in any of the foregoing method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.

[0228] This application also provides a readable storage medium storing a computer program thereon, which, when executed by a processor, implements the technical solutions provided in any of the foregoing embodiments.

[0229] This application also provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the technical solutions provided in any of the foregoing method embodiments.

[0230] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0231] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for rate limiting business data processing requests, characterized in that, The method, applied to the service node device corresponding to the business interface call system, includes: After the service node device is powered on, at preset intervals, the rate limiting data in the database corresponding to the business interface calling system is loaded into the Java Virtual Machine of the service node device. Before each business data processing request is sent, rate limiting data corresponding to the first interface identifier of the business data processing interface in the business data processing request is obtained from the Java Virtual Machine of the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system. The first interface identifier and the rate limiting data are sent to the database device, so that the database device can obtain the number of successful transmissions based on the first interface identifier; if the number of successful transmissions is less than the maximum access volume, the remaining number of tokens and the time of the interface call are obtained based on the first interface identifier; the current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity; if the number of tokens consumed by the interface call is greater than the current number of tokens, a rate limiting result indicating that rate limiting is required is generated; the generated rate limiting result is sent to the service node device. Receive the rate limiting result sent by the database device, the rate limiting result being used to indicate whether rate limiting is required or not; If the rate limiting result indicates that rate limiting is required, rate limiting is applied to the business data processing request.

2. The method according to claim 1, characterized in that, The method further includes: If the rate limiting result indicates that rate limiting is not required, then the business data processing request is sent to the operating device of the business data processing system.

3. The method according to claim 1, characterized in that, The method further includes: In response to the staff's operation to modify the rate limiting data, obtain the target rate limiting data and the second interface identifier input by the staff; Based on the second interface identifier, the rate limiting data corresponding to the second interface identifier in the database is modified to the target rate limiting data.

4. The method according to claim 1, characterized in that, The method further includes: In response to the staff's operation of viewing the rate limiting variables, the third interface identifier input by the staff is obtained. The rate limiting variables include the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called. Based on the third interface identifier, obtain the rate limiting data corresponding to the third interface identifier from the Java Virtual Machine of the service node device; Based on the third interface identifier, obtain from the database device the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called, corresponding to the third interface identifier; Display the rate limiting data, the number of successful transmissions, the number of remaining tokens, and the time when the interface has been called.

5. A method for rate limiting business data processing requests, characterized in that, Applied to a database device, the method includes: The system receives a first interface identifier of the business data processing interface and corresponding rate limiting data from a business data processing request sent by a service node device. The rate limiting data includes the maximum access volume, token bucket capacity, token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system. The rate limiting data is obtained from the Java Virtual Machine of the service node device. After the service node device is powered on, it loads the rate limiting data from the database corresponding to the business interface calling system into the Java Virtual Machine of the service node device at preset intervals. Based on the first interface identifier, obtain the number of successful transmissions; If the number of successful transmissions is less than the maximum access count, then based on the first interface identifier, obtain the remaining number of tokens and the time when the interface has been called; The current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity. If the number of tokens consumed by the API call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated. The generated rate limiting result is sent to the service node device so that the service node device can perform rate limiting on the service data processing request when the rate limiting result indicates that rate limiting is required.

6. The method according to claim 5, characterized in that, The step of obtaining the number of successful transmissions based on the first interface identifier includes: Based on the first interface identifier, if it is determined that the number of successful transmissions exists in the database of the database device, the number of successful transmissions is retrieved from the database; If it is determined that the number of successful transmissions does not exist in the database of the database device, the number of successful transmissions is set to 0.

7. The method according to claim 5, characterized in that, The step of obtaining the remaining token count and the time of the interface call based on the first interface identifier includes: Based on the first interface identifier, if it is determined that the remaining number of tokens exists in the database of the database device, the remaining number of tokens is obtained from the database; If it is determined that the remaining number of tokens does not exist in the database of the database device, the remaining number of tokens is set as the token bucket capacity. Based on the first interface identifier, if it is determined that the time of the invoked interface exists in the database of the database device, the time of the invoked interface is obtained from the database; If it is determined that the called interface time does not exist in the database of the database device, the called interface time is set to 0.

8. The method according to claim 5, characterized in that, Before sending the generated rate limiting result to the service node device, the method further includes: If the number of tokens consumed by the API call is less than or equal to the current number of tokens, a rate limiting result indicating that rate limiting is not required is generated.

9. The method according to claim 5, characterized in that, After obtaining the number of successful transmissions, the method further includes: If the number of successful transmissions is greater than or equal to the maximum access volume, a rate limiting result indicating that rate limiting is required is generated.

10. The method according to claim 5 or 8, characterized in that, Before sending the generated rate limiting result to the service node device, the method further includes: Calculate the token filling time based on the token bucket capacity and the token filling rate; Based on whether the rate limiting result indicates that rate limiting is required, the current number of tokens, the number of tokens consumed by the API call, and the token filling time, update the remaining number of tokens and the remaining expiration time corresponding to the remaining number of tokens in the database; Based on the current time and the token filling duration, update the database with the time of the invoked interface and the remaining expiration duration corresponding to the time of the invoked interface; Based on whether the remaining expiration time corresponding to the number of successful transmissions is less than 0, update the number of successful transmissions and the remaining expiration time corresponding to the number of successful transmissions in the database.

11. A business data processing request rate limiting device, wherein the business data processing request rate limiting device is used to implement the business data processing request rate limiting method according to any one of claims 1-4, characterized in that, include: The acquisition module is used to acquire, before each business data processing request is sent, the rate limiting data corresponding to the first interface identifier of the business data processing interface in the business data processing request from the Java Virtual Machine of the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system. The sending module is used to send the first interface identifier and the rate limiting data to the database device; A receiving module is used to receive the rate limiting result sent by the database device, wherein the rate limiting result is used to indicate whether rate limiting is required or not. The processing module is used to perform rate limiting processing on the business data processing request if the rate limiting result indicates that rate limiting is required.

12. A business data processing request rate limiting device, wherein the business data processing request rate limiting device is used to implement the business data processing request rate limiting method according to any one of claims 5-10, characterized in that, include: The receiving module is used to receive the first interface identifier and rate limiting data sent by the service node device. The rate limiting data includes the maximum number of accesses, the token bucket capacity, the token filling rate, and the number of tokens consumed when calling the interface. The token bucket capacity is related to the number of concurrent data processed by the business data processing system. The acquisition module is used for: Based on the first interface identifier, obtain the number of successful transmissions; If the number of successful transmissions is less than the maximum access count, then based on the first interface identifier, obtain the remaining number of tokens and the time when the interface has been called; Processing module, used for: The current number of tokens in the token bucket is determined based on the current time, the remaining number of tokens, the token filling rate, and the token bucket capacity. If the number of tokens consumed by the API call exceeds the current number of tokens, a rate limiting result indicating that rate limiting is required is generated. The sending module is used to send the generated rate limiting results to the service node device.

13. An electronic device, characterized in that, include: Processor, memory, communication interface, display; The memory is used to store the executable instructions of the processor; The processor is configured to execute the service data processing request rate limiting method according to any one of claims 1 to 4 by executing the executable instructions.

14. An electronic device, characterized in that, include: Processor, memory, communication interface; The memory is used to store the executable instructions of the processor; The processor is configured to execute the business data processing request rate limiting method according to any one of claims 5 to 10 by executing the executable instructions.

15. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the business data processing request rate limiting method according to any one of claims 1 to 10.

16. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, is used to implement the business data processing request rate limiting method according to any one of claims 1 to 10.