A multi-dimensional service and caller traffic real-time flow limiting alarm method, device, equipment and medium
By using Java Agent and Javassist to instrument bytecode in the middleware system to obtain business scenarios and caller identifiers, and combining this with the rate limiting rules in the configuration center, the problem of fine-grained traffic control in the middleware system is solved. This achieves real-time rate limiting and multi-channel alarms without code intrusion, improving the system's stability and response speed.
Patent Information
- Application Number
- CN202611332220.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-20
AI Technical Summary
Existing technologies make it difficult to achieve fine-grained differentiation and real-time rate limiting of access traffic from different callers and different business scenarios in the middleware system, which can easily lead to system avalanche and service unavailability under sudden traffic or high load conditions.
By using Java Agent and Javassist together, bytecode instrumentation is performed to obtain business scenario tags and caller identifiers. Combined with the rate limiting rules and alarm notification configuration in the configuration center, second-level traffic statistics and rate limiting processing can be achieved without modifying the original business code.
It achieves low-intrusion traffic control without modifying business code, enabling fine-grained traffic statistics, real-time rate limiting, and multi-channel alarms for multi-dimensional business scenarios and callers, reducing development and maintenance costs and improving system stability and response speed.
Smart Images

Figure CN123145207A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for real-time flow limiting alarm of multi-dimensional services and caller traffic. Background Technology
[0002] As internet businesses continue to expand, middleware systems typically need to provide services to multiple business stakeholders simultaneously. Different users may continuously initiate access requests for different business scenarios. When sudden surges in traffic occur within a short period, or when the system is under high load for extended periods, service resources can be rapidly consumed, potentially leading to system avalanches, abnormal interface responses, or even service unavailability. Therefore, effectively tracking, limiting, and alerting on access traffic from different users and for different business scenarios has become a crucial technical challenge for ensuring the stable operation of middleware systems.
[0003] In existing technologies, a common approach is to perform traffic statistics and rate limiting at the gateway layer, such as Nginx or API Gateway. This method can provide unified control before requests enter the business system, but it can usually only perform relatively coarse-grained statistics based on interfaces and access addresses. It is difficult to combine specific business tags and caller information for fine-grained differentiation, thus failing to meet the needs of different callers and different business scenarios for adopting different rate limiting strategies.
[0004] Another approach is to embed traffic monitoring and rate limiting logic, such as AOP (Aspect-Oriented Programming) and interceptors, into the business logic. While this method can be integrated with specific business logic, it requires corresponding modifications to the business logic, making it highly intrusive. When the business scenario, rate limiting rules, or monitoring scope changes, it may be necessary to modify and redeploy the business logic, increasing development and maintenance costs, and making it difficult to achieve flexible and dynamic adjustments.
[0005] In addition, third-party monitoring platforms such as Prometheus and SkyWalking can be used to monitor the system's operational status or call chain. While these solutions can achieve a certain degree of call chain tracing and metric collection, they still have shortcomings in terms of real-time traffic statistics, rate limiting response speed, and custom business tag configuration. They struggle to meet the needs for second-level traffic statistics, real-time rate limiting, and fine-grained traffic control combining multi-dimensional business tags and caller information. Summary of the Invention
[0006] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for real-time rate limiting and alarming of multi-dimensional business and caller traffic. This method can run on the application server of a middleware system, and is implemented collaboratively by a Java Agent loaded in the JVM (Java Virtual Machine) and an independent configuration center. It can perform second-level traffic statistics, rate limiting, and alarm notifications for different callers and different business scenarios without modifying the original business code. The specific solution is as follows: Firstly, this application discloses a method for real-time rate limiting and alarming of multi-dimensional business and caller traffic, including: Obtain the business scenario tag corresponding to the target business method, and during the class loading phase of the target business class, use Java Agent to perform bytecode instrumentation on the target business class using Javassist, so that when the instrumented target business method is called, it obtains the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request. The Java Agent receives rate limiting rules and corresponding alarm notification configurations from the configuration center, and loads the rate limiting rules and alarm notification configurations into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; In response to the invocation of the target business method, the rate limiting dimension corresponding to the current call request is determined according to the business scenario code and the caller identifier. The traffic of the current call request is counted using a sliding time window counter corresponding to the rate limiting dimension. Then, the traffic count value of the sliding time window counter is compared with the rate limiting threshold. When the traffic count value exceeds the rate limiting threshold, rate limiting processing is performed on the current call request. In response to the rate limiting process, the alarm notification object and alarm channel are determined according to the alarm notification configuration corresponding to the rate limiting rule, and an alarm notification for the rate limiting dimension is sent to the alarm notification object through the alarm channel.
[0007] The method for obtaining the business scenario tag corresponding to the target business method includes: Predefine business scenario tag annotations for marking business scenarios, and use the business scenario tag annotations to mark target business methods; During the class loading phase of the target business class, the business scenario tag annotation corresponding to the target business method is identified, and the corresponding business scenario code is extracted from the business scenario tag annotation; wherein, the business scenario tag annotation is also configured with at least one extended tag attribute, so that different extended tag attributes and the business scenario code jointly represent different business scenarios.
[0008] Specifically, during the class loading phase of the target business class, bytecode instrumentation of the target business class is performed using Java Agent and Javassist, so that when the instrumented target business method is invoked, it obtains the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the invocation request, including: Register a class file converter through a Java Agent, and use the class file converter to filter loaded classes according to the configured package name prefix and / or class name pattern, and determine the loaded classes that meet the package name prefix and / or class name pattern as the target business classes; The target business class is parsed using Javassist and its business methods are traversed. If a target business method with the business scenario tag is identified, instrumentation code for performing traffic counting and rate limiting is inserted into the target business method. When the target business method is invoked, the business scenario code is obtained through the instrumentation code, and the caller identifier corresponding to the current call request is obtained from the implicit parameters of the remote procedure call framework.
[0009] The step of receiving rate limiting rules and corresponding alarm notification configurations from the configuration center through the Java Agent, and loading the rate limiting rules and alarm notification configurations into the memory of the Java Agent, includes: The rate limiting rules and alarm notification configurations are stored and managed through a configuration center, and when a change is detected in the rate limiting rules or alarm notification configurations, the changed rate limiting rules and alarm notification configurations are pushed to the Java Agent. The Java Agent stores the received rate limiting rules and alarm notification configurations in a thread-safe memory rule table, and performs local rule matching on the current call request based on the memory rule table.
[0010] The step of determining the rate limiting dimension corresponding to the current call request based on the business scenario code and the caller identifier includes: Based on the caller configuration item and business scenario configuration item in the rate limiting rule, the rate limiting dimension is determined as a combination dimension of the caller identifier and the business scenario code, a business scenario code dimension, or a caller identifier dimension; wherein, when the caller configuration item is empty, the rate limiting rule applies to multiple callers; when the business scenario configuration item is empty, the rate limiting rule applies to multiple business scenarios.
[0011] The step of using a sliding time window counter corresponding to the rate limiting dimension to count the traffic of the current call request, then comparing the traffic count value of the sliding time window counter with the rate limiting threshold, and performing rate limiting processing on the current call request when the traffic count value exceeds the rate limiting threshold includes: For different rate limiting dimensions, establish corresponding sliding time window counters, and when the current call request arrives, perform an atomic increment operation on the sliding time window counter corresponding to the current call request; Obtain the traffic count value of the sliding time window counter within the corresponding time window, compare the traffic count value with the corresponding rate limiting threshold, and when the traffic count value exceeds the rate limiting threshold, directly reject the current call request or return a preset degradation response for the current call request; wherein, the time window length of the sliding time window counter is configured according to the rate limiting rules.
[0012] The step of determining the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and sending an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel, includes: According to the rate limiting rule that triggers the rate limiting process, the alarm notification configuration corresponding to the rate limiting rule is obtained from the memory of the Java Agent; The alarm notification object and alarm channel are determined from the alarm notification configuration, and the alarm notification is sent according to the correspondence between the alarm notification object and the alarm channel.
[0013] Secondly, this application discloses a multi-dimensional service and caller traffic real-time rate limiting alarm device, including: The parameter acquisition module is used to acquire the business scenario tag corresponding to the target business method, and during the class loading phase of the target business class, it uses Java Agent to perform bytecode instrumentation on the target business class using Javassist, so that the instrumented target business method can acquire the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request when it is called. A configuration loading module is used to receive rate limiting rules and alarm notification configurations corresponding to the rate limiting rules from the configuration center through the Java Agent, and load the rate limiting rules and alarm notification configurations into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; The rate limiting module is used to respond to the invocation of the target business method, determine the rate limiting dimension corresponding to the current call request based on the business scenario code and the caller identifier, count the traffic of the current call request using a sliding time window counter corresponding to the rate limiting dimension, compare the traffic count value of the sliding time window counter with the rate limiting threshold, and perform rate limiting processing on the current call request when the traffic count value exceeds the rate limiting threshold. An alarm execution module is used to respond to the rate limiting process, determine the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and send an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel.
[0014] Thirdly, this application discloses an electronic device, including: Memory, used to store computer programs; A processor is used to execute the computer program to implement the multi-dimensional business and caller traffic real-time flow limiting alarm method as described above.
[0015] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned multi-dimensional service and real-time flow limiting alarm method for caller traffic.
[0016] In this application, a business scenario tag corresponding to the target business method can be obtained. During the class loading phase of the target business class, bytecode instrumentation is performed on the target business class using Java Agent and Javassist. This allows the instrumented target business method to obtain the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request when it is invoked. The Java Agent receives rate limiting rules and alarm notification configurations corresponding to the rate limiting rules from the configuration center and loads the rate limiting rules and alarm notification configurations into the Java Agent. In the Agent's memory; wherein, the rate limiting rule includes at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; in response to the target business method being called, the rate limiting dimension corresponding to the current call request is determined according to the business scenario code and the caller identifier, and the traffic of the current call request is counted using a sliding time window counter corresponding to the rate limiting dimension, and then the traffic count value of the sliding time window counter is compared with the rate limiting threshold. When the traffic count value exceeds the rate limiting threshold, rate limiting processing is performed on the current call request; in response to the rate limiting processing, the alarm notification object and alarm channel are determined according to the alarm notification configuration corresponding to the rate limiting rule, and an alarm notification for the rate limiting dimension is sent to the alarm notification object through the alarm channel.
[0017] Therefore, the method described in this application, by automatically obtaining the business scenario tag and caller identifier through Java Agent and Javassist during the class loading phase, eliminates the need for inserting dedicated traffic statistics, rate limiting, or alarm logic into the original business code, thus reducing business intrusion and maintenance costs. Furthermore, since the rate limiting rules and alarm notification configurations are loaded into the JavaAgent memory, the current call request can complete rule matching locally and update the sliding time window counter atomically, thereby shortening the rule matching and counting path. Moreover, the rate limiting dimension is jointly determined by the business scenario code and the caller identifier, allowing the rate limiting object to be further refined from the coarse-grained interface level to the caller and business scenario levels. When rate limiting occurs, an alarm is sent based on the corresponding alarm notification configuration, ensuring that the rate limiting event, notification object, and notification channel remain interconnected. Therefore, low-intrusion traffic control without modifying the business code can be achieved, enabling second-level traffic statistics, real-time rate limiting, and multi-channel alarms for callers and multi-dimensional business scenarios. Simultaneously, through dynamic push from the configuration center and the Java Agent memory rule table, rate limiting rules and alarm notification configurations can be dynamically activated, achieving high performance and fine-grained real-time traffic limiting and alarming. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0019] Figure 1 This application discloses a flowchart of a method for real-time rate limiting and alarming of multi-dimensional business and caller traffic; Figure 2 This is a schematic diagram of one implementation architecture disclosed in this application; Figure 3 This is a schematic diagram of the structure of a multi-dimensional service and caller traffic real-time flow limiting alarm device disclosed in this application; Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] Existing traffic control solutions mainly include gateway-level rate limiting, embedded rate limiting in business code, and third-party monitoring platforms. While gateway-level solutions can uniformly manage requests, they typically only provide coarse-grained rate limiting based on interfaces or access addresses, making it difficult to achieve fine-grained control by combining business tags and callers. Solutions such as AOP and interceptors require modification of business code, are highly invasive, and may involve code modification and redeployment when configuration changes occur. Platforms such as Prometheus and SkyWalking have monitoring and call chain tracing capabilities, but they still have shortcomings in terms of real-time traffic statistics, rate limiting response speed, and multi-dimensional business tag configuration, making it difficult to meet the requirements for second-level, dynamic, and fine-grained traffic control.
[0022] To overcome the aforementioned technical problems, this application discloses a method, device, equipment, and medium for real-time traffic limiting and alarming of multi-dimensional business and caller traffic. It can run on the application server of the middleware system and is implemented by a Java Agent loaded in the JVM and an independent configuration center. It can perform second-level traffic statistics, traffic limiting processing, and alarm notifications for different callers and different business scenarios without modifying the original business code.
[0023] See Figure 1 As shown in the figure, this invention discloses a method for real-time rate limiting and alarming of multi-dimensional services and caller traffic, including: Step S11: Obtain the business scenario tag corresponding to the target business method, and during the class loading phase of the target business class, use Java Agent and Javassist to perform bytecode instrumentation on the target business class so that the instrumented target business method can obtain the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request when it is called.
[0024] In this embodiment, the first step is to obtain the business scenario tag corresponding to the target business method. Specifically, it is necessary to predefine business scenario tag annotations for marking business scenarios, and then use these annotations to mark the target business method. Specifically, a business scenario tag annotation @BusinessTag can be defined and set as a method-level annotation, allowing it to directly mark the target business method that requires traffic statistics and rate limiting. The business scenario tag annotation includes at least the business scenario code sceneCode.
[0025] When there are different business modules such as business A and business B in the application server, the business scenario tag annotation can be set on the corresponding target business method. In this way, the original implementation of the business method is preserved in the code structure, and the business scenario is identified only through declarative tags.
[0026] Furthermore, during the class loading phase of the target business class, the business scenario tag annotations corresponding to the target business methods are identified, and the corresponding business scenario codes are extracted from the business scenario tag annotations. Each business scenario tag annotation is configured with at least one extended tag attribute, allowing different extended tag attributes and business scenario codes to jointly represent different business scenarios. During the class loading phase of the target business class, the Java Agent uses Javassist to scan annotations on business methods and obtains instances of the business scenario tag annotations and their attribute values through the API (Application Programming Interface) provided by Javassist. For target business methods with the aforementioned business scenario tag annotations, the sceneCode is extracted and used for instrumentation code; business methods without the aforementioned business scenario tag annotations are not required to enter the corresponding business scenario traffic control path. The extended tag attributes can be attributes such as business type and priority. For target business methods with the same business scenario code but different business types or priorities, a finer-grained business scenario representation can be formed by combining the business scenario code with extended tag attributes. To avoid repeated annotation parsing during repeated loading or enhancement of the same target business class, extracted annotation information can be cached and reused in subsequent processing.
[0027] In this way, because business scenarios are declaratively marked using business scenario tag annotations, the Java Agent can automatically identify target business methods and extract business scenario codes during the class loading phase, eliminating the need for business developers to explicitly write scenario identification code in each call logic. Furthermore, by using at least one extended tag attribute along with the business scenario code to represent different business scenarios, dimensions such as business type and priority can be further expanded within the same business scenario code system. Caching annotation information also reduces redundant parsing. Therefore, this approach improves the automation and scalability of business scenario identification, reduces business code intrusion, and supports fine-grained traffic classification under multi-dimensional business tags, providing stable and reusable scenario identifiers for subsequent execution of rate limiting rules based on different business scenarios.
[0028] Furthermore, a class file converter needs to be registered through a Java Agent. This converter filters loaded classes based on configured package name prefixes and / or class name patterns, identifying those that match the specified patterns as target business classes. The Java Agent implements the `ClassFileTransformer` interface and overrides the `transform` method to intercept loaded classes during the JVM (Java Virtual Machine) class loading phase. The class file converter first performs rapid filtering based on the configured package name prefix, class name pattern, or a combination of both. Wildcards are supported for the class name pattern to quickly exclude JDK (Java Development Kit) libraries, third-party dependencies, and other loaded classes that do not require instrumentation. During class loading interception, bytecode processing exceptions can be captured and recorded, ensuring that exceptions in a single target business class do not prevent the JVM from loading other classes normally. By placing rapid filtering before detailed bytecode parsing, high-overhead analysis of all loaded classes can be avoided.
[0029] Furthermore, Javassist is needed to parse the target business class and traverse its business methods. If a target business method with a business scenario tag is identified, instrumentation code for performing traffic counting and rate limiting is inserted into that method. Specifically, a ClassPool can be obtained using `ClassPool.getDefault()`, and the class search path can be supplemented using `classPool.insertClassPath()` to ensure that the target business class and its dependent classes can be correctly parsed by Javassist. In the `transform` method, `classPool.makeClass(new ByteArrayInputStream(classfileBuffer))` can be used to convert the raw byte array passed from the JVM into a `CtClass` object, and then `ctClass.getDeclaredMethods()` can be used to traverse the business methods in the target business class.
[0030] For each business method, the business scenario tag annotation can be identified by method.getAnnotation(BusinessTag.class); when the returned annotation instance is not empty, the business scenario code and other tag attributes are obtained through the reflection API, and the instrumentation code is constructed accordingly.
[0031] The instrumentation code can insert rate limiting and alarm triggering logic at the beginning of the target business method using ctMethod.insertBefore(String src); it can also insert call count monitoring logic based on the business scenario code and caller identifier before the target business method returns using ctMethod.insertAfter(String src, boolean asFinally), when asFinally is true, which can override both normal and abnormal return paths; and it can insert exception handling logic using ctMethod.addCatch(String src, CtClass exceptionType).
[0032] During bytecode enhancement, the original line number information can be preserved to ensure the readability of debugging and exception stack information; the special syntax of Javassist can be used to access the method context, such as $0 representing this and $1 representing the first parameter, and the method return value can be accessed or modified through $_.
[0033] Optionally, to reduce the overhead of the class loading phase, the class name, annotation information, method signature, or enhanced bytecode information of processed classes can be cached to avoid repeated parsing of the same class. Other optimization methods include lazy loading of unnecessary resources, batch transformation processing of continuously arriving classes during peak class loading periods, reusing bytecode processing objects, using weak reference data structures such as WeakHashMap for cache storage, directly manipulating the classfileBuffer byte array or reusing existing CtClass objects in simple scenarios, and promptly releasing resources that are no longer needed after processing. These performance optimization methods can be used individually or in combination.
[0034] Furthermore, when the target business method is invoked, the business scenario code is obtained through instrumentation, and the caller identifier corresponding to the current call request is obtained from the implicit parameters of the remote procedure call framework. Specifically, the business scenario code can be directly obtained from the business scenario tag information extracted and embedded in the instrumentation code; the caller identifier can be automatically propagated using the implicit parameter mechanism of the remote procedure call framework, for example, by reading the caller's Appcode from Dubbo's RpcContext or gRPC's Metadata.
[0035] When a cross-thread call occurs in the business call chain, the context information corresponding to the current call request can be propagated synchronously to avoid the loss of the caller identifier due to thread switching. The caller identifier can also be written into the MDC (Mapped Diagnostic Context) thread context of logging frameworks such as SLF4J / Logback, enabling subsequent logs to be correlated and queried based on the caller for troubleshooting.
[0036] This approach, by first filtering loaded classes based on package name prefixes and / or class name patterns using a class file converter, and then performing Javassist parsing only on the target business class, reduces the analysis overhead of irrelevant classes. Through ClassPool, CtClass, and annotation recognition mechanisms, the target business methods requiring enhancement can be automatically located during the class loading phase, and traffic counting and rate limiting code can be inserted without modifying the original source code. The caller identifier is obtained through implicit parameters of RPC (Remote Procedure Call) without modifying the explicit input parameters of the target business method. Further employing caching, lazy loading, object reuse, weak reference caching, batch processing, and timely release further reduces the startup and memory overhead of bytecode enhancement. Thus, a non-intrusive, pluggable, and dynamically adjustable instrumentation scope bytecode enhancement mechanism can be achieved, stably obtaining business scenario code and caller identifiers. This improves the accuracy of caller and business scenario identification, reduces the impact on business development processes and JVM class loading performance, and facilitates trace investigation through mechanisms such as MDC.
[0037] Step S12: Receive the rate limiting rules and alarm notification configurations corresponding to the rate limiting rules from the configuration center through the Java Agent, and load the rate limiting rules and alarm notification configurations into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension.
[0038] In this embodiment, a configuration center is needed to store and manage rate limiting rules and alarm notification configurations. When a change in a rate limiting rule or alarm notification configuration is detected, the modified rate limiting rule and alarm notification configuration are pushed to the Java Agent. Specifically, the configuration center is decoupled from the application code and the Java Agent, and is used to uniformly manage configuration content such as caller configuration items, business scenario configuration items, rate limiting thresholds, time window lengths, alarm notification objects, and alarm channels. When the configuration center detects a change in any configuration item, it can immediately push the modified rate limiting rule and alarm notification configuration to the Java Agent; alternatively, it can synchronize the latest configurations through periodic pushes. For example, when the traffic limit for a certain business scenario is adjusted, only the corresponding rate limiting threshold or time window length needs to be modified in the configuration center, without needing to modify the target business method again; similarly, when an alarm object or alarm channel changes, only the corresponding alarm notification configuration needs to be adjusted.
[0039] Furthermore, the received rate limiting rules and alarm notification configurations need to be stored in a thread-safe in-memory rule table via the Java Agent, so that local rule matching can be performed on the current call request based on the in-memory rule table. Specifically, the Java Agent can use thread-safe structures such as ConcurrentHashMap to build the in-memory rule table, and construct rule keys according to rate limiting dimensions, caller configuration items, business scenario configuration items, or combinations thereof, to support reading and updating under high concurrency conditions.
[0040] When the current call request arrives, the Java Agent directly accesses the memory rule table based on the business scenario code and the caller identifier, without needing to synchronously access the remote configuration center; when the configuration center pushes a new configuration, the memory rule table is updated in a thread-safe manner so that subsequent requests use the new rules.
[0041] Table 1 shows a configuration table of a rate limiting rule and alarm notification.
[0042] Table 1. Configuration Contents for Rate Limiting Rules and Alarm Notifications ; In this way, since rate limiting rules and alarm notification configurations are centrally maintained in the configuration center, configuration changes do not depend on business code deployments. Furthermore, because the Java Agent loads the configuration into a thread-safe in-memory rule table, the current call request can complete local matching within the application process, eliminating the need to add remote configuration queries to the business call path. When changes occur in the configuration center, the latest configuration is pushed to the Java Agent, decoupling rule updates from request processing. Therefore, it simultaneously achieves dynamic configuration capabilities and low request processing latency, enabling second-level rate limiting rules and alarm notification configurations to take effect quickly, and is suitable for high-performance local rule matching in high-concurrency business scenarios.
[0043] Step S13: In response to the invocation of the target business method, determine the rate limiting dimension corresponding to the current invocation request based on the business scenario code and the caller identifier, and use the sliding time window counter corresponding to the rate limiting dimension to count the traffic of the current invocation request. Then compare the traffic count value of the sliding time window counter with the rate limiting threshold. When the traffic count value exceeds the rate limiting threshold, perform rate limiting processing on the current invocation request.
[0044] In this embodiment, the first step is to determine the rate-limiting dimension as a combination of the caller identifier and the business scenario code, the business scenario code dimension, or the caller identifier dimension, based on the caller configuration item and the business scenario configuration item in the rate-limiting rule. Specifically, when the caller configuration item is empty, the rate-limiting rule applies to multiple callers; when the business scenario configuration item is empty, the rate-limiting rule applies to multiple business scenarios. Specifically, when the rate-limiting rule configures both the caller configuration item and the business scenario configuration item, the current call request can be matched to the combination of the caller identifier and the business scenario code dimension, allowing for independent traffic control for a specific caller in a specific business scenario.
[0045] When the caller configuration item is empty but the business scenario configuration item is configured, the rate limiting rule applies to multiple callers and can uniformly manage requests entering the same business scenario according to the business scenario code dimension; when the business scenario configuration item is empty but the caller configuration item is configured, the rate limiting rule applies to multiple business scenarios and can uniformly manage requests initiated by the same caller according to the caller identifier dimension.
[0046] When a configuration item is empty, the null value indicates an extension of the rule's scope, rather than indicating that the current call request lacks a business scenario code or caller identifier. The Java Agent can still perform the corresponding rule matching based on the actual business scenario code and caller identifier obtained from the current call request, and select a sliding time window counter in memory corresponding to the rate limiting dimension.
[0047] In this way, by selecting different rate limiting dimensions through combinations of caller configuration items and business scenario configuration items, the same set of rules can cover both precise restrictions for "specific caller + specific business scenario" and uniform restrictions based solely on business scenario or caller. When configuration items are empty, the scope of application of the rules is expanded, reducing the number of rules that need to be repeatedly configured for multiple callers or multiple business scenarios. Therefore, multi-granularity, configurable rate limiting strategies can be implemented without increasing the complexity of business code, balancing fine-grained control with rule configuration efficiency, and solving the problem that traditional gateway layers struggle to differentiate between specific business tags and callers with fine granularity.
[0048] Furthermore, it is necessary to establish corresponding sliding time window counters for different rate limiting dimensions, and to perform an atomic increment operation on the sliding time window counter corresponding to the current call request when the current call request arrives. Specifically, corresponding sliding time window counters can be maintained for the combination dimension of caller identifier and business scenario code, the business scenario code dimension, and the caller identifier dimension, respectively. Time window length W Configure the rate limiting rules, for example, set it to 5 seconds, and allow dynamic adjustment based on business load.
[0049] Each time window can be divided into multiple counting buckets by second, and the counting bucket corresponding to the current second can be updated using atomic counting structures such as AtomicLong. Let the rate limiting dimension be... d The current time is t, and the count values of each second's counter bucket within the corresponding time window are as follows: c The flow count value of the current sliding time window can be expressed as: ; in, C d (t) represents the rate limiting dimension d The flow count value within the current sliding time window. W This indicates the length of the time window. Based on this traffic count value, the corresponding average QPS (Queries Per Second) can also be obtained. ; Because the counter uses atomic increment operations, the risk of count loss caused by concurrent updates can be reduced when multiple threads call the target business method concurrently, and the counts of each rate limiting dimension can be kept independent of each other.
[0050] Furthermore, it is necessary to obtain the traffic count value of the sliding time window counter within the corresponding time window, compare the traffic count value with the corresponding rate limiting threshold, and directly reject the current call request or return a preset degradation response for the current call request when the traffic count value exceeds the rate limiting threshold; wherein, the time window length of the sliding time window counter is configured according to the rate limiting rules. Specifically, let the rate limiting threshold corresponding to the rate limiting dimension d be... T d The comparison condition that triggers rate limiting can be expressed as: ; When the above conditions are met, the Java Agent performs rate limiting. For example, it can directly reject the current call request, preventing the target business method from continuing to execute; or it can return a preset degradation response, allowing the caller to obtain a recognizable degradation result.
[0051] For example, if the time window length for a certain rate limiting dimension is 5 seconds and the rate limiting threshold is 100 times, and a new current call request arrives after 100 requests have been accumulated within the corresponding sliding time window, causing the traffic count value to become 101, then because the traffic count value exceeds the rate limiting threshold, the Java Agent will directly reject the current call request or return a preset downgrade response.
[0052] This approach, by establishing sliding time window counters for different rate-limiting dimensions, avoids the mutual occupation of count quotas between different callers or different business scenarios. Maintaining the window on a second-by-second basis and performing atomic increment operations allows for continuous acquisition of the number of requests within the current time window under high concurrency conditions. By directly comparing the traffic count value with the corresponding rate-limiting threshold and immediately rejecting or downgrading when the threshold is exceeded, rate-limiting decisions can be completed within the local call path. The window length is configured by the rate-limiting rules, which balances response sensitivity and statistical smoothness under different business scenarios. Therefore, it is possible to achieve multi-dimensional traffic statistics and QPS rate limiting accurate to the second, and to perform rate limiting in a timely manner before sudden traffic or continuous high load exhausts system resources, reducing the risk of system avalanche and service unavailability.
[0053] Step S14: In response to the rate limiting process, determine the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and send an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel.
[0054] In this embodiment, the first step is to retrieve the alarm notification configuration corresponding to the rate limiting rule that triggered the rate limiting process from the Java Agent's memory. Specifically, when performing rate limiting, the Java Agent retains the rule identifier or rule key that triggered the current rate limiting and retrieves the alarm notification configuration associated with the rate limiting rule from the memory rule table using this rule identifier or rule key. Thus, the alarm notification configuration maintains a correspondence with the specific rate limiting rule, rather than uniformly using a fixed alarm configuration after any rate limiting occurs. The alarm notification configuration can be written to the Java Agent's memory in the same configuration push as the rate limiting rule and updated synchronously when the configuration center changes.
[0055] Furthermore, it is necessary to determine the alarm notification objects and channels from the alarm notification configuration, and send alarm notifications according to the correspondence between alarm notification objects and alarm channels. Specifically, alarm notification objects may include the address of the WeChat Work robot, the WeChat Work user ID, or the user's mobile phone number; alarm channels may include WeChat Work messages, SMS, or telephone calls. The Java Agent sends alarm notifications for the current rate limiting dimension to the corresponding objects according to the correspondence in the alarm notification configuration. For example, when a combination of a caller identifier and a business scenario code triggers rate limiting, the corresponding business manager can be notified via WeChat Work message, and an SMS or telephone call can be sent to a specified mobile phone number. The alarm content may at least include the rate limiting dimension that triggered the rate limiting and the rate limiting rules, and may further include the business scenario code, caller identifier, time window length, traffic count value, and rate limiting threshold, so that the recipient can quickly determine the source of abnormal traffic.
[0056] In this way, since the alarm notification configuration is obtained from the Java Agent's memory based on the rate-limiting rules that actually trigger rate-limiting, a definite correspondence can be established between alarm events and specific rate-limiting dimensions and their rules. Furthermore, because the alarm notification objects and channels can be dynamically managed by the configuration center, different notification paths can be set for different business scenarios, different callers, or different levels of importance. Therefore, targeted alarms can be sent to the correct objects in a timely manner when rate limiting occurs, reducing false alarms, missed alarms, or mismatched notification objects caused by fixed alarm channels. Moreover, by using multiple channels such as WeChat messages, SMS, and phone calls, the probability of abnormal traffic events being detected and handled in a timely manner is increased.
[0057] In this embodiment, since the business scenario tag and caller identifier are automatically obtained through the Java Agent and Javassist during the class loading phase, the original business code does not need to insert dedicated traffic statistics, rate limiting, or alarm logic, thus reducing business intrusion and maintenance costs. Furthermore, since the rate limiting rules and alarm notification configurations are loaded into the Java Agent's memory, the current call request can complete rule matching locally and update the sliding time window counter atomically, thus shortening the rule matching and counting path. Further, the rate limiting dimension is jointly determined by the business scenario code and the caller identifier, allowing the rate limiting object to be further refined from the coarse-grained interface level to the caller and business scenario level. When rate limiting occurs, an alarm is sent based on the corresponding alarm notification configuration, maintaining the association between the rate limiting event and the notification object and notification channel. Therefore, low-intrusion traffic control without modifying the business code can be achieved, enabling second-level traffic statistics, real-time rate limiting, and multi-channel alarms for callers and multi-dimensional business scenarios. Simultaneously, through dynamic push from the configuration center and the Java Agent's in-memory rule table, rate limiting rules and alarm notification configurations can be dynamically activated, thereby achieving high-performance and fine-grained real-time traffic limiting and alarming.
[0058] As a preferred embodiment, such as Figure 2 The diagram illustrates the overall implementation architecture for the multi-dimensional business and real-time traffic limiting alarm method for callers in this application. One or more business modules run on the application server, and each target business method can be marked using business scenario tag annotations. The Java Agent is loaded during JVM startup via the `-javaagent` parameter and registers a class file converter during the class loading phase of the target business class. Javassist is used to intercept class loading, identify and process annotations, convert bytecode, instrument code, enhance methods, and identify callers. The traffic control configuration center, independent of the application code and the Java Agent, stores the traffic limiting rules and the corresponding alarm notification configurations, and pushes the configurations to the Java Agent. The Java Agent uses an in-memory rule table and a sliding time window counter to perform second-level traffic statistics and traffic limiting processing, and sends alarm notifications to the corresponding alarm notification objects via WeChat messages, SMS, or telephone calls.
[0059] See Figure 3 As shown in the figure, this invention discloses a multi-dimensional service and caller traffic real-time rate limiting alarm device, comprising: The parameter acquisition module 11 is used to acquire the business scenario tag corresponding to the target business method, and during the class loading stage of the target business class, it uses Java Agent to perform bytecode instrumentation on the target business class using Javassist, so that the instrumented target business method can acquire the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request when it is called. The configuration loading module 12 is used to receive the rate limiting rules and the alarm notification configuration corresponding to the rate limiting rules issued by the configuration center through the Java Agent, and load the rate limiting rules and the alarm notification configuration into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; The rate limiting module 13 is used to respond to the invocation of the target business method, determine the rate limiting dimension corresponding to the current call request according to the business scenario code and the caller identifier, count the traffic of the current call request using a sliding time window counter corresponding to the rate limiting dimension, compare the traffic count value of the sliding time window counter with the rate limiting threshold, and perform rate limiting processing on the current call request when the traffic count value exceeds the rate limiting threshold. The alarm execution module 14 is used to respond to the rate limiting process, determine the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and send an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel.
[0060] In some embodiments, the parameter acquisition module 11 may specifically include: A business method tagging unit is used to predefine business scenario tag annotations for tagging business scenarios, and to tag target business methods using the business scenario tag annotations; The scenario code extraction unit is used to identify the business scenario tag annotation corresponding to the target business method during the class loading phase of the target business class, and extract the corresponding business scenario code from the business scenario tag annotation; wherein, the business scenario tag annotation is also configured with at least one extended tag attribute, so that different extended tag attributes and the business scenario code jointly represent different business scenarios.
[0061] In some embodiments, the parameter acquisition module 11 may specifically include: The target business class determination unit is used to register a class file converter through a Java Agent, and use the class file converter to filter the loaded classes according to the configured package name prefix and / or class name pattern, and determine the loaded classes that satisfy the package name prefix and / or class name pattern as the target business class; The method traversal unit is used to parse the target business class using Javassist and traverse the business methods in the target business class. If a target business method with the business scenario tag is identified, instrumentation code for performing traffic counting and rate limiting is inserted into the target business method. The identifier acquisition unit is used to obtain the business scenario code through the instrumentation code when the target business method is invoked, and to obtain the caller identifier corresponding to the current call request from the implicit parameters of the remote procedure call framework.
[0062] In some embodiments, the configuration loading module 12 may specifically include: The information push unit is used to store and manage the rate limiting rules and the alarm notification configuration through the configuration center, and push the changed rate limiting rules and the alarm notification configuration to the Java Agent when a change is detected in the rate limiting rules or the alarm notification configuration. The rule matching unit is used to store the received rate limiting rules and alarm notification configurations in a thread-safe memory rule table through the Java Agent, so as to perform local rule matching on the current call request based on the memory rule table.
[0063] In some embodiments, the current limiting module 13 may specifically include: The rate limiting dimension determination unit is used to determine the rate limiting dimension as a combination dimension of the caller identifier and the business scenario code, a business scenario code dimension, or a caller identifier dimension, based on the caller configuration item and the business scenario configuration item in the rate limiting rule; wherein, when the caller configuration item is empty, the rate limiting rule applies to multiple callers; when the business scenario configuration item is empty, the rate limiting rule applies to multiple business scenarios.
[0064] In some embodiments, the current limiting module 13 may specifically include: An atomic increment execution unit is used to establish corresponding sliding time window counters for different rate limiting dimensions, and to perform an atomic increment operation on the sliding time window counter corresponding to the current call request when the current call request arrives. A rate limiting processing unit is configured to obtain the traffic count value of the sliding time window counter within the corresponding time window, compare the traffic count value with the corresponding rate limiting threshold, and directly reject the current call request or return a preset degradation response for the current call request when the traffic count value exceeds the rate limiting threshold; wherein, the time window length of the sliding time window counter is configured according to the rate limiting rules.
[0065] In some embodiments, the alarm execution module 14 may specifically include: The configuration acquisition unit is used to acquire the alarm notification configuration corresponding to the rate limiting rule from the memory of the Java Agent, based on the rate limiting rule that triggers the rate limiting process. An alarm notification sending unit is used to determine the alarm notification object and alarm channel from the alarm notification configuration, and send an alarm notification according to the correspondence between the alarm notification object and the alarm channel.
[0066] Furthermore, embodiments of this application also disclose an electronic device, Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0067] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the multi-dimensional service and caller traffic real-time flow limiting alarm method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0068] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0069] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0070] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the multi-dimensional service and caller traffic real-time flow limiting alarm method disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0071] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned multi-dimensional service and real-time traffic limiting alarm method for callers. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0072] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0073] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0074] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0075] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0076] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for real-time rate limiting and alarming of multi-dimensional business and caller traffic, characterized in that, include: Obtain the business scenario tag corresponding to the target business method, and during the class loading phase of the target business class, use JavaAgent to perform bytecode instrumentation on the target business class using Javassist, so that when the instrumented target business method is called, it obtains the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request. The Java Agent receives rate limiting rules and corresponding alarm notification configurations from the configuration center, and loads the rate limiting rules and alarm notification configurations into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; In response to the invocation of the target business method, the rate limiting dimension corresponding to the current call request is determined according to the business scenario code and the caller identifier. The traffic of the current call request is counted using a sliding time window counter corresponding to the rate limiting dimension. Then, the traffic count value of the sliding time window counter is compared with the rate limiting threshold. When the traffic count value exceeds the rate limiting threshold, rate limiting processing is performed on the current call request. In response to the rate limiting process, the alarm notification object and alarm channel are determined according to the alarm notification configuration corresponding to the rate limiting rule, and an alarm notification for the rate limiting dimension is sent to the alarm notification object through the alarm channel.
2. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, The process of obtaining the business scenario tag corresponding to the target business method includes: Predefine business scenario tag annotations for marking business scenarios, and use the business scenario tag annotations to mark target business methods; During the class loading phase of the target business class, the business scenario tag annotation corresponding to the target business method is identified, and the corresponding business scenario code is extracted from the business scenario tag annotation; wherein, the business scenario tag annotation is also configured with at least one extended tag attribute, so that different extended tag attributes and the business scenario code jointly represent different business scenarios.
3. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, During the class loading phase of the target business class, the Java Agent utilizes Javassist to instrument the target business class into bytecode, so that when the instrumented target business method is invoked, it obtains the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the invocation request, including: Register a class file converter through a Java Agent, and use the class file converter to filter loaded classes according to the configured package name prefix and / or class name pattern, and determine the loaded classes that meet the package name prefix and / or class name pattern as the target business classes; The target business class is parsed using Javassist and its business methods are traversed. If a target business method with the business scenario tag is identified, instrumentation code for performing traffic counting and rate limiting is inserted into the target business method. When the target business method is invoked, the business scenario code is obtained through the instrumentation code, and the caller identifier corresponding to the current call request is obtained from the implicit parameters of the remote procedure call framework.
4. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, The step of receiving rate limiting rules and corresponding alarm notification configurations issued by the configuration center through the Java Agent, and loading the rate limiting rules and alarm notification configurations into the memory of the Java Agent, includes: The rate limiting rules and alarm notification configurations are stored and managed through a configuration center, and when a change is detected in the rate limiting rules or alarm notification configurations, the changed rate limiting rules and alarm notification configurations are pushed to the Java Agent. The Java Agent stores the received rate limiting rules and alarm notification configurations in a thread-safe memory rule table, and performs local rule matching on the current call request based on the memory rule table.
5. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, The step of determining the rate limiting dimension corresponding to the current call request based on the business scenario code and the caller identifier includes: Based on the caller configuration item and business scenario configuration item in the rate limiting rule, the rate limiting dimension is determined as a combination dimension of the caller identifier and the business scenario code, a business scenario code dimension, or a caller identifier dimension; wherein, when the caller configuration item is empty, the rate limiting rule applies to multiple callers; when the business scenario configuration item is empty, the rate limiting rule applies to multiple business scenarios.
6. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, The step of using a sliding time window counter corresponding to the rate limiting dimension to count the traffic of the current call request, then comparing the traffic count value of the sliding time window counter with the rate limiting threshold, and performing rate limiting processing on the current call request when the traffic count value exceeds the rate limiting threshold includes: For different rate limiting dimensions, establish corresponding sliding time window counters, and when the current call request arrives, perform an atomic increment operation on the sliding time window counter corresponding to the current call request; Obtain the traffic count value of the sliding time window counter within the corresponding time window, compare the traffic count value with the corresponding rate limiting threshold, and when the traffic count value exceeds the rate limiting threshold, directly reject the current call request or return a preset degradation response for the current call request; wherein, the time window length of the sliding time window counter is configured according to the rate limiting rules.
7. The multi-dimensional service and caller traffic real-time rate limiting alarm method according to claim 1, characterized in that, The step of determining the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and sending an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel, includes: According to the rate limiting rule that triggers the rate limiting process, the alarm notification configuration corresponding to the rate limiting rule is obtained from the memory of the Java Agent; The alarm notification object and alarm channel are determined from the alarm notification configuration, and the alarm notification is sent according to the correspondence between the alarm notification object and the alarm channel.
8. A multi-dimensional service and caller traffic real-time rate limiting alarm device, characterized in that, include: The parameter acquisition module is used to acquire the business scenario tag corresponding to the target business method, and during the class loading phase of the target business class, it uses Java Agent to perform bytecode instrumentation on the target business class using Javassist, so that the instrumented target business method can acquire the business scenario code corresponding to the business scenario tag and the caller identifier corresponding to the call request when it is called. A configuration loading module is used to receive rate limiting rules and alarm notification configurations corresponding to the rate limiting rules from the configuration center through the Java Agent, and load the rate limiting rules and alarm notification configurations into the memory of the Java Agent; wherein, the rate limiting rules include at least a rate limiting dimension and a rate limiting threshold corresponding to the rate limiting dimension; The rate limiting module is used to respond to the invocation of the target business method, determine the rate limiting dimension corresponding to the current call request based on the business scenario code and the caller identifier, count the traffic of the current call request using a sliding time window counter corresponding to the rate limiting dimension, compare the traffic count value of the sliding time window counter with the rate limiting threshold, and perform rate limiting processing on the current call request when the traffic count value exceeds the rate limiting threshold. An alarm execution module is used to respond to the rate limiting process, determine the alarm notification object and alarm channel according to the alarm notification configuration corresponding to the rate limiting rule, and send an alarm notification for the rate limiting dimension to the alarm notification object through the alarm channel.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the multi-dimensional service and caller traffic real-time flow limiting alarm method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the multi-dimensional service and caller traffic real-time flow limiting alarm method as described in any one of claims 1 to 7.
