Hierarchical current limiting device based on time sequence
By designing a time-based hierarchical current limiting device, using the timing manager, service hierarchical controller and priority manager, the problem that existing current limiters cannot prioritize the guarantee of key services and current limiting capabilities cannot be dynamically adjusted, and the problem of realizing the problem of Priority guarantees for critical services and continuous availability of services during each period.
Patent Information
- Application Number
- CN202411468791.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-18
AI Technical Summary
Existing current limiters cannot prioritize critical services, and current limiting capabilities cannot be dynamically adjusted to accommodate periodic business transfers.
A timing-based hierarchical current limiting device is designed, including a timing manager, a service hierarchical controller and a priority manager. The timing manager regularly scans the timing list, the service hierarchical controller collects monitoring data in real time and generates a current limit control policy. The priority manager generates request filtering rules based on the policy to achieve priority interception and release of requests.
It realizes priority assurance for critical services when the number of requests is large. By creating priority queues and token queues, appropriately intercept non-critical services requests to ensure the responsiveness and performance of critical services. At the same time, the current limiting strategy is automatically adjusted according to the timing relationship to ensure that key services in each period are continuously available.
Smart Images

Figure CN119484412A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gateway current limiting, and in particular to a hierarchical current limiting device based on timing. Background Art
[0002] The gateway is an indispensable module in a large or medium-sized system. As an important component of the gateway, the current limiter can limit the current, thereby preventing excessive congestion and malicious attacks, ensuring reasonable allocation of system resources, improving system stability and efficiency, and ensuring that customers have a better user experience.
[0003] Existing current limiting methods include: token bucket algorithm, leaky bucket algorithm, fixed window counter algorithm, etc. However, the above methods are not suitable for priority management of services and interfaces, and cannot be applied to scenarios where key services need to be prioritized; and when the key services of the system change periodically over time, the current limiter needs to have a certain dynamic adjustment capability to adaptively guarantee the key services of each time period. For example, the system has two services A / B. From 9 am to 3 pm, A is the key service of the system. The current limiter needs to prioritize service A during this period. After 3 pm, B is the key service of the system. The current limiter needs to automatically adjust to prioritize service B. Currently, general current limiters cannot meet the target requirements.
[0004] Therefore, a flow limiter is needed that can satisfy periodic service transfer and priority classification. Summary of the invention
[0005] In view of this, the present invention provides a timing-based hierarchical current limiting device to solve the problems that the existing current limiter cannot give priority to key services and the current limiting capacity cannot present periodic transfer.
[0006] To this end, the present invention provides the following technical solutions:
[0007] A time-sequence based hierarchical current limiting device, comprising:
[0008] a timing manager, a service classification controller, and a priority manager;
[0009] The timing manager periodically scans the timing list through a timing trigger, and when a timing change is detected, it sends the key service information of the current timing to the service hierarchical controller;
[0010] The service classification controller collects service monitoring data in real time, combines the key service information of the current time sequence, and generates the current limiting control strategy and current limiting parameters;
[0011] The priority manager generates request filtering rules based on the priorities of key services and the current limiting control strategy; filters requests according to the request filtering rules and determines whether to intercept or release the requests.
[0012] Furthermore, the time sequence list is responsible for maintaining key service information for each time period;
[0013] The time series list is specified by a configuration file or generated by statistical data sampling.
[0014] Furthermore, the key service information includes: service priority, interface list, QPS peak value and real-time requirements;
[0015] Services not listed here are classified as normal services by default and given the lowest priority.
[0016] Furthermore, the service hierarchical controller collects monitoring data of services in real time, combines key service information of the current sequence, and generates a flow control strategy and flow limiting parameters, including:
[0017] Determine the current limiting rate and threshold based on the number of service nodes and interface performance data;
[0018] Determine the current limiting control strategy based on the concurrency and real-time requirements of the service;
[0019] The current limiting control strategy includes determining whether a request enters a priority queue.
[0020] Furthermore, the service hierarchical controller also includes a specific event alarm device;
[0021] The specific event alarm device includes: triggering a warning when a characteristic event occurs, resetting monitoring data, and regenerating a current limiting control strategy and current limiting parameters;
[0022] The specific events include: a change in the number of nodes of a key service and a surge in the number of service requests.
[0023] Furthermore, the priority manager generates request filtering rules according to the priority of key services and the current limiting control strategy, including:
[0024] The priority manager creates multiple token queues based on the priority parameters provided by the service classification controller, assigns different priorities to each token queue, and sets the token generation rate;
[0025] After the token is generated, it is placed in the queue from high to low according to the token queue priority;
[0026] If all token queues are full, the newly generated token is discarded;
[0027] The priority manager determines whether to create a priority queue and whether the request enters the priority queue based on the current limiting control strategy;
[0028] Determine the request to enter the priority queue and dequeue it in order from high to low, and take out the token from the token queue with the priority from low to high and not higher than its own priority;
[0029] Determine the request that does not enter the priority queue, and take out the token from the token queue with the priority from low to high and not higher than its own priority;
[0030] Requests that obtain a token will be allowed, and requests that do not obtain a token will be blocked.
[0031] A time-series-based hierarchical current limiting method, comprising:
[0032] Scan the time list regularly, and when a time change is detected, determine the key service information of the current time;
[0033] Generate current limiting control strategies and current limiting parameters based on real-time collection of service monitoring data and key service information of the current time series;
[0034] Generate request filtering rules based on the priority of key services and current limiting control strategies;
[0035] Filter requests according to request filtering rules to determine whether to intercept or release the requests.
[0036] Furthermore, the request filtering rules include:
[0037] Create multiple token queues based on priority parameters, assign different priorities and matching rules to each token queue, and set the token generation rate;
[0038] After the token is generated, it is placed in the queue from high to low according to the token queue priority;
[0039] If all token queues are full, the newly generated token is discarded;
[0040] Determine whether to create a priority queue and whether the request enters the priority queue based on the current limiting control policy;
[0041] Determine the request to enter the priority queue and dequeue it in order from high to low, and take out the token from the token queue with the priority from low to high and not higher than its own priority;
[0042] Determine the request that does not enter the priority queue, and take out the token from the token queue with the priority from low to high and not higher than its own priority;
[0043] Requests that obtain a token will be allowed, and requests that do not obtain a token will be blocked.
[0044] Advantages and positive effects of the present invention:
[0045] When the number of requests is large, the flow limiter of the present invention can appropriately intercept requests for non-critical services by creating priority queues and token queues for requests, thereby effectively ensuring the responsiveness and performance of critical services; the flow limiter of the present invention can automatically adjust according to the configured timing relationship to ensure the continuous availability of critical services in each time period. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0047] Figure 1 A structural diagram of a current limiter in an embodiment of the present invention;
[0048] Figure 2 A structural diagram of a timing manager in an embodiment of the present invention;
[0049] Figure 3 This is a flow chart of a service classification controller in an embodiment of the present invention;
[0050] Figure 4 This is a flowchart of token enqueueing in an embodiment of the present invention;
[0051] Figure 5 The figure is a flowchart of request filtering in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0053] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0054] The present invention provides a hierarchical current limiting device based on timing, which includes three submodules: a timing manager, a service hierarchical controller and a priority manager. The timing manager is used to maintain and push information of key services in each time period; the service hierarchical controller is responsible for collecting monitoring data of downstream services in real time, and adjusting the priority and current limiting control strategy of the services through calculation and analysis; the priority manager filters requests. Only requests that obtain tokens from the manager can access downstream services, otherwise they will be intercepted.
[0055] Combination Figure 1 The interaction process of the three modules is further explained as follows: when the schedule changes, the schedule manager will send the key service information of that time period to the service classification controller. The service classification controller will re-collect and calculate the priority of each service and push the result to the priority manager. Finally, the priority manager will change the filtering rules according to the push results to ensure the key services of that time period.
[0056] The timing manager includes: timing list and timing trigger, the structure is as follows Figure 2 As shown. The time list is responsible for maintaining key service information for each time period, including service priority, interface list, QPS peak, and real-time requirements. Services not included are classified as ordinary services by default and given the lowest priority. The time list can be specified by a configuration file or generated by statistical data sampling. The figure shows a simple example of a time list. The actual time list will be more complex. In addition to supporting time records by day, it also supports dimensions such as by week and month. The timing trigger will periodically scan the time list. If a change in the time is detected, the timer will notify the service hierarchical controller of the key service information of the current time.
[0057] The service level controller is responsible for collecting service monitoring data in real time, adjusting service priorities and current limiting parameters, such as Figure 3As shown. First, obtain the priority of the current sequence-critical service, and obtain the resource data and performance monitoring data of the critical service; then determine the flow limiting rate and threshold based on the number of service nodes and interface performance data; determine the flow limiting control strategy based on the service's concurrency, real-time and other characteristics. The service hierarchical controller has a service monitoring list inside, and it will continuously pull data based on the monitoring list. When the timing manager notifies the service hierarchical controller that the critical service has changed, the service hierarchical controller will reset the monitoring list and recalculate; at the same time, the monitoring list has an alarm mechanism. If a specific event is detected, such as a change in the number of nodes of a critical service or a surge in the number of service requests, it can also trigger the service hierarchical controller to recalculate. Finally, the service hierarchical controller pushes the calculation results to the priority manager.
[0058] The priority manager is responsible for filtering requests and controlling whether to release or intercept requests based on specific rules. When the priority manager receives the push results from the service classification controller, it will adaptively adjust the internal data structure and filtering rules so that when a new request arrives, it will determine whether to release it according to the adjusted rules. The priority manager filters requests based on token queues, including:
[0059] like Figure 4 As shown, generate a token queue: after receiving the parameter change notification from the service classification controller, the priority manager creates a token queue according to the priority and current limiting parameters, and determines whether to create a priority queue according to the control policy. Each token queue has a priority and a matching rule. There are no tokens in the token queue at the beginning. The priority manager sets the token generation rate according to the current limiting parameters. After the token is generated, it enters the token queue from high to low priority. If all token queues are full, the newly generated token will be discarded. This mechanism can ensure that high-priority token queues get tokens first.
[0060] Request filtering rules: When a request comes in, the priority manager will match the request parameters with the token queue to get the priority of the request. According to the control strategy, it will determine whether the request needs to be placed in the priority queue. Then the request will try to get a token from the token queue in order from low to high and not higher than its own priority. If the token is successfully obtained, the request will be released. Otherwise, the request will be intercepted. This mechanism can ensure that low-priority requests are suppressed while high-priority requests are processed. The process is as follows: Figure 5 shown.
[0061] Further explanation with actual application scenarios:
[0062] Implementation scenario 1: A service A provides a business query interface and a settlement file download interface. The settlement file download interface is the core interface of the service. This interface consumes service resources and will be accessed by users in the 15:00-15:30 time period, so it needs to be prioritized in this time period. Because too many business query requests will occupy service resources, the request volume of the business query interface should be appropriately suppressed while ensuring the request volume of the file download interface. Using this device, the settlement file download interface in the 15:00-15:30 time period can be configured as a high priority to achieve the purpose;
[0063] Implementation scenario 2: An exchange system provides multiple services, which users access through a gateway. During the day session, the core service of the exchange system is the trading service, during the after-hours settlement, the core service is the clearing service, and during the night session, the core service changes back to the trading service. The exchange needs to guarantee the core service as much as possible in each time period. Using this device, the core service of each time period can be configured as a high priority to achieve the purpose.
[0064] Therefore, when the number of requests is large, the flow limiter of the present invention can appropriately intercept requests for non-critical services by creating priority queues and token queues for requests, thereby effectively ensuring the responsiveness and performance of critical services; the flow limiter of the present invention can automatically adjust according to the configured timing relationship to ensure the continuous availability of critical services in each time period.
[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A time-series based hierarchical current limiting device, characterized in that: include: a timing manager, a service classification controller, and a priority manager; The timing manager periodically scans the timing list through a timing trigger, and when a timing change is detected, it sends the key service information of the current timing to the service hierarchical controller; The service classification controller collects service monitoring data in real time, combines the key service information of the current time sequence, and generates flow control strategies and flow limiting parameters; The priority manager generates request filtering rules based on the priorities of key services and the current limiting control strategy; filters requests according to the request filtering rules and determines whether to intercept or release the requests.
2. A timing-based hierarchical current limiting device according to claim 1, characterized in that: The time series list is responsible for maintaining key service information for each time period; The time series list is specified by a configuration file or generated by statistical data sampling.
3. A time-series based hierarchical current limiting device according to claim 2, characterized in that: The key service information includes: service priority, interface list, QPS peak and real-time requirements; Services not listed here are classified as normal services by default and given the lowest priority.
4. A timing-based hierarchical current limiting device according to claim 1, characterized in that: The service classification controller collects service monitoring data in real time, combines the key service information of the current sequence, and generates a flow control strategy and flow limiting parameters, including: Determine the current limiting rate and threshold based on the number of service nodes and interface performance data; Determine the current limiting control strategy based on the concurrency and real-time requirements of the service; The current limiting control strategy includes determining whether a request enters a priority queue.
5. A timing-based hierarchical current limiting device according to claim 4, characterized in that: The service hierarchical controller also includes a specific event alarm device; The specific event alarm device includes: triggering a warning when a characteristic event occurs, resetting monitoring data, and regenerating a current limiting control strategy and current limiting parameters; The specific events include: a change in the number of nodes of a key service and a surge in the number of service requests.
6. The timing-based hierarchical current limiting device according to claim 1, characterized in that: The priority manager generates request filtering rules according to the priorities of key services and the current limiting control strategy, including: The priority manager creates multiple token queues based on the priority parameters provided by the service classification controller, assigns different priorities to each token queue, and sets the token generation rate; After the token is generated, it is placed in the queue from high to low according to the token queue priority; If all token queues are full, the newly generated token is discarded; The priority manager determines whether to create a priority queue and whether the request enters the priority queue based on the current limiting control strategy; Determine the request to enter the priority queue and dequeue it in order from high to low, and take out the token from the token queue with the priority from low to high and not higher than its own priority; Determine the request that does not enter the priority queue, and take out the token from the token queue with the priority from low to high and not higher than its own priority; Requests that obtain a token will be allowed, and requests that do not obtain a token will be blocked.
7. A time-series based hierarchical current limiting method, based on the time-series based hierarchical current limiting device according to any one of claims 1 to 6, characterized in that: include: Scan the time list regularly, and when a time change is detected, determine the key service information of the current time; Generate current limiting control strategies and current limiting parameters based on real-time collection of service monitoring data and key service information of the current time series; Generate request filtering rules based on the priority of key services and current limiting control strategies; Filter requests according to request filtering rules to determine whether to intercept or release the requests.
8. A time-series-based hierarchical current limiting method according to claim 7, characterized in that: The request filtering rules include: Create multiple token queues based on priority parameters, assign different priorities and matching rules to each token queue, and set the token generation rate; After the token is generated, it is placed in the queue from high to low according to the token queue priority; If all token queues are full, the newly generated token is discarded; Determine whether to create a priority queue and whether the request enters the priority queue based on the current limiting control policy; Determine the request to enter the priority queue and dequeue it in order from high to low, and take out the token from the token queue with the priority from low to high and not higher than its own priority; Determine the request that does not enter the priority queue, and take out the token from the token queue with the priority from low to high and not higher than its own priority; Requests that obtain a token will be allowed, and requests that do not obtain a token will be blocked.